-
Notifications
You must be signed in to change notification settings - Fork 660
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
pytest: fix nayduck looking for contracts that are long long gone #12748
base: master
Are you sure you want to change the base?
Conversation
Entirely untested, just a sketch that needs to be verified for operation on nayduck. |
Storing build artifacts in the source directory shouldn't be happening. Although not an ideal, this is introducing a near-test-contracts binary that can output the contracts upon request. A good solution would be for pytest to either maintain their own contracts or link to `near-test-contracts` proper and grab the contracts by calling a function, just like is done in the rest of the test suite.
d2aa307
to
c4b50dd
Compare
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.
LGTM!
Does this work with nayduck tests?
pytest/lib/utils.py
Outdated
"""Loads a WASM file from near-test-contracts package.""" | ||
output = subprocess.check_output(['cargo', 'run', '-p', 'near-test-contracts', filename], | ||
cwd=_REPO_DIR) | ||
return output.stdout |
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.
Nice!
Sanity check - are the tests always executed from within the repo?
@@ -0,0 +1,30 @@ | |||
use std::io::Write as _; |
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.
I'm a bit surprised there aren't any changes to cargo files.
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.
Cargo implicitly considers presence of src/main.rs
to add a [bin]
target, just like presence of src/lib.rs
implicitly adds a [lib]
target and tests/*
each add a new [test]
.
7d2f184
to
0723a38
Compare
0723a38
to
552dc15
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #12748 +/- ##
==========================================
- Coverage 70.66% 70.62% -0.04%
==========================================
Files 848 850 +2
Lines 174088 174545 +457
Branches 174088 174545 +457
==========================================
+ Hits 123016 123276 +260
- Misses 45932 46114 +182
- Partials 5140 5155 +15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Although not an ideal solution, this is introducing a near-test-contracts binary that can output the contracts upon request. A good solution would be for pytest to either maintain their own contracts or link to
near-test-contracts
proper and grab the contracts by calling a function, just like is done in the rest of the test suite.If neard is known to be always built with e.g.
test_features
for nayduck specifically, this code could be moved to a top-level neard subcommand.