Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky tests related to data_to_json #6146

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions tests/unit_tests/config/test_forward_model_data_to_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@
return result


# Keywords for the ext_job initialization file
#
ext_job_keywords = [
"MAX_RUNNING",
"STDIN",
Expand All @@ -97,9 +95,6 @@
"MAX_RUNNING_MINUTES",
]

#
# JSON keywords
#
json_keywords = [
"name",
"executable",
Expand Down Expand Up @@ -167,11 +162,7 @@
mode |= stat.S_IXUSR | stat.S_IXGRP
os.chmod(executable, stat.S_IMODE(mode))

ext_job = ExtJob.from_config_file(config_file, name)
os.unlink(config_file)
os.unlink(executable)

return ext_job
return ExtJob.from_config_file(config_file, name)


def empty_list_if_none(_list):
Expand Down Expand Up @@ -210,9 +201,9 @@
if ext_job_config["environment"] is None:
assert ext_job.environment == ExtJob.default_env
else:
assert ext_job.environment.keys() == ext_job_config["environment"].keys()

Check failure on line 204 in tests/unit_tests/config/test_forward_model_data_to_json.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (81 > 79 characters)
for key in ext_job_config["environment"]:
assert ext_job.environment[key] == ext_job_config["environment"][key]

Check failure on line 206 in tests/unit_tests/config/test_forward_model_data_to_json.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (81 > 79 characters)


def generate_job_from_dict(ext_job_config):
Expand Down Expand Up @@ -360,6 +351,7 @@
]


@pytest.mark.usefixtures("use_tmpdir")
def test_one_job(joblist):
for i, job in enumerate(joblist):
run_id = "test_one_job"
Expand All @@ -384,6 +376,7 @@
verify_json_dump(joblist, data, range(len(joblist)), run_id)


@pytest.mark.usefixtures("use_tmpdir")
def test_all_jobs(joblist):
run_all(joblist)

Expand Down Expand Up @@ -542,7 +535,7 @@
"""
),
["DEFAULT_ARGA_VALUE", "configured_argumentB", "<ARGUMENTC>"],
id="Resolved argument given by argument list, not overridden by global",

Check failure on line 538 in tests/unit_tests/config/test_forward_model_data_to_json.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (84 > 79 characters)
),
pytest.param(
dedent(
Expand Down Expand Up @@ -588,7 +581,7 @@
),
"FORWARD_MODEL job_name(<ECLBASE>=A/<ECLBASE>)",
["A/ECLBASE0"],
id="The NOSIM job takes <ECLBASE> as args. Expect no infinite loop.",

Check failure on line 584 in tests/unit_tests/config/test_forward_model_data_to_json.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (81 > 79 characters)
),
],
)
Expand Down Expand Up @@ -758,7 +751,7 @@


@pytest.mark.usefixtures("use_tmpdir")
def test_that_private_over_global_args_does_not_give_logging_message_for_argpassing(

Check failure on line 754 in tests/unit_tests/config/test_forward_model_data_to_json.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (84 > 79 characters)
caplog,
):
caplog.set_level(logging.INFO)
Expand All @@ -785,7 +778,7 @@
job_data = ert_config.forward_model_data_to_json("", 0, 0)["jobList"][0]
assert len(ert_config.forward_model_list) == 1
assert job_data["argList"] == ["A"]
assert "Private arg '<ARG>':'<ARG>' chosen over global 'A'" not in caplog.text

Check failure on line 781 in tests/unit_tests/config/test_forward_model_data_to_json.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (82 > 79 characters)


@pytest.mark.usefixtures("use_tmpdir")
Expand All @@ -801,7 +794,7 @@
),
"DEFINE <ENV> $ENV\nFORWARD_MODEL job_name(<ARG>=<ENV>)",
["env_value"],
id="Test that the environment variable $ENV is put into the forward model",

Check failure on line 797 in tests/unit_tests/config/test_forward_model_data_to_json.py

View workflow job for this annotation

GitHub Actions / annotate-python-linting

line too long (87 > 79 characters)
),
],
)
Expand Down
Loading