|
47 | 47 | {integration, sanity, unit}-py3.12-{2.16, 2.17, 2.18, milestone, devel}
|
48 | 48 | {integration, sanity, unit}-py3.13-{2.18, milestone, devel}
|
49 | 49 | """
|
50 |
| -TOX_WORK_DIR = Path() |
51 | 50 | # Without the minimal pytest-ansible condition, installation may fail in some
|
52 | 51 | # cases (pip, uv).
|
53 | 52 | OUR_DEPS = [
|
@@ -178,8 +177,6 @@ def tox_add_core_config(
|
178 | 177 | )
|
179 | 178 | logging.warning(msg)
|
180 | 179 |
|
181 |
| - global TOX_WORK_DIR # pylint: disable=global-statement # noqa: PLW0603 |
182 |
| - TOX_WORK_DIR = state.conf.work_dir |
183 | 180 | env_list = add_ansible_matrix(state)
|
184 | 181 |
|
185 | 182 | if not state.conf.options.gh_matrix:
|
@@ -209,7 +206,7 @@ def tox_add_env_config(env_conf: EnvConfigSet, state: State) -> None:
|
209 | 206 | ]:
|
210 | 207 | return
|
211 | 208 |
|
212 |
| - galaxy_path = TOX_WORK_DIR / "galaxy.yml" |
| 209 | + galaxy_path = env_conf._conf._root / "galaxy.yml" # noqa: SLF001 |
213 | 210 | c_name, c_namespace = get_collection_name(galaxy_path=galaxy_path)
|
214 | 211 | pos_args = state.conf.pos_args(to_path=None)
|
215 | 212 |
|
@@ -449,10 +446,11 @@ def conf_commands_for_integration_unit(
|
449 | 446 | The commands to run.
|
450 | 447 | """
|
451 | 448 | args = f" {' '.join(pos_args)} " if pos_args else " "
|
| 449 | + root = Path(__file__).parents[2].resolve() |
452 | 450 |
|
453 | 451 | # Use pytest ansible unit inject only to inject the collection path
|
454 | 452 | # into the collection finder
|
455 |
| - command = f"python3 -m pytest --ansible-unit-inject-only{args}{TOX_WORK_DIR}/tests/{test_type}" |
| 453 | + command = f"python3 -m pytest --ansible-unit-inject-only{args}{root}/tests/{test_type}" |
456 | 454 | return [command]
|
457 | 455 |
|
458 | 456 |
|
@@ -521,7 +519,7 @@ def conf_commands_pre(
|
521 | 519 | if in_action():
|
522 | 520 | group = "echo ::group::Copy the collection to the galaxy build dir"
|
523 | 521 | commands.append(group)
|
524 |
| - cd_tox_dir = f"cd {TOX_WORK_DIR}" |
| 522 | + cd_tox_dir = f"cd {env_conf._conf._root.as_posix()}" # noqa: SLF001 |
525 | 523 | copy_script = (
|
526 | 524 | f"for file in $(git ls-files 2> /dev/null || ls); do\n\t"
|
527 | 525 | f"mkdir -p {galaxy_build_dir}/$(dirname $file);\n\t"
|
@@ -570,20 +568,21 @@ def conf_deps(env_conf: EnvConfigSet, test_type: str) -> str:
|
570 | 568 | The dependencies.
|
571 | 569 | """
|
572 | 570 | deps = []
|
| 571 | + root = env_conf._conf._root # noqa: SLF001 |
573 | 572 | if test_type in ["integration", "unit"]:
|
574 | 573 | deps.extend(OUR_DEPS)
|
575 | 574 | try:
|
576 |
| - with (TOX_WORK_DIR / "test-requirements.txt").open() as fileh: |
| 575 | + with (root / "test-requirements.txt").open() as fileh: |
577 | 576 | deps.extend(fileh.read().splitlines())
|
578 | 577 | except FileNotFoundError:
|
579 | 578 | pass
|
580 | 579 | try:
|
581 |
| - with (TOX_WORK_DIR / "requirements-test.txt").open() as fileh: |
| 580 | + with (root / "requirements-test.txt").open() as fileh: |
582 | 581 | deps.extend(fileh.read().splitlines())
|
583 | 582 | except FileNotFoundError:
|
584 | 583 | pass
|
585 | 584 | try:
|
586 |
| - with (TOX_WORK_DIR / "requirements.txt").open() as fileh: |
| 585 | + with (root / "requirements.txt").open() as fileh: |
587 | 586 | deps.extend(fileh.read().splitlines())
|
588 | 587 | except FileNotFoundError:
|
589 | 588 | pass
|
|
0 commit comments