-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/access project from job #806
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlainKadar Can you rebase this on the latest next
branch? It looks like there are some extra commits on this branch.
You may need to hard-reset your local copy of the next
branch because we've been progressively rebasing it and rewriting history to keep next
relatively isolated/clean:
git fetch --all
git checkout next
git reset --hard origin/next
git checkout feature/access-project-from-job
git rebase -i next
signac/contrib/job.py
Outdated
@project.setter | ||
def project(self, new_project): | ||
raise ValueError("Setting project attribute directly is not allowed") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just delete this -- without a setter
, the property will not be settable and will raise an AttributeError
.
@project.setter | |
def project(self, new_project): | |
raise ValueError("Setting project attribute directly is not allowed") |
tests/test_job.py
Outdated
@@ -238,6 +238,13 @@ def test_deepcopy(self): | |||
copied_job.sp.a = 3 | |||
assert copied_job in self.project | |||
|
|||
def test_project(self): | |||
job = self.project.open_job({"a": 0}) | |||
assert job.project.path == self._tmp_pr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's test a few more invariants.
assert job.project.path == self._tmp_pr | |
assert isinstance(job.project, signac.Project) | |
assert job in job.project | |
assert job.project.path == self._tmp_pr |
Codecov Report
@@ Coverage Diff @@
## next #806 +/- ##
==========================================
- Coverage 86.32% 85.04% -1.28%
==========================================
Files 51 54 +3
Lines 4687 4688 +1
Branches 1022 1012 -10
==========================================
- Hits 4046 3987 -59
- Misses 456 522 +66
+ Partials 185 179 -6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
1d63175
to
862fe97
Compare
Sorry, I completely messed up my local repo with changes from master, so moved this to a new PR: #808 |
Description
Users can access the project which a job belongs to from the job object
Motivation and Context
Resolves #423
Checklist: