Skip to content

Conversation

@cadenmyers13
Copy link
Contributor

The test works as follows:

  1. Create an environment located in the temp dir.
  2. finds the requirement file and installs the lightweight and maintained package packaging into the temp env
  3. print_info runs and the outputs are compared against expected

@cadenmyers13
Copy link
Contributor Author

@sbillinge Can you review the test to see if you agree with the logic? I've outlined the logic above

Copy link
Contributor

@sbillinge sbillinge left a comment

Choose a reason for hiding this comment

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

the test looks good. I think it could be lighter weight if we just reuse and extend the example_cases fixture.

@@ -0,0 +1,23 @@
**Added:**

* Added test for ``print_info`` function.
Copy link
Contributor

Choose a reason for hiding this comment

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

This can just say "added print_info function. " it is understood that it will have a test.


@pytest.fixture(scope="function")
def temp_dir_print_info(tmp_path_factory):
root_temp_dir = tmp_path_factory.mktemp("temp")
Copy link
Contributor

Choose a reason for hiding this comment

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

is it not possible to reuse the example_cases fixture below? That is building a full temp dir. Don't we just need to add a few new things?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah we can, I'll do that 👍

@cadenmyers13
Copy link
Contributor Author

@sbillinge reused example_cases. I'll get to working on the actual function now

@sbillinge
Copy link
Contributor

much cleaner, thanks.

Copy link
Contributor

@sbillinge sbillinge left a comment

Choose a reason for hiding this comment

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

one small cosmentic thing. Also it was failing tests, but I think you are working on it, right? Make sure you run tests locally before uploading


def print_info(self) -> None:
"""Print information about available packs and examples."""
uninstall_packs = []
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be uninstalled_packs, right? noun vs verb.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice catch! thanks

@cadenmyers13
Copy link
Contributor Author

@sbillinge Tests pass locally but fail on CI since we're pulling packages from envs (ie my local env must be different than CI's env). I'm trying to figure this out right now. It looks like its failing to find the actual requirments file...

stderr = "\nCondaFileIOError: '/tmp/pytest-of-runner/pytest-1/temp27/case5/requirements/packs/packa.txt'. 
[Errno 2] No such file or directory: '/tmp/pytest-of-runner/pytest-1/temp27/case5/requirements/packs/packa.txt'\n\n"

@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.39%. Comparing base (9ce66e6) to head (d7b0a8e).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #71      +/-   ##
==========================================
+ Coverage   91.46%   92.39%   +0.92%     
==========================================
  Files           3        3              
  Lines         164      184      +20     
==========================================
+ Hits          150      170      +20     
  Misses         14       14              
Files with missing lines Coverage Δ
tests/conftest.py 88.88% <100.00%> (+0.57%) ⬆️
tests/test_packsmanager.py 94.94% <100.00%> (+0.97%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cadenmyers13
Copy link
Contributor Author

@sbillinge Got tests passing 😅 ready for review

@sbillinge
Copy link
Contributor

This code looks really nice and clean, congrats! Extremely readable. I will merge. We should check that it passes on windows. The subprocess.run can sometimes be problematic on windows but this will be tested on the merge to main CI

@sbillinge sbillinge merged commit 79170b1 into diffpy:main Nov 4, 2025
7 checks passed
@cadenmyers13 cadenmyers13 deleted the printing-info branch November 5, 2025 00:03
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.

2 participants