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

PyPI sdist has lowercase DJANGO_SETTINGS_MODULE in setup.cfg #52

Open
carlwgeorge opened this issue Apr 6, 2019 · 0 comments
Open

PyPI sdist has lowercase DJANGO_SETTINGS_MODULE in setup.cfg #52

carlwgeorge opened this issue Apr 6, 2019 · 0 comments

Comments

@carlwgeorge
Copy link

  • PrettyPrinter version: 0.17.0
  • Python version: 3.7.3
  • Operating System: Fedora 30

Description

Using the PyPI sdist tarball, I tried to run the tests. It fails with an error about DJANGO_SETTINGS_MODULE. That is set in setup.cfg on GitHub, but in the sdist tarball that line is forced to lowercase.

--- github/setup.cfg	2019-04-05 22:27:13.874203225 -0500
+++ pypi/setup.cfg	2019-04-05 23:08:01.081890355 -0500
@@ -20,9 +20,13 @@ max-line-length = 99
 
 [tool:pytest]
 python_paths = tests/test_django
-DJANGO_SETTINGS_MODULE = prettyprinter_testproject.settings
+django_settings_module = prettyprinter_testproject.settings
 django_find_project = true
 
 [aliases]
 test = pytest
 
+[egg_info]
+tag_build = 
+tag_date = 0
+

Manually changing that back to upper case allows the tests to pass.

What I Did

$ pytest -v
output (click to expand)
========================================================= test session starts ==========================================================
platform linux -- Python 3.7.3, pytest-4.4.0, py-1.8.0, pluggy-0.9.0 -- /root/prettyprinter-0.17.0/.env/bin/python3
cachedir: .pytest_cache
rootdir: /root/prettyprinter-0.17.0, inifile: setup.cfg
plugins: pythonpath-0.7.3, django-3.4.8, hypothesis-3.33.0
collected 93 items / 1 errors / 92 selected                                                                                            

================================================================ ERRORS ================================================================
_____________________________ ERROR collecting tests/test_django/coreapp/test_prettyprinter_definitions.py _____________________________
tests/test_django/coreapp/test_prettyprinter_definitions.py:4: in <module>
    from coreapp.models import MyModel
tests/test_django/coreapp/models.py:4: in <module>
    class MyModel(models.Model):
tests/test_django/coreapp/models.py:5: in MyModel
    name = models.CharField(max_length=128, blank=True)
.env/lib64/python3.7/site-packages/django/db/models/fields/__init__.py:1043: in __init__
    super(CharField, self).__init__(*args, **kwargs)
.env/lib64/python3.7/site-packages/django/db/models/fields/__init__.py:166: in __init__
    self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACE
.env/lib64/python3.7/site-packages/django/conf/__init__.py:53: in __getattr__
    self._setup(name)
.env/lib64/python3.7/site-packages/django/conf/__init__.py:39: in _setup
    % (desc, ENVIRONMENT_VARIABLE))
E   django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
=========================================================== warnings summary ===========================================================
tests/test_prettyprinter.py:617
  /root/prettyprinter-0.17.0/tests/test_prettyprinter.py:617: PytestWarning: cannot collect test class 'TestDeferredType' because it has a __init__ constructor
    class TestDeferredType(dict):

.env/lib64/python3.7/site-packages/django/db/models/sql/query.py:11
.env/lib64/python3.7/site-packages/django/db/models/sql/query.py:11
  /root/prettyprinter-0.17.0/.env/lib64/python3.7/site-packages/django/db/models/sql/query.py:11: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
    from collections import Counter, Iterator, Mapping, OrderedDict

-- Docs: https://docs.pytest.org/en/latest/warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================= 3 warnings, 1 error in 1.72 seconds ==================================================
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