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

Test failure on the master branch #484

Open
akheron opened this issue Apr 7, 2022 · 0 comments
Open

Test failure on the master branch #484

akheron opened this issue Apr 7, 2022 · 0 comments

Comments

@akheron
Copy link

akheron commented Apr 7, 2022

The test_get_event_list_verify_bbox_filter fails on current master.

$ pytest -x events
...
api_client = <rest_framework.test.APIClient object at 0x401cd4b4a8>, event = <Event: tapahtuma (system:test_event) 2022-04-07 11:39:29.592576+00:00>
event2 = <Event: event (testotherdatasourceid:test_event_2) 2022-04-07 11:39:29.780281+00:00>

    @pytest.mark.django_db
    def test_get_event_list_verify_bbox_filter(api_client, event, event2):
        # API parameters must be provided in EPSG:4326 instead of the database SRS
        left_bottom = Point(25, 25)
        right_top = Point(75, 75)
        ct = CoordTransform(SpatialReference(settings.PROJECTION_SRID), SpatialReference(4326))
        left_bottom.transform(ct)
        right_top.transform(ct)
        bbox_string = f"{left_bottom.x},{left_bottom.y},{right_top.x},{right_top.y}"
        response = get_list(api_client, data={'bbox': bbox_string})
        # this way we will catch any errors if the default SRS changes, breaking the API
>       assert event.id in [entry['id'] for entry in response.data['data']]
E       AssertionError: assert 'system:test_event' in []
E        +  where 'system:test_event' = <Event: tapahtuma (system:test_event) 2022-04-07 11:39:29.592576+00:00>.id

events/tests/test_event_get.py:171: AssertionError

According to the comment, the idea of this test is to guard against "default SRS changes", whatever that means 🤷

Full `pytest` output
$ pytest -x events
============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.6.15, pytest-5.4.3, py-1.10.0, pluggy-0.13.1
django: settings: linkedevents.test_settings (from ini)
rootdir: /app, inifile: pytest.ini
plugins: django-3.9.0
collected 374 items                                                                                                                                                                                              

events/tests/test_api.py ........                                                                                                                                                                          [  2%]
events/tests/test_auth.py ..                                                                                                                                                                               [  2%]
events/tests/test_docx.py .                                                                                                                                                                                [  2%]
events/tests/test_event.py ....                                                                                                                                                                            [  4%]
events/tests/test_event_auth_api.py .............................................................                                                                                                          [ 20%]
events/tests/test_event_get.py ........F

==================================================================================================== FAILURES ====================================================================================================
_____________________________________________________________________________________ test_get_event_list_verify_bbox_filter _____________________________________________________________________________________

api_client = <rest_framework.test.APIClient object at 0x401cd4b4a8>, event = <Event: tapahtuma (system:test_event) 2022-04-07 11:39:29.592576+00:00>
event2 = <Event: event (testotherdatasourceid:test_event_2) 2022-04-07 11:39:29.780281+00:00>

    @pytest.mark.django_db
    def test_get_event_list_verify_bbox_filter(api_client, event, event2):
        # API parameters must be provided in EPSG:4326 instead of the database SRS
        left_bottom = Point(25, 25)
        right_top = Point(75, 75)
        ct = CoordTransform(SpatialReference(settings.PROJECTION_SRID), SpatialReference(4326))
        left_bottom.transform(ct)
        right_top.transform(ct)
        bbox_string = f"{left_bottom.x},{left_bottom.y},{right_top.x},{right_top.y}"
        response = get_list(api_client, data={'bbox': bbox_string})
        # this way we will catch any errors if the default SRS changes, breaking the API
>       assert event.id in [entry['id'] for entry in response.data['data']]
E       AssertionError: assert 'system:test_event' in []
E        +  where 'system:test_event' = <Event: tapahtuma (system:test_event) 2022-04-07 11:39:29.592576+00:00>.id

events/tests/test_event_get.py:171: AssertionError
--------------------------------------------------------------------------------------------- Captured stderr setup ----------------------------------------------------------------------------------------------
2022-04-07 14:09:29,496 events.signals WARNING: No recipients for notification type 'user_created'
2022-04-07 14:09:29,644 events.signals WARNING: No recipients for notification type 'user_created'
----------------------------------------------------------------------------------------------- Captured log setup -----------------------------------------------------------------------------------------------
WARNING  events.signals:signals.py:31 No recipients for notification type 'user_created'
WARNING  events.signals:signals.py:31 No recipients for notification type 'user_created'
================================================================================================ warnings summary ================================================================================================
events/tests/test_api.py: 4 tests with warnings
events/tests/test_docx.py: 1 test with warning
events/tests/test_event_auth_api.py: 61 tests with warnings
events/tests/test_event_get.py: 9 tests with warnings
  /usr/local/lib/python3.6/site-packages/whitenoise/base.py:115: UserWarning: No directory at: /app/static/
    warnings.warn(u"No directory at: {}".format(root))

-- Docs: https://docs.pytest.org/en/latest/warnings.html
============================================================================================ short test summary info =============================================================================================
FAILED events/tests/test_event_get.py::test_get_event_list_verify_bbox_filter - AssertionError: assert 'system:test_event' in []
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================= 1 failed, 84 passed, 75 warnings in 181.31s (0:03:01) ==============================================================================
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

No branches or pull requests

1 participant