Skip to content

Commit

Permalink
Allow copiers/comparators to handle directories.
Browse files Browse the repository at this point in the history
  • Loading branch information
dillof committed Jan 4, 2024
1 parent 9629144 commit 327e455
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.5.0 [Unreleased]

- Allow copiers/comparators to handle directories.

# 1.4.0 [2024-01-03]

- Add copiers.
Expand Down
4 changes: 2 additions & 2 deletions nihtest/File.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ def prepare(self, configuration, directory):
if self.input.data is None:
input_file_name = configuration.find_input_file(self.input.file_name)
file_extension = pathlib.Path(self.name).suffix[1:]
output_extension = pathlib.Path(self.input.file_name).suffix[1:]
key = f"{file_extension}.{output_extension}"
input_extension = pathlib.Path(self.input.file_name).suffix[1:]
key = f"{file_extension}.{input_extension}"
if key in configuration.copiers:
copier = configuration.copiers[key]
program = configuration.find_program(copier[0])
Expand Down
22 changes: 21 additions & 1 deletion nihtest/Test.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,28 @@ def compare(self, description, expected, got):
self.failed.append(description)

def list_files(self):
skip_directories = []
files = []
for directory, _, sub_files in os.walk("."):
for directory, sub_directories, sub_files in os.walk("."):
skip = False
for skip_directory in skip_directories:
if directory == skip_directory or directory.startswith(skip_directory + "/"):
skip = True
break
if skip:
continue

for dir in sub_directories:
if directory == ".":
name = dir
else:
name = os.path.join(directory, dir)[2:].replace("\\", "/")
for file in self.case.files:
if name == file.name:
files.append(name)
skip_directories.append("./" + name)
break

for file in sub_files:
if directory == ".":
name = file
Expand Down

0 comments on commit 327e455

Please sign in to comment.