Skip to content

Commit

Permalink
Merge pull request #781 from pyiron/Repo_status_error
Browse files Browse the repository at this point in the history
Update maintenance.py
  • Loading branch information
niklassiemer authored Jul 5, 2022
2 parents f90c074 + 09f8baa commit d4f57c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyiron_base/project/maintenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ def get_repository_status():
module = importlib.import_module(name)
try:
repo = Repo(os.path.dirname(os.path.dirname(module.__file__)))
hash_ = repo.head.reference.commit.hexsha
except InvalidGitRepositoryError:
hash_ = "Not a repo"
else:
try:
hash_ = repo.head.reference.commit.hexsha
except (ValueError, TypeError):
hash_ = "Error while resolving sha"
if hasattr(module, "__version__"):
version = module.__version__
else:
Expand Down
4 changes: 4 additions & 0 deletions tests/project/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ def test_get_iter_jobs(self):
self.assertIsInstance([val for val in self.project.iter_jobs(recursive=True, status="suspended",
convert_to_object=True)][0], ToyJob)

def test_maintenance_get_repository_status(self):
df = self.project.maintenance.get_repository_status()
self.assertIn('pyiron_base', df.Module.values)


class TestToolRegistration(TestWithProject):
def setUp(self) -> None:
Expand Down

0 comments on commit d4f57c3

Please sign in to comment.