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

dev: improve python-run-tests execution #756

Merged

Conversation

tiborsimko
Copy link
Member

@tiborsimko tiborsimko commented Nov 3, 2023

Improves the python-run-tests command to create Python-3.8 based virtual environments to use the same version as container images.

Updates pip before installing each component in order to speed up the dependency resolution for certain cluster components.

Allows execution of selected pytests only by passing over PYTEST_ADDOPTS environment variable.

Switches to using run-tests.sh to execute pytests in individual components which takes care of the DB setup at the source.

Allows excluding certain Python components such as -c CLUSTER --exclude-components r-j-controller on macOS.

Example:

$ PYTEST_ADDOPTS=tests/test_version.py reana-dev python-unit-tests -c ALL -k

Closes #755.

Copy link

codecov bot commented Nov 3, 2023

Codecov Report

Merging #756 (5a06eef) into master (ebf1ac0) will increase coverage by 0.04%.
The diff coverage is 45.45%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #756      +/-   ##
==========================================
+ Coverage   18.94%   18.99%   +0.04%     
==========================================
  Files          26       26              
  Lines        2285     2290       +5     
==========================================
+ Hits          433      435       +2     
- Misses       1852     1855       +3     
Files Coverage Δ
reana/config.py 100.00% <100.00%> (ø)
reana/reana_dev/python.py 45.65% <33.33%> (-1.97%) ⬇️

@tiborsimko tiborsimko force-pushed the reana-dev-run-python-tests-fixes branch 5 times, most recently from 184b552 to 5ff9253 Compare November 5, 2023 14:23
@tiborsimko
Copy link
Member Author

tiborsimko commented Nov 5, 2023

How to test:

$ cd ~/src/reana
$ workon reana
$ reana-dev git-checkout-pr --fetch \
    -b reana 756 \
    -b reana-db 208  \
    -b reana-demo-cms-reco 30 \
    -b reana-job-controller 411 \
    -b reana-server 639 \
    -b reana-workflow-controller 537 \
    -b reana-workflow-engine-serial 188
$ pip install . --upgrade
$ PYTEST_ADDOPTS=tests/test_version.py reana-dev python-unit-tests -c ALL -k

@tiborsimko tiborsimko force-pushed the reana-dev-run-python-tests-fixes branch 2 times, most recently from 28b4870 to 6ff27f4 Compare November 10, 2023 11:31
run-tests.sh Outdated
Comment on lines 40 to 44
if [ -n "${PYTESTARG-}" ]; then
pytest "$PYTESTARG"
else
python setup.py test
fi
Copy link
Member

Choose a reason for hiding this comment

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

I think that the changes to this file should not be needed

CHANGES.rst Outdated
--------------------------

- Developers:
- Changes `python-run-tests` command to allow execution of selected pytests only by passing over `PYTESTARG` environment variable.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Changes `python-run-tests` command to allow execution of selected pytests only by passing over `PYTESTARG` environment variable.
- Changes `python-run-tests` command to allow execution of selected pytests only by passing over `PYTEST_ADDOPTS` environment variable.

@tiborsimko tiborsimko force-pushed the reana-dev-run-python-tests-fixes branch from 6ff27f4 to a64bbea Compare November 10, 2023 13:08
Improves the `python-run-tests` command to create Python-3.8 based
virtual environments to use the same version as container images.

Updates `pip` before installing each component in order to speed up the
dependency resolution for certain cluster components.

Allows execution of selected pytests only by passing over
`PYTEST_ADDOPTS` environment variable.

Switches to using `run-tests.sh` to execute pytests in individual
components which takes care of the DB setup at the source.

Allows excluding certain Python components such as `-c CLUSTER
--exclude-components r-j-controller` on macOS.

Example:

```
$ PYTEST_ADDOPTS=tests/test_version.py reana-dev python-unit-tests -c ALL -k
```

Closes reanahub#755.
@tiborsimko tiborsimko force-pushed the reana-dev-run-python-tests-fixes branch from a64bbea to 5a06eef Compare November 10, 2023 13:11
@tiborsimko tiborsimko merged commit 5a06eef into reanahub:master Nov 10, 2023
@tiborsimko tiborsimko deleted the reana-dev-run-python-tests-fixes branch November 10, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reana-dev python-unit-tests: allow running selected tests only
2 participants