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

Fix issues in tox run #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

chandurup
Copy link

  • Issue 1 - Tox takes latest version for ‘[pytest-django](https://pytest-django.readthedocs.io/en/latest/changelog.html#v4-5-2-2021-12-07)’. Not compatible with earlier django versions

    ======================================================================================== test session starts =========================================================================================
    platform darwin -- Python 3.5.10, pytest-6.1.2, py-1.11.0, pluggy-0.13.1
    cachedir: .tox/python2.7-django18/.pytest_cache
    django: settings: settings (from env)
    rootdir: /Users/xxx/workspace/django-performance-testing
    plugins: django-4.5.2
    collected 263 items
    
    tests/testapp/tests/test_integrates_with_django_test_client.py EEEE                                                                                                                            [  1%]
    tests/testapp/tests/test_integrates_with_django_testrunner.py EEEEEEEEEE                                                                                                                       [  5%]
    tests/testapp/tests/test_integrates_with_template_rendering.py E                                                                                                                               [  5%]
    tests/testapp/tests/test_query_collector.py EEEEEEEEE                                                                                                                                          [  9%]
    tests/testapp/tests/test_querycount_limits.py EE                                                                                                                                               [  9%]
    tests/testapp/tests/test_worst_report_integrates_with_django_testrunner.py EEEE                                                                                                                [ 11%]
    tests/testapp/tests/test_can_classify_queries_into_read_and_write_other.py EEEEEEEEEEE                                                                                                         [ 15%]
    tests/testapp/tests/test_core_constructing_a_registry.py EEEEEE                                                                                                                                [ 17%]
    tests/testapp/tests/test_core_context.py EEEEEE                                                                                                                                                [ 20%]
    tests/testapp/tests/test_core_infrastructure.py EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                                                           [ 52%]
    tests/testapp/tests/test_core_settings_based_registry.py EEEEEEE                                     
    
    =============================================================================================== ERRORS ===============================================================================================
    ______________________________________ ERROR at setup of test_can_specify_limits_through_settings_for_django_test_client[GET-4-5-queries-queries-DbQueriesView] ______________________________________
    
    request = <SubRequest 'django_test_environment' for <Function test_can_specify_limits_through_settings_for_django_test_client[GET-4-5-queries-queries-DbQueriesView]>>
    
        @pytest.fixture(autouse=True, scope="session")
        def django_test_environment(request) -> None:
    >           setup_test_environment(debug=debug)
    E           TypeError: setup_test_environment() got an unexpected keyword argument 'debug'
  • Issue 2 - Py27 like short names unable to span environments

    ERROR:  py27-django18-pytest3: InterpreterNotFound: python2.7
    ERROR:  py34-django18-pytest3: InterpreterNotFound: python3.4
      py35-django18-pytest3: commands succeeded
    ERROR:  py27-django19-pytest3: InterpreterNotFound: python2.7
    ERROR:  py34-django19-pytest3: InterpreterNotFound: python3.4
      py35-django19-pytest3: commands succeeded
    ERROR:  py27-django110-pytest3: InterpreterNotFound: python2.7
    ERROR:  py34-django110-pytest3: InterpreterNotFound: python3.4

    Cause:

    1. Tox unable to link shorter names to specific python version. Problem could be with underlying virtual-environment (i use pyenv) & how tox maps the shorter environment. Have to explore more on Tox [wip].
    2. Similar issue tox is not creating environment py34 "InterpreterNotFound" tox-dev/tox#378 - but circumvented with longer names like python2.7 for py27.
  • Issue 3 - Ambiguous naming - Usage of ‘l’. Flake’s error

    flake8 django_performance_testing tests proof-of-concepts
    tests/testapp/tests/test_core_infrastructure.py:79:13: E741 ambiguous variable name 'l'
    tests/testapp/tests/test_core_infrastructure.py:91:17: E741 ambiguous variable name 'l'
    make: *** [lint] Error 1
    ERROR: InvocationError for command /usr/bin/make test lint docs (exited with code 2)

    Cause:

    • https://www.flake8rules.com/rules/E741.html

      Variables named `I`, `O`, and `l` can be very hard to read. This is because the letter `I` and the letter `l` are easily confused, and the letter `O` and the number `0` can be easily confused.

@zsoldosp
Copy link
Owner

zsoldosp commented Jul 3, 2023

Thanks for the PR @chandurup ! Looks good, but let me verify this locally - I'm a bit busy at work, but should be able to do so in the next few days.

@zsoldosp
Copy link
Owner

zsoldosp commented Jul 7, 2023

just an update: I couldn't yet setup my dev env (1) - virtualenv/python has aged too much since the last time this repo was upgraded (2) so I wasn't able to run the tests with your changes

Since the repo needs upgrading anyways, my plan is to find the earliest django / python version where I can get tox to create the envs & run, and then start fixing the code then


(1) https://github.com/zsoldosp/django-devmachine
(2) tox -e py3.6-django18 -vv gives

...
py3.6-django18: 208 D get interpreter info via cmd: /bin/python3.6 /home/vagrant/.local/lib/python3.8/site-packages/virtualenv/discovery/py_info.py xrEk7RYqAt54YEHDQg5QTCrpbbIB3i9L 6lZQBRxCHP7NlCxTyjvk6yZkaKkLbS3Q [virtualenv/discovery/cached_py_info.py:111]
py3.6-django18: 232 I failed to query /bin/python3.6 with code 1 err: '  File "/home/vagrant/.local/lib/python3.8/site-packages/virtualenv/discovery/py_info.py", line 7\n    from __future__ import annotations\n    ^\nSyntaxError: future feature annotations is not defined\n' [virtualenv/discovery/cached_py_info.py:34]
...

and I won't even mention the legacy py27 :)

@zsoldosp zsoldosp self-requested a review July 7, 2023 16:08
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