test/pmb_test: prepare for common test code (!1876)

Replace the "Add topdir to import path" boilerplate lines in each test
file with a simple "import pmb_test". Use the "# noqa" comment if
"pmb_test" is not used further in the test file, so flake8 does not
complain about an unused module.

Make the path to the testdata available as pmb_test.const.testdata, and
use pmb.config.pmb_src to access the topdir in all tests.

This is in preparation for new "pmbootstrap status" related tests, which
will have shared test code in test/pmb_test/. Also, this makes the
pmbootstrap codebase more consistent with the bpo codebase, which has a
similar "import bpo_test" mechanism.
This commit is contained in:
Oliver Smith 2020-02-20 20:14:38 +01:00 committed by Alexey Min
parent 4a08b5e066
commit e605a0af32
No known key found for this signature in database
GPG Key ID: 0B19D2A65870B448
36 changed files with 116 additions and 155 deletions

25
test/pmb_test/__init__.py Normal file
View File

@ -0,0 +1,25 @@
"""
Copyright 2020 Oliver Smith
This file is part of pmbootstrap.
pmbootstrap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
pmbootstrap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import sys
# Add topdir to import path
topdir = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/../.."))
sys.path.insert(0, topdir)

23
test/pmb_test/const.py Normal file
View File

@ -0,0 +1,23 @@
"""
Copyright 2020 Oliver Smith
This file is part of pmbootstrap.
pmbootstrap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
pmbootstrap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import pmb.config
testdata = pmb.config.pmb_src + "/test/testdata"

View File

@ -22,9 +22,7 @@ import tarfile
import glob
import pytest
# Import from parent directory
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
sys.path.insert(0, pmb_src)
import pmb_test # noqa
import pmb.chroot.apk_static
import pmb.config
import pmb.parse.apkindex

View File

@ -22,10 +22,8 @@ import pytest
import shutil
import filecmp
# Import from parent directory
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
sys.path.insert(0, pmb_src)
import pmb_test
import pmb_test.const
import pmb.aportgen
import pmb.aportgen.core
import pmb.config
@ -50,7 +48,7 @@ def test_aportgen_compare_output(args, tmpdir, monkeypatch):
shutil.copytree(args.aports + "/.git", tmpdir + "/.git")
args.aports = tmpdir
os.mkdir(tmpdir + "/cross")
testdata = pmb_src + "/test/testdata/aportgen"
testdata = pmb_test.const.testdata + "/aportgen"
# Override get_upstream_aport() to point to testdata
def func(args, upstream_path):
@ -73,7 +71,7 @@ def test_aportgen_fork_alpine_compare_output(args, tmpdir, monkeypatch):
shutil.copytree(args.aports + "/.git", tmpdir + "/.git")
args.aports = tmpdir
os.mkdir(tmpdir + "/temp")
testdata = pmb_src + "/test/testdata/aportgen"
testdata = pmb_test.const.testdata + "/aportgen"
args.fork_alpine = True
# Override get_upstream_aport() to point to testdata

View File

@ -17,14 +17,11 @@ You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import logging
import os
import pytest
import sys
import shutil
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.aportgen
import pmb.config
import pmb.helpers.logging

View File

@ -16,13 +16,11 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import sys
import pytest
# Import from parent directory
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
sys.path.insert(0, pmb_src)
import pmb_test
import pmb_test.const
import pmb.chroot.apk_static
import pmb.parse.apkindex
import pmb.helpers.logging
@ -47,7 +45,7 @@ def test_bootimg_invalid_path(args):
def test_bootimg_kernel(args):
path = pmb_src + "/test/testdata/bootimg/kernel-boot.img"
path = pmb_test.const.testdata + "/bootimg/kernel-boot.img"
with pytest.raises(RuntimeError) as e:
pmb.parse.bootimg(args, path)
assert "heimdall-isorec" in str(e.value)
@ -60,7 +58,7 @@ def test_bootimg_invalid_file(args):
def test_bootimg_normal(args):
path = pmb_src + "/test/testdata/bootimg/normal-boot.img"
path = pmb_test.const.testdata + "/bootimg/normal-boot.img"
output = {"base": "0x80000000",
"kernel_offset": "0x00008000",
"ramdisk_offset": "0x04000000",
@ -74,7 +72,7 @@ def test_bootimg_normal(args):
def test_bootimg_qcdt(args):
path = pmb_src + "/test/testdata/bootimg/qcdt-boot.img"
path = pmb_test.const.testdata + "/bootimg/qcdt-boot.img"
output = {"base": "0x80000000",
"kernel_offset": "0x00008000",
"ramdisk_offset": "0x04000000",
@ -88,7 +86,7 @@ def test_bootimg_qcdt(args):
def test_bootimg_dtb_second(args):
path = pmb_src + "/test/testdata/bootimg/dtb-second-boot.img"
path = pmb_test.const.testdata + "/bootimg/dtb-second-boot.img"
output = {"base": "0x00000000",
"kernel_offset": "0x00008000",
"ramdisk_offset": "0x02000000",

View File

@ -20,9 +20,7 @@ import os
import sys
import pytest
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.helpers.logging
import pmb.helpers.pmaports

View File

@ -28,9 +28,7 @@ import pytest
import shutil
import sys
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.build
import pmb.build._package
import pmb.config

View File

@ -18,14 +18,15 @@ along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import subprocess
import os
import pmb_test # noqa
import pmb.config
def test_chroot_interactive_shell():
"""
Open a shell with 'pmbootstrap chroot' and pass 'echo hello_world\n' as stdin.
"""
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
os.chdir(pmb_src)
os.chdir(pmb.config.pmb_src)
ret = subprocess.check_output(["./pmbootstrap.py", "-q", "chroot", "sh"],
timeout=300, input="echo hello_world\n",
universal_newlines=True,
@ -37,8 +38,7 @@ def test_chroot_interactive_shell_user():
"""
Open a shell with 'pmbootstrap chroot' as user, and test the resulting ID.
"""
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
os.chdir(pmb_src)
os.chdir(pmb.config.pmb_src)
ret = subprocess.check_output(["./pmbootstrap.py", "-q", "chroot",
"--user", "sh"], timeout=300, input="id -un",
universal_newlines=True,
@ -51,8 +51,7 @@ def test_chroot_arguments():
Open a shell with 'pmbootstrap chroot' for every architecture, pass 'uname -m\n'
as stdin and check the output
"""
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
os.chdir(pmb_src)
os.chdir(pmb.config.pmb_src)
for arch in ["armhf", "aarch64", "x86_64"]:
ret = subprocess.check_output(["./pmbootstrap.py", "-q", "chroot", "-b", arch,

View File

@ -16,13 +16,9 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import pytest
import sys
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.config.init

View File

@ -16,13 +16,10 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import sys
import pytest
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.aportgen
import pmb.config
import pmb.helpers.frontend

View File

@ -21,9 +21,7 @@ import os
import pytest
import sys
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.build
import pmb.chroot.distccd
import pmb.helpers.logging

View File

@ -17,13 +17,10 @@ You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import pytest
import sys
# Import from parent directory
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
sys.path.insert(0, pmb_src)
import pmb_test # noqa
import pmb.chroot.apk_static
import pmb.parse.apkindex
import pmb.helpers.logging
@ -45,7 +42,8 @@ def args(request):
def pmbootstrap_run(args, parameters, check=True):
"""Execute pmbootstrap.py with a test pmbootstrap.conf."""
return pmb.helpers.run.user(args, ["./pmbootstrap.py"] + parameters,
working_dir=pmb_src, check=check)
working_dir=pmb.config.pmb_src,
check=check)
def test_crossdirect_rust(args):

View File

@ -16,14 +16,11 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import sys
import pytest
# Import from parent directory
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
sys.path.insert(0, pmb_src)
import pmb_test
import pmb_test.const
import pmb.aportgen
import pmb.aportgen.core
import pmb.build
@ -54,8 +51,7 @@ def test_package_kernel_args(args):
def test_find_kbuild_output_dir(args):
# Test parsing an APKBUILD
pkgname = "linux-envkernel-test"
testdata = pmb_src + "/test/testdata"
path = testdata + "/apkbuild/APKBUILD." + pkgname
path = pmb_test.const.testdata + "/apkbuild/APKBUILD." + pkgname
function_body = pmb.parse.function_body(path, "package")
kbuild_out = pmb.build.envkernel.find_kbuild_output_dir(args,
function_body)

View File

@ -21,9 +21,7 @@ import sys
import time
import pytest
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.helpers.git
import pmb.helpers.logging
import pmb.parse.version

View File

@ -16,13 +16,10 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import sys
import pytest
# Import from parent directory
sys.path.insert(0, os.path.abspath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.helpers.logging
import pmb.helpers.other
import pmb.helpers.run

View File

@ -16,13 +16,10 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import sys
import pytest
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.config
import pmb.parse
import pmb.helpers.frontend

View File

@ -22,9 +22,7 @@ import sys
import pytest
import shutil
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.helpers.git
import pmb.helpers.logging
import pmb.helpers.run

View File

@ -16,13 +16,10 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import sys
import pytest
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.helpers.logging
import pmb.helpers.package

View File

@ -21,9 +21,7 @@ import os
import pytest
import sys
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.build.other

View File

@ -17,13 +17,10 @@ You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import pytest
import sys
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.build.other

View File

@ -16,13 +16,11 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import pytest
import sys
# Import from parent directory
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
sys.path.insert(0, pmb_src)
import pmb_test
import pmb_test.const
import pmb.aportgen.device
import pmb.config
import pmb.config.init
@ -42,7 +40,7 @@ def args(tmpdir, request):
def test_get_nonfree_packages(args):
args.aports = pmb_src + "/test/testdata/init_questions_device/aports"
args.aports = pmb_test.const.testdata + "/init_questions_device/aports"
func = pmb.install._install.get_nonfree_packages
# Device without any non-free subpackages

View File

@ -22,9 +22,7 @@ import pytest
import glob
import filecmp
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.parse.apkindex
import pmb.helpers.logging
import pmb.config

View File

@ -16,12 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import sys
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.helpers.mount

View File

@ -21,9 +21,7 @@ import os
import pytest
import sys
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.build.newapkbuild
import pmb.config
import pmb.config.init

View File

@ -17,13 +17,11 @@ You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import pytest
import sys
# Import from parent directory
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
sys.path.insert(0, pmb_src)
import pmb_test
import pmb_test.const
import pmb.parse._apkbuild
@ -39,8 +37,7 @@ def args(tmpdir, request):
def test_subpackages(args):
testdata = pmb_src + "/test/testdata"
testdata = pmb_test.const.testdata
path = testdata + "/apkbuild/APKBUILD.subpackages"
apkbuild = pmb.parse.apkbuild(args, path, check_pkgname=False)
@ -72,7 +69,7 @@ def test_subpackages(args):
def test_kernels(args):
# Kernel hardcoded in depends
args.aports = pmb_src + "/test/testdata/init_questions_device/aports"
args.aports = pmb_test.const.testdata + "/init_questions_device/aports"
func = pmb.parse._apkbuild.kernels
device = "lg-mako"
assert func(args, device) is None
@ -92,7 +89,7 @@ def test_kernels(args):
def test_depends_in_depends(args):
path = pmb_src + "/test/testdata/apkbuild/APKBUILD.depends-in-depends"
path = pmb_test.const.testdata + "/apkbuild/APKBUILD.depends-in-depends"
apkbuild = pmb.parse.apkbuild(args, path, check_pkgname=False)
assert apkbuild["depends"] == ["first", "second", "third"]
@ -143,7 +140,7 @@ def test_parse_attributes():
def test_variable_replacements(args):
path = pmb_src + "/test/testdata/apkbuild/APKBUILD.variable-replacements"
path = pmb_test.const.testdata + "/apkbuild/APKBUILD.variable-replacements"
apkbuild = pmb.parse.apkbuild(args, path, check_pkgname=False)
assert apkbuild["pkgdesc"] == "this should not affect variable replacement"
assert apkbuild["url"] == "replacements variable string-replacements"

View File

@ -26,9 +26,7 @@ import os
import pytest
import sys
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.parse.apkindex
import pmb.helpers.logging
import pmb.helpers.repo

View File

@ -22,13 +22,10 @@ This file tests all functions from pmb.parse.depends.
"""
import collections
import os
import pytest
import sys
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.config
import pmb.config.init
import pmb.helpers.logging

View File

@ -27,9 +27,7 @@ import pytest
import shutil
import sys
# Import from parent directory
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
sys.path.insert(0, pmb_src)
import pmb_test # noqa
import pmb.helpers.pkgrel_bump
import pmb.helpers.logging
@ -67,7 +65,7 @@ def pmbootstrap(args, tmpdir, parameters, zero_exit=True):
pmb.helpers.run.user(args, ["./pmbootstrap.py", "--work=" + tmpdir,
"--mirror-pmOS=", "--aports=" + aports,
"--config=" + config] + parameters,
working_dir=pmb_src)
working_dir=pmb.config.pmb_src)
# Verify that it exits as desired
except Exception as exc:
@ -88,7 +86,7 @@ def setup_work(args, tmpdir):
# Clean the chroots, and initialize the build chroot in the native chroot.
# We do this before creating the fake work folder, because then all packages
# are still present.
os.chdir(pmb_src)
os.chdir(pmb.config.pmb_src)
pmb.helpers.run.user(args, ["./pmbootstrap.py", "-y", "zap"])
pmb.helpers.run.user(args, ["./pmbootstrap.py", "build_init"])
pmb.helpers.run.user(args, ["./pmbootstrap.py", "shutdown"])

View File

@ -32,9 +32,7 @@ import shutil
import shlex
import time
# Import from parent directory
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
sys.path.insert(0, pmb_src)
import pmb_test # noqa
import pmb.chroot.apk_static
import pmb.parse.apkindex
import pmb.helpers.logging
@ -63,7 +61,7 @@ def ssh_create_askpass_script(args):
def pmbootstrap_run(args, config, parameters, output="log"):
"""Execute pmbootstrap.py with a test pmbootstrap.conf."""
return pmb.helpers.run.user(args, ["./pmbootstrap.py", "-c", config] +
parameters, working_dir=pmb_src,
parameters, working_dir=pmb.config.pmb_src,
output=output)
@ -80,7 +78,7 @@ def pmbootstrap_yes(args, config, parameters):
for parameter in parameters:
command += " " + shlex.quote(parameter)
return pmb.helpers.run.user(args, ["/bin/sh", "-c", command],
working_dir=pmb_src)
working_dir=pmb.config.pmb_src)
class QEMU(object):

View File

@ -21,9 +21,8 @@ import os
import pytest
import sys
# Import from parent directory
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
sys.path.insert(0, pmb_src)
import pmb_test
import pmb_test.const
import pmb.aportgen.device
import pmb.config
import pmb.config.init
@ -104,7 +103,7 @@ def test_questions_bootimg(args, monkeypatch):
fake_answers(monkeypatch, ["invalid_path", ""])
assert func(args) is None
bootimg_path = pmb_src + "/test/testdata/bootimg/normal-boot.img"
bootimg_path = pmb_test.const.testdata + "/bootimg/normal-boot.img"
fake_answers(monkeypatch, [bootimg_path])
output = {"base": "0x80000000",
"kernel_offset": "0x00008000",
@ -120,7 +119,7 @@ def test_questions_bootimg(args, monkeypatch):
def test_questions_device(args, monkeypatch):
# Prepare args
args.aports = pmb_src + "/test/testdata/init_questions_device/aports"
args.aports = pmb_test.const.testdata + "/init_questions_device/aports"
args.device = "lg-mako"
args.nonfree_firmware = True
args.nonfree_userland = False
@ -157,7 +156,7 @@ def test_questions_device(args, monkeypatch):
def test_questions_device_kernel(args, monkeypatch):
# Prepare args
args.aports = pmb_src + "/test/testdata/init_questions_device/aports"
args.aports = pmb_test.const.testdata + "/init_questions_device/aports"
args.kernel = "downstream"
# Kernel hardcoded in depends
@ -177,7 +176,7 @@ def test_questions_device_kernel(args, monkeypatch):
def test_questions_device_nonfree(args, monkeypatch):
# Prepare args
args.aports = pmb_src + "/test/testdata/init_questions_device/aports"
args.aports = pmb_test.const.testdata + "/init_questions_device/aports"
args.nonfree_firmware = False
args.nonfree_userland = False

View File

@ -16,13 +16,10 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import pytest
import sys
# Import from parent directory
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
sys.path.insert(0, pmb_src)
import pmb_test # noqa
import pmb.helpers.repo

View File

@ -21,14 +21,11 @@ along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
This file tests functions from pmb.helpers.run_core
"""
import os
import sys
import subprocess
import pytest
# Import from parent directory
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
sys.path.insert(0, pmb_src)
import pmb_test # noqa
import pmb.helpers.run_core

View File

@ -16,13 +16,10 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import sys
import pytest
# Import from parent directory
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
sys.path.insert(0, pmb_src)
import pmb_test # noqa
import pmb.chroot.root
import pmb.chroot.user
import pmb.helpers.run

View File

@ -16,13 +16,11 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import sys
import pytest
# Import from parent directory
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
sys.path.insert(0, pmb_src)
import pmb_test
import pmb_test.const
import pmb.helpers.git
import pmb.helpers.logging
import pmb.parse.version
@ -44,7 +42,7 @@ def test_version(args):
keep_going = False
# Iterate over the version tests from apk-tools
path = pmb_src + "/test/testdata/version/version.data"
path = pmb_test.const.testdata + "/version/version.data"
mapping = {-1: "<", 0: "=", 1: ">"}
count = 0
errors = []

View File

@ -16,12 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import sys
# Import from parent directory
sys.path.insert(0, os.path.realpath(
os.path.join(os.path.dirname(__file__) + "/..")))
import pmb_test # noqa
import pmb.parse.version