Skip to content

Commit 1a52b71

Browse files
authored
Fix CI with newest molecule (#303)
* Fix CI with newest molecule Get rid of the use of molecule ephemeral_directory() as it's gone. The most affected test was the vagrant one, as it's checking the generated Vagrantfile. Set the environment variable for the ephemeral directory in this case, so that we know for sure the path of the ephemeral directory. Signed-off-by: Arnaud Patard <[email protected]> * Update prettier pre-commit configuration The repository has been archived, so don't use it. Signed-off-by: Arnaud Patard <[email protected]> --------- Signed-off-by: Arnaud Patard <[email protected]>
1 parent 980db38 commit 1a52b71

File tree

3 files changed

+7
-18
lines changed

3 files changed

+7
-18
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ default_language_version:
1111
python: python3
1212
minimum_pre_commit_version: 1.14.0
1313
repos:
14-
- repo: https://github.com/pre-commit/mirrors-prettier
14+
- repo: https://github.com/pycontribs/mirrors-prettier
1515
# keep it before yamllint
16-
rev: "v4.0.0-alpha.8"
16+
rev: "v3.4.2"
1717
hooks:
1818
- id: prettier
1919
# Temporary excludes so we can gradually normalize the formatting

conftest.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
from molecule import config, logger
1111
from molecule.app import get_app
12-
from molecule.scenario import ephemeral_directory
1312

1413
LOG = logger.get_logger(__name__)
1514

@@ -79,16 +78,6 @@ def get_molecule_file(path):
7978
return config.molecule_file(path)
8079

8180

82-
@pytest.helpers.register
83-
def molecule_ephemeral_directory(_fixture_uuid):
84-
project_directory = f"test-project-{_fixture_uuid}"
85-
scenario_name = "test-instance"
86-
87-
return ephemeral_directory(
88-
os.path.join("molecule_test", project_directory, scenario_name),
89-
)
90-
91-
9281
def metadata_lint_update(role_directory: str) -> None:
9382
# By default, ansible-lint will fail on newly-created roles because the
9483
# fields in this file have not been changed from their defaults. This is

test/vagrant-plugin/functional/test_func.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
from conftest import change_dir_to
3131
from molecule import logger, util
3232
from molecule.app import get_app
33-
from molecule.scenario import ephemeral_directory
3433

3534
LOG = logger.get_logger(__name__)
3635

@@ -141,16 +140,17 @@ def test_multi_node(temp_dir):
141140
"scenarios",
142141
)
143142

143+
molecule_eph_directory = os.path.join(temp_dir, "ephemeral")
144+
env = os.environ
145+
env["MOLECULE_EPHEMERAL_DIRECTORY"] = molecule_eph_directory
146+
144147
with change_dir_to(scenario_directory):
145148
cmd = ["molecule", "test", "--scenario-name", "multi-node"]
146-
result = get_app(Path()).run_command(cmd)
149+
result = get_app(Path()).run_command(cmd, env=env)
147150
assert result.returncode == 0
148151

149-
molecule_eph_directory = ephemeral_directory()
150152
vagrantfile = os.path.join(
151153
molecule_eph_directory,
152-
"scenarios",
153-
"multi-node",
154154
"Vagrantfile",
155155
)
156156
with open(vagrantfile) as f:

0 commit comments

Comments
 (0)