Skip to content

Conversation

@Jrice1317
Copy link
Owner

@Jrice1317 Jrice1317 commented Dec 17, 2025

Confirmed having bothfreeze_base and creating a frozen marker file in the base env via extra_files generates RuntimeError: Frozen marker files found from both 'freeze_base / freeze_env' and 'extra_files' for the following environments: base. See here

@Jrice1317 Jrice1317 removed the request for review from marcoesters December 17, 2025 20:07
@Jrice1317 Jrice1317 closed this Dec 18, 2025
@Jrice1317 Jrice1317 reopened this Dec 18, 2025
extra_files:
- frozen.json: conda-meta/frozen
- frozen.json: envs/default/conda-meta/frozen
- frozen.json: envs/env2/conda-meta/frozen
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This environment doesn't exist in your installer. It should also have a linefeed at the end of the file.

install_dir / "conda-meta" / "frozen",
install_dir / "envs" / "default" / "conda-meta" / "frozen",
"freeze_base": install_dir / "conda-meta" / "frozen",
"freeze_env": install_dir / "envs" / "env1" / "conda-meta" / "frozen",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removes the extra_files method from the test.


assert expected_frozen_paths == actual_frozen_paths, (
f"Expected: {sorted(str(p) for p in expected_frozen_paths)}\n"
assert set(expected_frozen_paths.values()) == actual_frozen_paths, (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to handcraft your message here. assert set(...) == set(...) already has a very nice diff that will be easier to read in the log than comparing "Expected" and "Found" (where comparisons will have to be done "by hand").

)

for method, path in expected_frozen_paths.items():
actual_config = json.load(open(path))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
actual_config = json.load(open(path))
actual_config = json.loads(path.read_text())

open outside of a context manager doesn't close the file handle until garbage collection. File handles should be closed when files are no longer needed to avoid resource leaks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may also want to use a different variable name than path because it is too similar to the Path object.

- conda
freeze_env:
conda:
"message": "This environment is frozen."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"message": "This environment is frozen."
message: This environment is frozen.

conda:
"message": "This environment is frozen."

extra_files:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, your construct.yaml file is the one that's broken. It would be much nicer if you committed the one that's working to the repository and then add this later for the negative test case.

Comment on lines 1533 to 1539
shutil.copytree(str(example_path), str(input_path))

with open(input_path / "construct.yaml") as f:
modified_config = YAML().load(f)
modified_config.pop("extra_files", None)
with open(input_path / "construct.yaml", "w") as f:
YAML().dump(modified_config, f)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put this before the context manager. That way, the code inside the context manager is simpler and you don't have to execute two different branches.

Right now, there is no reason for you to even have the same context manager because you're doing different things any. So, the pseudocode would be:

context = pytest.raises() if has_conflicts else nullcontext()
shutil.copytree(example_path, input_path)
read config
if has_conflicts:
    modify config
with context:

You don't need the as c if you're not using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants