GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Speed up umbrella tox -e cover by dhermes · Pull Request #2500 · googleapis/google-cloud-python

Conversation

@dhermes

@dhermes dhermes commented Oct 5, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This took a lot of wrangling, but eventually I found a solution: make unit_tests a namespace package and then collect from site-packages. This way we only run py.test once instead of 15 times, a huge speedup.

In order to do this I needed to do some renames to avoid collisions (e.g. unit_tests.test_client would have been installed for every sub-package).

The first 3 (of 4 of 5) commits are for the rename. The first two are automated (i.e. I didn't make changes to any files myself) and the third is just a tiny lint cleanup based on the automated changes.

Also relevant: https://testrun.org/tox/latest/example/pytest.html#known-issues-and-limitations

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

daspecster reacted with hooray emoji
All reactions
  • 🎉 1 reaction
dhermes added 4 commits October 4, 2016 23:27
@dhermes
Making unit test directories into namespace packages.
67dedb1
To avoid collision had to move most tests into a uniquely
named directory. For example the tests in bigquery/unit_tests needed
to move to bigquery/unit_tests/bigquery to avoid any name collision.

Done via: https://gist.github.com/dhermes/397c731966674da1b42612b723e64895
@dhermes
Renaming some test helper imports that moved.
b9c0c9c
Done via:

$ git grep -l 'from unit_tests._fixtures import' -- vision |
> xargs sed -i s/'from unit_tests._fixtures import'/'from unit_tests.vision._fixtures import'/g
$
$ git grep -l 'from unit_tests._fixtures import' -- speech |
> xargs sed -i s/'from unit_tests._fixtures import'/'from unit_tests.speech._fixtures import'/g
$
$ git grep -l 'from unit_tests._testing import ' -- bigtable |
> xargs sed -i s/'from unit_tests._testing import '/'from unit_tests.bigtable._testing import '/g
@dhermes
Fixing lint error caused by automated code changes.
eb54e75
@dhermes
Simplifying umbrella tox covercmd.
3c1c70f
This requires manually collecting from the installed
site-packages.

See: https://testrun.org/tox/latest/example/pytest.html
@dhermes dhermes added testing build labels Oct 5, 2016
@dhermes dhermes assigned daspecster and tseaver Oct 5, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 5, 2016
@dhermes

dhermes commented Oct 5, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@tseaver The Travis failure is due to #2486. The change needed to filter for files that exist.

candidates, _ = get_affected_files()
python_files = [
    candidate for candidate in candidates 
    if candidate.endswith('.py') and os.path.exists(candidate)]
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes
Only running pycodestyle on existing files.
a582ef2
Issue introduced in googleapis#2486.
@daspecster

daspecster commented Oct 5, 2016

Copy link
Copy Markdown
Contributor

unit_tests/handlers/transports/__init__.py → bigquery/unit_tests/bigquery/__init__.py, that doesn't seem right does it?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

daspecster
daspecster reviewed Oct 5, 2016
View reviewed changes
Comment thread scripts/pycodestyle_on_repo.py
python_files = [
candidate for candidate in candidates if candidate.endswith('.py')]
candidate for candidate in candidates
if candidate.endswith('.py') and os.path.exists(candidate)]

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daspecster daspecster mentioned this pull request Oct 5, 2016
Updates from #2344 for speech API. #2495
Merged
@tseaver

tseaver commented Oct 5, 2016

Copy link
Copy Markdown
Contributor

I'm grinding my teeth about the issues caused from moving the unit tests out-of-tree: I still think they belong there, which would remove the need to mess with the unittests/ pseudo-package at all.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@daspecster

daspecster commented Oct 5, 2016

Copy link
Copy Markdown
Contributor

So from a selfish standpoint, I like having the unit_tests for a package in the package. It makes for less mental tracking while working on things. Might just be me though.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented Oct 6, 2016

Copy link
Copy Markdown
Contributor Author

@daspecster RE:

unit_tests/handlers/transports/__init__.py → bigquery/unit_tests/bigquery/__init__.py, that doesn't seem right does it?

That is just git not really caring where the file went. The __init__.py files are all identical

daspecster reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes

dhermes commented Oct 6, 2016

Copy link
Copy Markdown
Contributor Author

Chatted with @tseaver and @jonparrott about this and will be putting the unit tests back.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dhermes dhermes closed this Oct 6, 2016
@dhermes
dhermes deleted the move-tests-side-by-side branch October 6, 2016 16:00
@dhermes
dhermes restored the move-tests-side-by-side branch October 6, 2016 20:50
@dhermes dhermes reopened this Oct 6, 2016
@dhermes dhermes closed this Oct 6, 2016
@theacodes theacodes unassigned daspecster Sep 28, 2018
chalmerlowe pushed a commit that referenced this pull request Mar 31, 2026
@chelsea-lin
refactor: use sqlglot to build literal (#2500)
a39313f
Fixes internal issue 418025765 🦕
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@daspecster daspecster daspecster left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@tseaver tseaver

Labels

cla: yes This human has signed the Contributor License Agreement. testing

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@dhermes @daspecster @tseaver @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.