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

Pytest without cirq.google #3894

Merged
merged 45 commits into from
Mar 19, 2021

Conversation

balopat
Copy link
Contributor

@balopat balopat commented Mar 9, 2021

Enables testing without the existence of cirq.google.

Namely:

  • check/pytest gets a --cirq-only arg, that deletes the cirq/google directory and runs pytest - also adds a new CI job just for this reason
  • this forced the removal of some remaining cirq.google references from cirq core and some was made optional (see next point)
  • cirq.google references can still be made from tests but they will be skipped using @cirq.testing.skip_if_module_not_exists(module="cirq.google") - the examples folder, performance benchmarking are places where this is okay. In other places this is considered technical debt and we'll need to figure out how to remove those instances cleanly (probably by creating the test infra for those features that the modules can call into)

Note: this should be merged after #3888 (it is merged into this branch).

Closes #3737.

@balopat balopat requested review from cduck, vtomole and a team as code owners March 9, 2021 15:36
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@google-cla google-cla bot added the cla: yes Makes googlebot stop complaining. label Mar 9, 2021
@balopat balopat requested a review from mrwojtek as a code owner March 9, 2021 18:19
@balopat balopat requested a review from wcourtney as a code owner March 10, 2021 03:02
@mpharrigan
Copy link
Collaborator

did you consider pytest's importskip https://docs.pytest.org/en/latest/skipping.html#skipping-on-a-missing-import-dependency

instead of our own decorator?

@balopat
Copy link
Contributor Author

balopat commented Mar 11, 2021

did you consider pytest's importskip https://docs.pytest.org/en/latest/skipping.html#skipping-on-a-missing-import-dependency

instead of our own decorator?

That's a great pointer - thanks - I'll look into that.

Copy link
Collaborator

@95-martin-orion 95-martin-orion left a comment

Choose a reason for hiding this comment

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

One nit but otherwise this is looking pretty clean. I'll need one more pass to confirm that all of my major concerns are covered.

runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
python-version: '3.8'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this sufficient? I guess the assumption here is that a cirq-only python3.8 run + an all-cirq python3.(6|7) run is enough to verify that cirq-only python3.(6|7) should work?

Copy link
Contributor Author

@balopat balopat Mar 18, 2021

Choose a reason for hiding this comment

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

Yes, exactly! One more implicit assumption beyond that is that pytest.importorskip works similarly across all 3 versions and all three OSes.

@95-martin-orion
Copy link
Collaborator

Final(?) pass is complete - all my concerns have been addressed. After #3928 this will be ready to merge.

Copy link
Collaborator

@95-martin-orion 95-martin-orion left a comment

Choose a reason for hiding this comment

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

Approved following merge of #3928

@balopat balopat added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Mar 18, 2021
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Mar 18, 2021
@CirqBot CirqBot merged commit 06e0f1c into quantumlib:master Mar 19, 2021
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove references to cirq.google in cirq core / contrib
4 participants