@@ -434,6 +434,37 @@ def test_scanpipe_project_model_raise_if_run_in_progress(self):
434434 with self .assertRaises (RunInProgressError ):
435435 self .project1 .reset ()
436436
437+ def test_scanpipe_project_model_walk_codebase_path (self ):
438+ expected_truncated_paths = [
439+ "asgiref-3.3.0-py3-none-any.whl-extract" ,
440+ "asgiref-3.3.0-py3-none-any.whl" ,
441+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref" ,
442+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref-3.3.0.dist-info" ,
443+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref/sync.py" ,
444+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref/testing.py" ,
445+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref/server.py" ,
446+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref/compatibility.py" ,
447+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref/local.py" ,
448+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref/current_thread_executor.py" ,
449+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref/timeout.py" ,
450+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref/wsgi.py" ,
451+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref/__init__.py" ,
452+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref-3.3.0.dist-info/LICENSE" ,
453+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref-3.3.0.dist-info/WHEEL" ,
454+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref-3.3.0.dist-info/top_level.txt" ,
455+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref-3.3.0.dist-info/RECORD" ,
456+ "asgiref-3.3.0-py3-none-any.whl-extract/asgiref-3.3.0.dist-info/METADATA" ,
457+ ]
458+ # We need to truncate the paths to avoid false test failures due to the
459+ # difference in temporary directory names where the test Project lives
460+ truncated_paths = []
461+ for resource_path in self .project_asgiref .walk_codebase_path ():
462+ split_path = str (resource_path ).split ("/codebase/" )
463+ if len (split_path ) > 1 :
464+ truncated_path = split_path [1 ]
465+ truncated_paths .append (truncated_path )
466+ self .assertEquals (expected_truncated_paths , truncated_paths )
467+
437468 def test_scanpipe_run_model_set_scancodeio_version (self ):
438469 run1 = Run .objects .create (project = self .project1 )
439470 self .assertEqual ("" , run1 .scancodeio_version )
0 commit comments