Skip to content

Commit

Permalink
Merge pull request nf-core#1511 from asthara10/test_yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ewels authored Apr 15, 2022
2 parents 3586baf + 7772e5a commit faf4716
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Very minor patch release to fix the full size AWS tests and re-run the template
- Remove traces of markdownlint in the template ([#1486](https://github.com/nf-core/tools/pull/1486)
- Remove accidentally added line in `CHANGELOG.md` in the template ([#1487](https://github.com/nf-core/tools/pull/1487))
- Update linting to check that `.editorconfig` is there and `.yamllint.yml` isn't.
- Don't save md5sum for `versions.yml` when running `nf-core modules create-test-yml` ([#1511](https://github.com/nf-core/tools/pull/1511))

## [v2.3.1 - Mercury Vulture Formatting](https://github.com/nf-core/tools/releases/tag/2.3.1) - [2022-03-23]

Expand Down
22 changes: 13 additions & 9 deletions nf_core/modules/test_yml_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,21 +225,25 @@ def _md5(self, fname):
def create_test_file_dict(self, results_dir, is_repeat=False):
"""Walk through directory and collect md5 sums"""
test_files = []
for root, dir, file in os.walk(results_dir):
for elem in file:
elem = os.path.join(root, elem)
test_file = {"path": elem} # add the key here so that it comes first in the dict
for root, dir, files in os.walk(results_dir):
for filename in files:
# Check that the file is not versions.yml
if filename == "versions.yml":
continue
file_path = os.path.join(root, filename)
# add the key here so that it comes first in the dict
test_file = {"path": file_path}
# Check that this isn't an empty file
if self.check_if_empty_file(elem):
if self.check_if_empty_file(file_path):
if not is_repeat:
self.errors.append(f"Empty file found! '{os.path.basename(elem)}'")
self.errors.append(f"Empty file found! '{os.path.basename(file_path)}'")
# Add the md5 anyway, linting should fail later and can be manually removed if needed.
# Originally we skipped this if empty, but then it's too easy to miss the warning.
# Equally, if a file is legitimately empty we don't want to prevent this from working.
elem_md5 = self._md5(elem)
test_file["md5sum"] = elem_md5
file_md5 = self._md5(file_path)
test_file["md5sum"] = file_md5
# Switch out the results directory path with the expected 'output' directory
test_file["path"] = elem.replace(results_dir, "output")
test_file["path"] = file_path.replace(results_dir, "output")
test_files.append(test_file)

test_files = sorted(test_files, key=operator.itemgetter("path"))
Expand Down

0 comments on commit faf4716

Please sign in to comment.