Skip to content

Commit

Permalink
Merge pull request #1964 from mirpedrol/valid-dir
Browse files Browse the repository at this point in the history
when pipeline dir doesn't contain `main.nf` or `nextflow.config`
  • Loading branch information
mirpedrol authored Oct 25, 2022
2 parents 263122a + 8eb75f1 commit 84a083a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- Improve test coverage of sync.py
- `check_up_to_date()` function from `modules_json` also checks for subworkflows.
- The default branch can now be specified when creating a new pipeline repo [#1959](https://github.com/nf-core/tools/pull/1959).
- Only warn when checking that the pipeline directory contains a `main.nf` and a `nextflow.config` file if the pipeline is not an nf-core pipeline [#1964](https://github.com/nf-core/tools/pull/1964)
- Add file `versions.yml` when generating `test.yml` with `nf-core modules create-test-yml` but don't check for md5sum [#1963](https://github.com/nf-core/tools/pull/1963)

### Modules
Expand Down
4 changes: 3 additions & 1 deletion nf_core/modules/modules_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def has_valid_directory(self):
main_nf = os.path.join(self.dir, "main.nf")
nf_config = os.path.join(self.dir, "nextflow.config")
if not os.path.exists(main_nf) and not os.path.exists(nf_config):
raise UserWarning(f"Could not find a 'main.nf' or 'nextflow.config' file in '{self.dir}'")
if Path(self.dir).resolve().parts[-1].startswith("nf-core"):
raise UserWarning(f"Could not find a 'main.nf' or 'nextflow.config' file in '{self.dir}'")
log.warning(f"Could not find a 'main.nf' or 'nextflow.config' file in '{self.dir}'")
return True

def has_modules_file(self):
Expand Down
3 changes: 2 additions & 1 deletion tests/modules/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def test_modules_install_nopipeline(self):
@with_temporary_folder
def test_modules_install_emptypipeline(self, tmpdir):
"""Test installing a module - empty dir given"""
self.mods_install.dir = tmpdir
os.mkdir(os.path.join(tmpdir, "nf-core-pipe"))
self.mods_install.dir = os.path.join(tmpdir, "nf-core-pipe")
with pytest.raises(UserWarning) as excinfo:
self.mods_install.install("foo")
assert "Could not find a 'main.nf' or 'nextflow.config' file" in str(excinfo.value)
Expand Down

0 comments on commit 84a083a

Please sign in to comment.