Commit 7bb4701e authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test][conftest] Create a dummy environment cache file

Will be used by the ExperimentEditor tests
parent 89a61b52
Pipeline #30464 passed with stage
in 20 minutes and 12 seconds
......@@ -28,6 +28,7 @@ import sys
import tempfile
import pytest
import pkg_resources
import simplejson as json
import subprocess
import shutil
import importlib
......@@ -45,6 +46,7 @@ else:
prefix = os.path.join(prefix_folder, "prefix")
environment_file = os.path.join(prefix, "environment.json")
@pytest.fixture(
......@@ -64,6 +66,16 @@ def test_prefix():
for path in prefixes:
subprocess.check_call(["rsync", "-arz", path, prefix_folder])
with open(environment_file, "wt") as env_file:
env_file.write(
json.dumps(
{
"Test Env": {"name": "Python 2.7", "version": "1.3.0"},
"Another test Env": {"name": "another test", "version": "1.1.1"},
}
)
)
yield prefix
shutil.rmtree(prefix_folder)
......@@ -84,7 +96,13 @@ def test_prefix():
@pytest.fixture(scope="module")
def beat_context(test_prefix):
Context = namedtuple("Context", ["meta"])
context = Context(meta={"--user": "user", "--prefix": test_prefix})
context = Context(
meta={
"--user": "user",
"--prefix": test_prefix,
"environments": environment_file,
}
)
config = Configuration(context.meta)
context.meta["config"] = config
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment