Skip to content

Commit

Permalink
catch InvalidGitRepositoryError
Browse files Browse the repository at this point in the history
  • Loading branch information
mirpedrol committed Jun 13, 2023
1 parent 202ee4e commit b4e8f82
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions nf_core/components/components_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest
import questionary
import rich
from git import Repo
from git import InvalidGitRepositoryError, Repo

import nf_core.modules.modules_utils
import nf_core.utils
Expand Down Expand Up @@ -181,9 +181,12 @@ def _run_pytests(self):
console.rule(self.component_name, style="black")

# Check uncommitted changed
repo = Repo(self.dir)
if repo.is_dirty():
log.warning("You have uncommitted changes. Make sure to commit last changes before running the tests.")
try:
repo = Repo(self.dir)
if repo.is_dirty():
log.warning("You have uncommitted changes. Make sure to commit last changes before running the tests.")
except InvalidGitRepositoryError:
pass

# Set pytest arguments
tag = self.component_name
Expand Down

0 comments on commit b4e8f82

Please sign in to comment.