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

[1] Add tox generation script, but don't use it yet #3971

Merged
merged 24 commits into from
Feb 11, 2025

Conversation

sentrivana
Copy link
Contributor

@sentrivana sentrivana commented Jan 20, 2025

Add:

  • tox generation script
  • tox template
  • script for generating tox and CI yamls in one go
  • readme for the script

In this PR, the script is set to ignore all integrations, so no tox configuration is actually added. However, it's still the script actually generating the real tox.ini from the tox.jinja template.

See follow-up PRs for more.

Supersedes #3920

@sentrivana sentrivana marked this pull request as ready for review January 20, 2025 14:57
Copy link

codecov bot commented Jan 20, 2025

❌ 52 Tests Failed:

Tests completed Failed Passed Skipped
22434 52 22382 5770
View the top 3 failed test(s) by shortest run time
tests.integrations.strawberry.test_strawberry test_infer_execution_type_from_installed_packages_sync
Stack Traces | 0.064s run time
.../integrations/strawberry/test_strawberry.py:141: in test_infer_execution_type_from_installed_packages_sync
    sentry_init(integrations=[StrawberryIntegration()])
tests/conftest.py:203: in inner
    client = sentry_sdk.Client(*a, **kw)
sentry_sdk/client.py:269: in __init__
    self._init_impl()
sentry_sdk/client.py:392: in _init_impl
    self.integrations = setup_integrations(
sentry_sdk/integrations/__init__.py:196: in setup_integrations
    type(integration).setup_once()
sentry_sdk/integrations/strawberry.py:81: in setup_once
    _patch_execute()
sentry_sdk/integrations/strawberry.py:293: in _patch_execute
    old_execute_sync = strawberry_schema.execute_sync
E   AttributeError: module 'strawberry.schema.schema' has no attribute 'execute_sync'
tests.integrations.strawberry.test_strawberry test_transaction_mutation[sync_app_client_factory-False-framework_integrations1]
Stack Traces | 0.065s run time
.../integrations/strawberry/test_strawberry.py:554: in test_transaction_mutation
    sentry_init(
tests/conftest.py:203: in inner
    client = sentry_sdk.Client(*a, **kw)
sentry_sdk/client.py:269: in __init__
    self._init_impl()
sentry_sdk/client.py:392: in _init_impl
    self.integrations = setup_integrations(
sentry_sdk/integrations/__init__.py:196: in setup_integrations
    type(integration).setup_once()
sentry_sdk/integrations/strawberry.py:81: in setup_once
    _patch_execute()
sentry_sdk/integrations/strawberry.py:293: in _patch_execute
    old_execute_sync = strawberry_schema.execute_sync
E   AttributeError: module 'strawberry.schema.schema' has no attribute 'execute_sync'
tests.integrations.strawberry.test_strawberry test_transaction_no_operation_name[async_app_client_factory-True-framework_integrations0]
Stack Traces | 0.065s run time
.../integrations/strawberry/test_strawberry.py:474: in test_transaction_no_operation_name
    sentry_init(
tests/conftest.py:203: in inner
    client = sentry_sdk.Client(*a, **kw)
sentry_sdk/client.py:269: in __init__
    self._init_impl()
sentry_sdk/client.py:392: in _init_impl
    self.integrations = setup_integrations(
sentry_sdk/integrations/__init__.py:196: in setup_integrations
    type(integration).setup_once()
sentry_sdk/integrations/strawberry.py:81: in setup_once
    _patch_execute()
sentry_sdk/integrations/strawberry.py:293: in _patch_execute
    old_execute_sync = strawberry_schema.execute_sync
E   AttributeError: module 'strawberry.schema.schema' has no attribute 'execute_sync'

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

Thanks for splitting up the PR, I think it is much easier to review now!

I added some questions and suggestions

scripts/populate_tox/README.md Show resolved Hide resolved
scripts/populate_tox/README.md Outdated Show resolved Hide resolved
scripts/populate_tox/README.md Outdated Show resolved Hide resolved
scripts/populate_tox/README.md Outdated Show resolved Hide resolved
scripts/populate_tox/README.md Outdated Show resolved Hide resolved
scripts/populate_tox/config.py Show resolved Hide resolved
scripts/populate_tox/populate_tox.py Show resolved Hide resolved
return hasher.hexdigest()


def main(fail_on_changes: bool = False) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

This function seems a bit long – I think we should try to break it up into smaller functions. At a minimum, probably the code in the loop could be its own function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Broken up in c96bf0c

scripts/populate_tox/populate_tox.py Outdated Show resolved Hide resolved

if __name__ == "__main__":
fail_on_changes = len(sys.argv) == 2 and sys.argv[1] == "--fail-on-changes"
main(fail_on_changes)
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 it might be a good idea to add some tests for this script. What do you think?

Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

Looks better, but I am still struggling to understand some parts of the code. I think more comments and some small refactors would help.

Please see the individual comments; we could also discuss offline if you think that would help

scripts/populate_tox/README.md Show resolved Hide resolved
scripts/populate_tox/README.md Outdated Show resolved Hide resolved
scripts/populate_tox/README.md Outdated Show resolved Hide resolved
scripts/populate_tox/populate_tox.py Show resolved Hide resolved
scripts/populate_tox/populate_tox.py Show resolved Hide resolved
scripts/populate_tox/populate_tox.py Show resolved Hide resolved
scripts/populate_tox/populate_tox.py Show resolved Hide resolved
scripts/populate_tox/populate_tox.py Show resolved Hide resolved
scripts/populate_tox/populate_tox.py Show resolved Hide resolved
scripts/populate_tox/populate_tox.py Outdated Show resolved Hide resolved
scripts/populate_tox/README.md Outdated Show resolved Hide resolved
scripts/populate_tox/populate_tox.py Outdated Show resolved Hide resolved
scripts/populate_tox/populate_tox.py Show resolved Hide resolved
@sentrivana sentrivana enabled auto-merge (squash) February 11, 2025 10:05
@sentrivana sentrivana merged commit f995d8c into master Feb 11, 2025
147 of 149 checks passed
@sentrivana sentrivana deleted the ivana/tox-script-1 branch February 11, 2025 10:13
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.

2 participants