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

[BEAM-3713] Add pytest testing infrastructure #7949

Closed
wants to merge 3 commits into from

Conversation

udim
Copy link
Member

@udim udim commented Feb 26, 2019

Initial step towards migrating off of nosetests.

  • Runs integration tests via tox: tox -e py27-gcp-pytest,py36-pytest,etc.
  • @pytest.mark.{pre,post}commit replaces @attr('IT')
    • Also can mark tests as: no_dataflow, no_direct, etc. to exclude
      tests that don't pass on certain runners.
  • conftest.py replaces BeamTestPlugin
  • Jenkins reports for all tests run (not just the last nosetests
    invocation), using multiple XML outputs.
  • Allows specifying test module in tox cmd line. Example:
tox -e py27-pytest apache_beam.transforms.window_test

Still needs:

  • Verification that all the tests that run on nose also run
    on pytest.

Nice to have:

  • Parallelization, but this requires fixing pickling issues with the
    pytest plugins used for this.

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- --- --- --- ---
Java Build Status Build Status Build Status Build Status
Build Status
Build Status
Build Status Build Status Build Status
Python Build Status
Build Status
--- Build Status
Build Status
Build Status --- --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

@udim
Copy link
Member Author

udim commented Feb 26, 2019

run seed job

@udim
Copy link
Member Author

udim commented Feb 26, 2019

run python precommit_pytest

@udim
Copy link
Member Author

udim commented Feb 27, 2019

run seed job

@udim
Copy link
Member Author

udim commented Feb 27, 2019

run seed job

@udim
Copy link
Member Author

udim commented Feb 27, 2019

run seed job

@udim
Copy link
Member Author

udim commented Feb 27, 2019

run seed job

@udim
Copy link
Member Author

udim commented Feb 27, 2019

run python precommit_pytest

1 similar comment
@udim
Copy link
Member Author

udim commented Feb 27, 2019

run python precommit_pytest

@udim
Copy link
Member Author

udim commented Feb 27, 2019

run python_pytest precommit

@udim
Copy link
Member Author

udim commented Feb 28, 2019

run seed job

@udim
Copy link
Member Author

udim commented Feb 28, 2019

run python_pytest precommit

@@ -201,6 +202,7 @@ def run(self):
install_requires=REQUIRED_PACKAGES,
python_requires=python_requires,
test_suite='nose.collector',
Copy link
Contributor

Choose a reason for hiding this comment

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

we probably can also use pytest here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know what to put here for pytest. The instructions said to add the setup_requires line below.

@markflyhigh
Copy link
Contributor

Thank you for initiating this work! I have this nose to pytest thought long time ago, but the main reason to push my back is that python framework deeply integrated with nose. Except BeamTestPlugin and @attr you mentioned in top description, I think we should also take care of:

  1. integration test execution command
  2. proper logging in unit/integration test
  3. parallelization

@udim
Copy link
Member Author

udim commented Apr 13, 2019

run seed job

1 similar comment
@udim
Copy link
Member Author

udim commented Apr 15, 2019

run seed job

@udim
Copy link
Member Author

udim commented Apr 15, 2019

run python precommit

@udim
Copy link
Member Author

udim commented Apr 15, 2019

run python_pytest precommit

@udim
Copy link
Member Author

udim commented Apr 15, 2019

run python_pytest precommit

@stale
Copy link

stale bot commented Jun 14, 2019

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.

@stale stale bot added the stale label Jun 14, 2019
@udim
Copy link
Member Author

udim commented Jun 14, 2019

still working on this

@stale stale bot removed the stale label Jun 14, 2019
[testenv:py36]
setenv =
RUN_SKIPPED_PY3_TESTS=0
commands =
python apache_beam/examples/complete/autocomplete_test.py
python setup.py nosetests

[testenv:py36-pytest]
setenv =
Copy link
Member

Choose a reason for hiding this comment

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

