File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -264,6 +264,10 @@ def matches_allowed_patterns(file_path):
264264 """
265265 Check if a file matches any of the allowed glob patterns.
266266 """
267+ # Note: ignoring notebooks is needed to not overwrite converted notebooks
268+ # with the original ones as currently the copying process is done after the conversion
269+ if file_path .endswith (".ipynb" ):
270+ return False
267271 return any (fnmatch .fnmatch (file_path , pattern ) for pattern in files_patterns )
268272
269273 def is_ignored (file_path ):
Original file line number Diff line number Diff line change @@ -43,23 +43,23 @@ def test_generate_assignment_no_copy_with_files(tmp_path):
4343
4444def test_generate_assignment_copy_with_files (tmp_path ):
4545 input_dir , output_dir = _create_input_output_dirs (tmp_path , ["simple.ipynb" ])
46- test_file = input_dir / "test.txt "
46+ test_file = input_dir / "test.py "
4747 test_file .touch ()
4848 assert test_file .exists ()
4949
5050 GenerateAssignment (
5151 input_dir = str (input_dir ),
5252 output_dir = str (output_dir ),
5353 file_pattern = "*.ipynb" ,
54- assignment_settings = AssignmentSettings (allowed_files = ["*[!.ipynb] " ]),
54+ assignment_settings = AssignmentSettings (allowed_files = ["*" ]),
5555 config = None ,
5656 ).start ()
5757
5858 assert (output_dir / "simple.ipynb" ).exists ()
5959 # Ensure the notebook was converted
6060 assert "BEGIN SOLUTION" not in (output_dir / "simple.ipynb" ).read_text ()
6161 assert (output_dir / "gradebook.json" ).exists ()
62- assert (output_dir / "test.txt " ).exists ()
62+ assert (output_dir / "test.py " ).exists ()
6363
6464
6565def test_generate_assignment_copy_with_dirs (tmp_path ):
You can’t perform that action at this time.
0 commit comments