-
Notifications
You must be signed in to change notification settings - Fork 676
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
pytest: fix nayduck looking for contracts that are long long gone #12748
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.39% 70.38% -0.01%
==========================================
Files 851 852 +1
Lines 174188 174213 +25
Branches 174188 174213 +25
==========================================
+ Hits 122614 122627 +13
- Misses 46327 46336 +9
- Partials 5247 5250 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@nagisa Can you have a look? I added some finishing touches to actually work in nayduck and I moved it to a neard subcommand. |
LGTM though it looks like that in the CI tests here we gotta use something like |
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.