From @robertwb on #9592:
We should probably be using https://tox.readthedocs.io/en/latest/example/basic.html#compressing-dependency-matrix to avoid these kinds of omissions.

soyrice pushed a commit to soyrice/beam that referenced this pull request Sep 19, 2019
This is a temporary solution while waiting for full solution in apache#7949
udim added a commit to udim/beam that referenced this pull request Oct 9, 2019
This is apache#7949 without IT support.

- Runs unit tests using pytest
  - tox: `tox -e py27-gcp-pytest,py36-pytest,etc.`
  - gradle: `../../gradlew pythonPreCommitPytest`
  - github PR phrase: `run python_pytest precommit`
- Tests run in parallel (still single-threaded but on multiple worker
processes).
  - no_xdist marker used for tests that don't work the xdist plugin.
- Allows specifying test module in tox cmd line. Example:
```sh
tox -e py27-pytest apache_beam.transforms.window_test
```
@udim udim mentioned this pull request Oct 9, 2019
3 tasks
udim added a commit to udim/beam that referenced this pull request Oct 21, 2019
This is apache#7949 without IT support.

- Runs unit tests using pytest
  - tox: `tox -e py27-gcp-pytest,py36-pytest,etc.`
  - gradle: `../../gradlew pythonPreCommitPytest`
  - github PR phrase: `run python_pytest precommit`
- Tests run in parallel (still single-threaded but on multiple worker
processes).
  - no_xdist marker used for tests that don't work the xdist plugin.
- Allows specifying test module in tox cmd line. Example:
```sh
tox -e py27-pytest apache_beam.transforms.window_test
```
udim added a commit that referenced this pull request Nov 4, 2019
This is #7949 without IT support.

- Runs unit tests using pytest
  - tox: `tox -e py27-gcp-pytest,py36-pytest,etc.`
  - gradle: `../../gradlew pythonPreCommitPytest`
  - github PR phrase: `run python_pytest precommit`
- Tests run in parallel (still single-threaded but on multiple worker
processes).
  - no_xdist marker used for tests that don't work the xdist plugin.
- Allows specifying test module in tox cmd line. Example:
```sh
tox -e py27-pytest apache_beam.transforms.window_test
```
11moon11 pushed a commit to 11moon11/beam that referenced this pull request Nov 4, 2019
This is apache#7949 without IT support.

- Runs unit tests using pytest
  - tox: `tox -e py27-gcp-pytest,py36-pytest,etc.`
  - gradle: `../../gradlew pythonPreCommitPytest`
  - github PR phrase: `run python_pytest precommit`
- Tests run in parallel (still single-threaded but on multiple worker
processes).
  - no_xdist marker used for tests that don't work the xdist plugin.
- Allows specifying test module in tox cmd line. Example:
```sh
tox -e py27-pytest apache_beam.transforms.window_test
```
@stale
Copy link

stale bot commented Nov 16, 2019

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.

@stale stale bot added the stale label Nov 16, 2019
@udim
Copy link
Member Author

udim commented Nov 20, 2019

still working on this

@stale stale bot removed the stale label Nov 20, 2019
@robertwb
Copy link
Contributor

Is this still being worked on?

@udim
Copy link
Member Author

udim commented Mar 4, 2020

Picking this up again

@stale
Copy link

stale bot commented May 3, 2020

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.

@stale stale bot added the stale label May 3, 2020
@udim
Copy link
Member Author

udim commented May 8, 2020

I haven't had time to work on this, but it's still relevant.

@stale stale bot removed the stale label May 8, 2020
@stale
Copy link

stale bot commented Jul 11, 2020

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.

@stale stale bot added the stale label Jul 11, 2020
@udim
Copy link
Member Author

udim commented Jul 11, 2020

bump

@stale stale bot removed the stale label Jul 11, 2020
@stale
Copy link

stale bot commented Sep 11, 2020

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.

@stale stale bot added the stale label Sep 11, 2020
@stale
Copy link

stale bot commented Sep 19, 2020

This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@stale stale bot closed this Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants