Skip to content

Conversation

twm
Copy link
Contributor

@twm twm commented Aug 20, 2024

This is a commonly-hit SQLAlchemy footgun, but one easily remedied
by treating the warning SQLALchemy raises as an error under pytest.

I verified this by running against commit 8a5ad08, which produced
these failures:

FAILED tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_release_url_verified[https://github.com/foo/bar/readme.md-True] - sqlalchemy.exc.SAWarning: SELECT statement has a cartesian product between FROM element(s) "release_urls" and FROM element "releases".  A...
FAILED tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_release_url_verified[https://google.com-False] - sqlalchemy.exc.SAWarning: SELECT statement has a cartesian product between FROM element(s) "releases" and FROM element "release_urls".  A...
FAILED tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_release_url_verified[https://github.com/foo/bar-True] - sqlalchemy.exc.SAWarning: SELECT statement has a cartesian product between FROM element(s) "release_urls" and FROM element "releases".  A...
FAILED tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_release_url_verified[https://github.com/foo-False] - sqlalchemy.exc.SAWarning: SELECT statement has a cartesian product between FROM element(s) "releases" and FROM element "release_urls".  A...
FAILED tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_publisher_verifies_existing_release_url - sqlalchemy.exc.SAWarning: SELECT statement has a cartesian product between FROM element(s) "releases" and FROM element "release_urls".  A...
FAILED tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_release_url_verified[https://github.com/foo/bar/-True] - sqlalchemy.exc.SAWarning: SELECT statement has a cartesian product between FROM element(s) "releases" and FROM element "release_urls".  A...

Results (84.29s (0:01:24)):
    4209 passed
       6 failed
         - tests/unit/forklift/test_legacy.py:3842 TestFileUpload.test_new_release_url_verified[https://github.com/foo/bar/readme.md-True]
         - tests/unit/forklift/test_legacy.py:3842 TestFileUpload.test_new_release_url_verified[https://google.com-False]
         - tests/unit/forklift/test_legacy.py:3842 TestFileUpload.test_new_release_url_verified[https://github.com/foo/bar-True]
         - tests/unit/forklift/test_legacy.py:3842 TestFileUpload.test_new_release_url_verified[https://github.com/foo-False]
         - tests/unit/forklift/test_legacy.py:3911 TestFileUpload.test_new_publisher_verifies_existing_release_url
         - tests/unit/forklift/test_legacy.py:3842 TestFileUpload.test_new_release_url_verified[https://github.com/foo/bar/-True]

On 9de75b8 the build is clean.

This is a commonly-hit SQLAlchemy footgun, but one easily remedied
by treating the warning SQLALchemy raises as an error under pytest.

I verified this by running against commit 8a5ad08, which produced
these failures:

  FAILED tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_release_url_verified[https://github.com/foo/bar/readme.md-True] - sqlalchemy.exc.SAWarning: SELECT statement has a cartesian product between FROM element(s) "release_urls" and FROM element "releases".  A...
  FAILED tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_release_url_verified[https://google.com-False] - sqlalchemy.exc.SAWarning: SELECT statement has a cartesian product between FROM element(s) "releases" and FROM element "release_urls".  A...
  FAILED tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_release_url_verified[https://github.com/foo/bar-True] - sqlalchemy.exc.SAWarning: SELECT statement has a cartesian product between FROM element(s) "release_urls" and FROM element "releases".  A...
  FAILED tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_release_url_verified[https://github.com/foo-False] - sqlalchemy.exc.SAWarning: SELECT statement has a cartesian product between FROM element(s) "releases" and FROM element "release_urls".  A...
  FAILED tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_publisher_verifies_existing_release_url - sqlalchemy.exc.SAWarning: SELECT statement has a cartesian product between FROM element(s) "releases" and FROM element "release_urls".  A...
  FAILED tests/unit/forklift/test_legacy.py::TestFileUpload::test_new_release_url_verified[https://github.com/foo/bar/-True] - sqlalchemy.exc.SAWarning: SELECT statement has a cartesian product between FROM element(s) "releases" and FROM element "release_urls".  A...

  Results (84.29s (0:01:24)):
      4209 passed
         6 failed
           - tests/unit/forklift/test_legacy.py:3842 TestFileUpload.test_new_release_url_verified[https://github.com/foo/bar/readme.md-True]
           - tests/unit/forklift/test_legacy.py:3842 TestFileUpload.test_new_release_url_verified[https://google.com-False]
           - tests/unit/forklift/test_legacy.py:3842 TestFileUpload.test_new_release_url_verified[https://github.com/foo/bar-True]
           - tests/unit/forklift/test_legacy.py:3842 TestFileUpload.test_new_release_url_verified[https://github.com/foo-False]
           - tests/unit/forklift/test_legacy.py:3911 TestFileUpload.test_new_publisher_verifies_existing_release_url
           - tests/unit/forklift/test_legacy.py:3842 TestFileUpload.test_new_release_url_verified[https://github.com/foo/bar/-True]

On 9de75b8 the build is clean.
@twm twm requested a review from a team as a code owner August 20, 2024 18:32
@miketheman miketheman added the testing Test infrastructure and individual tests label Aug 20, 2024
Copy link
Member

@miketheman miketheman left a comment

Choose a reason for hiding this comment

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

Yay, nice work

@di di enabled auto-merge (squash) August 20, 2024 18:36
@di di merged commit aa13cca into pypi:main Aug 20, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Test infrastructure and individual tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants