Skip to content
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

newSpecFile should update scan_id if provided #307

Merged
merged 4 commits into from
Jun 13, 2024
Merged

Conversation

prjemian
Copy link
Contributor

@prjemian prjemian added the bug Something isn't working label Jun 12, 2024
@prjemian prjemian added this to the v1.0.3 milestone Jun 12, 2024
@prjemian prjemian requested review from MDecarabas and a team June 12, 2024 22:32
@prjemian prjemian self-assigned this Jun 12, 2024
@coveralls
Copy link

coveralls commented Jun 12, 2024

Pull Request Test Coverage Report for Build 9490632653

Details

  • 39 of 39 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.6%) to 83.279%

Totals Coverage Status
Change from base Build 8883479879: 0.6%
Covered Lines: 1021
Relevant Lines: 1226

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 12, 2024

Pull Request Test Coverage Report for Build 9490687156

Details

  • 39 of 39 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.5%) to 83.197%

Totals Coverage Status
Change from base Build 8883479879: 0.5%
Covered Lines: 1020
Relevant Lines: 1226

💛 - Coveralls

@prjemian
Copy link
Contributor Author

Had to make a function that searched for the RE object. The search walks backwards through the call stack to find the closest definition. The user can always provide the RE=RE kwarg to be more specific.

Comment on lines +68 to +97
def test_issue_271(scan_id, tempdir):
"""newSpecFile("title", scan_id=1) did not reset scan id."""
found_RE = RE_finder() # Won't find the one in this module's globals()
assert found_RE is None

RE = RunEngine() # define for this function, so it can be found
found_RE = RE_finder()
assert found_RE is not None
assert found_RE == RE

assert isinstance(scan_id, int)
assert tempdir.exists()
os.chdir(tempdir) # newSpecFile() works in pwd

RE.md["scan_id"] = INITIAL_SCAN_ID
assert RE.md["scan_id"] == INITIAL_SCAN_ID

newSpecFile("title", scan_id=scan_id, RE=RE)
assert RE.md["scan_id"] != INITIAL_SCAN_ID
assert RE.md["scan_id"] == scan_id

# repeat, without passing RE as parameter
RE.md["scan_id"] = INITIAL_SCAN_ID
assert RE.md["scan_id"] == INITIAL_SCAN_ID

newSpecFile("title", scan_id=scan_id)
assert RE.md["scan_id"] != INITIAL_SCAN_ID
assert RE.md["scan_id"] == scan_id


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good testing!

@MDecarabas MDecarabas self-requested a review June 13, 2024 17:51
Copy link
Collaborator

@MDecarabas MDecarabas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solve conflicts in .rst file and we should be ok

@coveralls
Copy link

coveralls commented Jun 13, 2024

Pull Request Test Coverage Report for Build 9506629724

Details

  • 39 of 39 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.5%) to 83.197%

Totals Coverage Status
Change from base Build 9503793161: 0.5%
Covered Lines: 1020
Relevant Lines: 1226

💛 - Coveralls

@prjemian prjemian merged commit 14b7ede into main Jun 13, 2024
6 checks passed
@prjemian prjemian deleted the 271-scan-ID-newSpecFile branch June 14, 2024 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

BUG: newSpecFile() does not reset the scan ID
3 participants