summaryrefslogtreecommitdiff
path: root/src/selftest/__main__.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/selftest/__main__.py')
-rw-r--r--src/selftest/__main__.py36
1 files changed, 31 insertions, 5 deletions
diff --git a/src/selftest/__main__.py b/src/selftest/__main__.py
index f16a433..f0e9a6a 100644
--- a/src/selftest/__main__.py
+++ b/src/selftest/__main__.py
@@ -35,7 +35,7 @@ def validate_srcdir(srcdir: pathlib.Path) -> None:
for relpath in (
"requirements/install.txt",
"src/test_stages/tox_stages/__main__.py",
- "unit_tests/test_functional.py",
+ "tests/unit/test_functional.py",
):
path = srcdir / relpath
if not path.is_file():
@@ -74,7 +74,7 @@ def safe_extract_all(star: tarfile.TarFile, topdir: pathlib.Path) -> None:
if bad_paths:
sys.exit(
f"Bad paths in the source archive, expected all of them to "
- f"start with {base_path}: {bad_paths}"
+ f"start with {base_path}: {bad_paths}",
)
bad_dirs: Final = [path for path in paths if ".." in path.parts]
@@ -145,21 +145,47 @@ def run_tox(testdir: pathlib.Path) -> None:
if marker.is_symlink() or marker.exists():
sys.exit(f"A `--notest` run still created {marker}")
+ subprocess.check_call(
+ ["python3", "-m", "test_stages.tox_stages", "run", "(@docs or not @manual) and @selftest"],
+ cwd=testdir,
+ env=env,
+ )
+ if not marker.is_file():
+ sys.exit(f"`tox-stages run (@docs or not @manual) and @selftest` did not create {marker}")
+
+ marker.unlink()
+ subprocess.check_call(
+ ["python3", "-m", "test_stages.tox_stages", "run", "-m", "@selftest", "not @manual"],
+ cwd=testdir,
+ env=env,
+ )
+ if not marker.is_file():
+ sys.exit(f"`tox-stages run -m @selftest not @manual` did not create {marker}")
+
utf8_env = dict(env)
utf8_env.update(utf8_locale.UTF8Detect().detect().env_vars)
blurb = "import pathlib"
if blurb in subprocess.check_output(
- ["tox-stages", "run", "@selftest"], cwd=testdir, encoding="UTF-8", env=utf8_env
+ ["tox-stages", "run", "@selftest"],
+ cwd=testdir,
+ encoding="UTF-8",
+ env=utf8_env,
):
sys.exit("A run without any -p option output {blurb!r}")
if blurb in subprocess.check_output(
- ["tox-stages", "run", "@selftest", "-p", "1"], cwd=testdir, encoding="UTF-8", env=utf8_env
+ ["tox-stages", "run", "@selftest", "-p", "1"],
+ cwd=testdir,
+ encoding="UTF-8",
+ env=utf8_env,
):
sys.exit("A `-p 1` run did not output {blurb!r}")
if blurb not in subprocess.check_output(
- ["tox-stages", "run", "@selftest", "-p", "7"], cwd=testdir, encoding="UTF-8", env=utf8_env
+ ["tox-stages", "run", "@selftest", "-p", "7"],
+ cwd=testdir,
+ encoding="UTF-8",
+ env=utf8_env,
):
sys.exit("A `-p 7` run output {blurb!r}")