forked from Mirror/pmbootstrap
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:
parent
4a08b5e066
commit
e605a0af32
36 changed files with 116 additions and 155 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue