Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
17e3747
rm api from cli.py
cadenmyers13 Oct 20, 2025
82f7394
add copy_examples api to packsmanager
cadenmyers13 Oct 20, 2025
d973c83
add tests for copy_examples
cadenmyers13 Oct 20, 2025
375606c
add additional dirs to temp structure
cadenmyers13 Oct 20, 2025
711c24e
rm old tests
cadenmyers13 Oct 20, 2025
987c3e3
add news
cadenmyers13 Oct 20, 2025
9e65a27
glob only files and not dirs
cadenmyers13 Oct 20, 2025
5354831
fix target dir location to be under cwd and change name for new test …
cadenmyers13 Oct 22, 2025
47d87fb
Add additional test case, fix how copy location is tested
cadenmyers13 Oct 22, 2025
0a490b9
copy_examples function
cadenmyers13 Oct 22, 2025
6e2695d
rm error message function
cadenmyers13 Oct 23, 2025
e96988f
add test for forced overwrite of copied files
cadenmyers13 Oct 23, 2025
abfba68
Add 'force' param to copy_examples
cadenmyers13 Oct 23, 2025
d4cddf5
fix copy_tree to handle warnings and errors properly
cadenmyers13 Oct 27, 2025
38881b8
Merge branch 'main' of github.com:diffpy/diffpy.cmi into copy-func-test
cadenmyers13 Oct 28, 2025
f4fe605
pin workflow to python 3.13
cadenmyers13 Oct 30, 2025
07cbcd7
add test for force and non-force to make sure files are copied correctly
cadenmyers13 Oct 31, 2025
078b13c
update copy_tree_to_target to handle different copying cases
cadenmyers13 Oct 31, 2025
e7444d7
capture warning output in print statement
cadenmyers13 Oct 31, 2025
c792c0b
add rich to conda.txt
cadenmyers13 Oct 31, 2025
7d7a2a3
add UC comments
cadenmyers13 Oct 31, 2025
52a6752
use ANSI color code for now
cadenmyers13 Oct 31, 2025
611bdf5
rm rich from reqs
cadenmyers13 Oct 31, 2025
d6f34e0
Rm colors from print
cadenmyers13 Oct 31, 2025
087851b
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Oct 31, 2025
87c1f43
rm color from test
cadenmyers13 Nov 1, 2025
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
Prev Previous commit
Next Next commit
capture warning output in print statement
  • Loading branch information
cadenmyers13 committed Oct 31, 2025
commit e7444d7623dfee6dec8f132aa991867e98b2a182
17 changes: 10 additions & 7 deletions tests/test_packsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,25 +278,28 @@ def test_copy_examples_location(input, expected_paths, example_cases):
# Expected: Raise a warning with the message.
["ex1"],
(
"Example directory(ies): 'ex1' already exist. "
"Current versions of existing files have "
"been left unchanged. To overwrite, please rerun "
"and specify --force."
"WARNING: Example 'packA/ex1' already exists at "
"the specified target directory. "
"Existing files were left unchanged; new or missing "
"files were copied. "
"To overwrite everything, rerun with --force."
),
Path("docs/examples/"),
True,
),
],
)
def test_copy_examples_bad(
bad_inputs, expected, path, is_warning, example_cases
bad_inputs, expected, path, is_warning, example_cases, capsys
):
examples_dir = example_cases / "case3"
pm = PacksManager(root_path=examples_dir)
target_dir = None if path is None else examples_dir / path
if is_warning:
with pytest.warns(UserWarning, match=re.escape(expected)):
pm.copy_examples(bad_inputs, target_dir=target_dir)
pm.copy_examples(bad_inputs, target_dir=target_dir)
captured = capsys.readouterr()
actual = captured.out
assert re.search(re.escape(expected), actual)
else:
with pytest.raises(FileNotFoundError, match=re.escape(expected)):
pm.copy_examples(bad_inputs, target_dir=target_dir)
Expand Down
Loading