-
Notifications
You must be signed in to change notification settings - Fork 61
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 one file #796
Pytest one file #796
Conversation
So, addopts = ["--pyargs", "..."] What it does is changing the way the positional arguments are interpreted, so As a single string, However, you are already specifying the test path, so |
I moved back the tests to keep the change minimal, and just fix #786. If @renatomello can confirm this is solving the issue, I would immediately merge this PR, and move the tests and in a separate one (but you can start the new one even immediately @Edoardo-Pedicillo). |
There is a single test failing assert 1.1305219110140324e-08 < 1e-08 Since it has been written by @renatomello one week ago, maybe you can help to solve it? It would be appreciated |
This is closed by #797 |
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.
Tested and can confirm the correct behavior.
Codecov ReportBase: 100.00% // Head: 100.00% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## master #796 +/- ##
===========================================
Coverage 100.00% 100.00%
===========================================
Files 97 47 -50
Lines 12890 5706 -7184
===========================================
- Hits 12890 5706 -7184
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Is that the reason coverage decreased to 20%? |
Don't believe so, I'm investigating the issue. |
It is useful for manual debugging and unharmful on the CI, so fine to have it by default
It is weird, because I can not reproduce the low coverage locally, and the differences with Let's run once more, and then I will have to more carefully inspect the logs. |
I couldn't either |
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.
Related to this issue and to #798, I just cloned the repo and tried to run pytest
and it wouldn't work, throwing this error
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --cov=qibo --cov-report=xml
The only way to make it work was to remove these two flags from addopts
.
Unfortunately, in master If you clone the repository, switch to this branch, and install with: pip install '.[tests]' (i.e. including the extra |
I'm still debugging/developing a new solution in #798. The solution proposed here (split |
Have you installed qibo with the command |
Yes, I did. Same error. EDIT: @Edoardo-Pedicillo helped me fix by installing |
I believe you did on a different branch, since Line 77 in e5fe94f
Please, try to create a fresh environment while on this branch, and repeat the installation. |
I was on |
The hypothesis of #798 (comment) is confirmed: the coverage was lowered by overwriting the It is fixed by adding the If this is the chosen solution (instead of 2. or 3. in #798 (comment)) this should be propagated to Qibolab and Qibocal, but we don't need any change to the workflows. |
for more information, see https://pre-commit.ci
Move tests top-level
I tested locally and this is working now @stavros11, allowing running |
Do we merge this? @alecandido |
For me, it is fine as it is, you can keep going. Just a final note: I added the dependency on |
Looks good to me too, thanks. I also like more having the tests outside the code, it also makes it slightly easier to execute single tests. I only have a small issue when I use this locally, I get a lot of warnings that look like
and the same for many other files. Are you also getting this? I have not explored it much, so it may be something with my installation.
In principle this is not strictly necessary yet, since we don't have coverage from different test runs in these repositories yet, but it won't hurt either.
I agree with this too. In fact you could also probably remove pytest from the dependencies and leave only pytest-cov as this will include pytest (now we have both). Maybe we could do the same with pylint if you think it simplifies the workflow. |
I'm investigating. I believe that might be related to the presence of an outdated
Agreed, but it would change the way it works locally in development. So, on Qibo you would append coverage by default, and Qibolab and Qibocal would overwrite coverage.
I see your point. However, I believe it is better to keep |
Merged with new |
for more information, see https://pre-commit.ci
This PR has been opened in order to fix #786.
Checklist: