Hello community,
here is the log from the commit of package python-pytest-django for
openSUSE:Factory checked in at 2020-01-27 00:20:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-django (Old)
and /work/SRC/openSUSE:Factory/.python-pytest-django.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-django"
Mon Jan 27 00:20:23 2020 rev:10 rq:766504 version:3.8.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-pytest-django/python-pytest-django.changes
2019-11-25 11:23:46.858111345 +0100
+++
/work/SRC/openSUSE:Factory/.python-pytest-django.new.26092/python-pytest-django.changes
2020-01-27 00:20:29.145406282 +0100
@@ -1,0 +2,7 @@
+Thu Jan 23 08:49:57 UTC 2020 - Tomáš Chvátal <[email protected]>
+
+- Update 3.8.0:
+ * Make Django's assertion helpers available in pytest_django.asserts (#709).
+ * Report django-configurations setting (#791)
+
+-------------------------------------------------------------------
Old:
----
pytest-django-3.7.0.tar.gz
New:
----
pytest-django-3.8.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pytest-django.spec ++++++
--- /var/tmp/diff_new_pack.135nTh/_old 2020-01-27 00:20:30.413407365 +0100
+++ /var/tmp/diff_new_pack.135nTh/_new 2020-01-27 00:20:30.417407368 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-pytest-django
#
-# Copyright (c) 2019 SUSE LLC.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-pytest-django
-Version: 3.7.0
+Version: 3.8.0
Release: 0
Summary: A Django plugin for py.test
License: BSD-3-Clause
++++++ pytest-django-3.7.0.tar.gz -> pytest-django-3.8.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.7.0/.travis.yml
new/pytest-django-3.8.0/.travis.yml
--- old/pytest-django-3.7.0/.travis.yml 2019-11-09 07:16:37.000000000 +0100
+++ new/pytest-django-3.8.0/.travis.yml 2020-01-14 06:19:05.000000000 +0100
@@ -26,7 +26,7 @@
env: TOXENV=py37-dj21-sqlite-coverage
- python: 3.7
env: TOXENV=py37-dj22-sqlite-xdist-coverage
- - python: 3.8-dev
+ - python: 3.8
env: TOXENV=py38-dj30-sqlite-xdist-coverage
# Explicitly test (older) pytest 4.1.
@@ -94,7 +94,7 @@
if: tag IS present
install:
- - pip install tox==3.7.0
+ - pip install tox==3.9.0
script:
- tox
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.7.0/PKG-INFO
new/pytest-django-3.8.0/PKG-INFO
--- old/pytest-django-3.7.0/PKG-INFO 2019-11-09 07:16:53.000000000 +0100
+++ new/pytest-django-3.8.0/PKG-INFO 2020-01-14 06:19:20.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pytest-django
-Version: 3.7.0
+Version: 3.8.0
Summary: A Django plugin for pytest.
Home-page: https://pytest-django.readthedocs.io/
Author: Andreas Pelme
@@ -8,6 +8,7 @@
Maintainer: Andreas Pelme
Maintainer-email: [email protected]
License: BSD-3-Clause
+Project-URL: Source, https://github.com/pytest-dev/pytest-django
Description: .. image::
https://img.shields.io/pypi/v/pytest-django.svg?style=flat
:alt: PyPI Version
:target: https://pypi.python.org/pypi/pytest-django
@@ -82,6 +83,7 @@
Classifier: Framework :: Django :: 2.0
Classifier: Framework :: Django :: 2.1
Classifier: Framework :: Django :: 2.2
+Classifier: Framework :: Django :: 3.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
@@ -91,6 +93,7 @@
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Testing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.7.0/docs/changelog.rst
new/pytest-django-3.8.0/docs/changelog.rst
--- old/pytest-django-3.7.0/docs/changelog.rst 2019-11-09 07:16:37.000000000
+0100
+++ new/pytest-django-3.8.0/docs/changelog.rst 2020-01-14 06:19:05.000000000
+0100
@@ -1,6 +1,17 @@
Changelog
=========
+3.8.0 (2020-01-14)
+------------------
+
+Improvements
+^^^^^^^^^^^^
+
+* Make Django's assertion helpers available in pytest_django.asserts (#709).
+
+* Report django-configurations setting (#791)
+
+
3.7.0 (2019-11-09)
------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.7.0/docs/helpers.rst
new/pytest-django-3.8.0/docs/helpers.rst
--- old/pytest-django-3.7.0/docs/helpers.rst 2019-11-09 07:16:37.000000000
+0100
+++ new/pytest-django-3.8.0/docs/helpers.rst 2020-01-14 06:19:05.000000000
+0100
@@ -3,6 +3,16 @@
Django helpers
==============
+Assertions
+----------
+
+All of Django's :py:class:`~django:django.test.TestCase`
+:ref:`django:assertions` are available in ``pytest_django.asserts``, e.g.
+
+::
+
+ from pytest_django.asserts import assertTemplateUsed
+
Markers
-------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.7.0/pytest_django/asserts.py
new/pytest-django-3.8.0/pytest_django/asserts.py
--- old/pytest-django-3.7.0/pytest_django/asserts.py 1970-01-01
01:00:00.000000000 +0100
+++ new/pytest-django-3.8.0/pytest_django/asserts.py 2020-01-14
06:19:05.000000000 +0100
@@ -0,0 +1,34 @@
+"""
+Dynamically load all Django assertion cases and expose them for importing.
+"""
+from functools import wraps
+from django.test import (
+ TestCase, SimpleTestCase,
+ LiveServerTestCase, TransactionTestCase
+)
+
+test_case = TestCase('run')
+
+
+def _wrapper(name):
+ func = getattr(test_case, name)
+
+ @wraps(func)
+ def assertion_func(*args, **kwargs):
+ return func(*args, **kwargs)
+
+ return assertion_func
+
+
+__all__ = []
+assertions_names = set()
+assertions_names.update(
+ set(attr for attr in vars(TestCase) if attr.startswith('assert')),
+ set(attr for attr in vars(SimpleTestCase) if attr.startswith('assert')),
+ set(attr for attr in vars(LiveServerTestCase) if
attr.startswith('assert')),
+ set(attr for attr in vars(TransactionTestCase) if
attr.startswith('assert')),
+)
+
+for assert_func in assertions_names:
+ globals()[assert_func] = _wrapper(assert_func)
+ __all__.append(assert_func)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.7.0/pytest_django/fixtures.py
new/pytest-django-3.8.0/pytest_django/fixtures.py
--- old/pytest-django-3.7.0/pytest_django/fixtures.py 2019-11-09
07:16:37.000000000 +0100
+++ new/pytest-django-3.8.0/pytest_django/fixtures.py 2020-01-14
06:19:05.000000000 +0100
@@ -33,7 +33,7 @@
@pytest.fixture(scope="session")
-def django_db_modify_db_settings_tox_suffix(request):
+def django_db_modify_db_settings_tox_suffix():
skip_if_no_django()
tox_environment = os.getenv("TOX_PARALLEL_ENV")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.7.0/pytest_django/plugin.py
new/pytest-django-3.8.0/pytest_django/plugin.py
--- old/pytest-django-3.7.0/pytest_django/plugin.py 2019-11-09
07:16:37.000000000 +0100
+++ new/pytest-django-3.8.0/pytest_django/plugin.py 2020-01-14
06:19:05.000000000 +0100
@@ -55,6 +55,8 @@
# pytest 4.2 handles unittest setup/teardown itself via wrapping fixtures.
_handle_unittest_methods = parse_version(pytest.__version__) <
parse_version("4.2")
+_report_header = []
+
# ############### pytest hooks ################
@@ -287,39 +289,25 @@
):
os.environ[INVALID_TEMPLATE_VARS_ENV] = "true"
- # Configure DJANGO_SETTINGS_MODULE
- if options.ds:
- ds_source = "command line option"
- ds = options.ds
- elif SETTINGS_MODULE_ENV in os.environ:
- ds = os.environ[SETTINGS_MODULE_ENV]
- ds_source = "environment variable"
- elif early_config.getini(SETTINGS_MODULE_ENV):
- ds = early_config.getini(SETTINGS_MODULE_ENV)
- ds_source = "ini file"
- else:
- ds = None
- ds_source = None
+ def _get_option_with_source(option, envname):
+ if option:
+ return option, "option"
+ if envname in os.environ:
+ return os.environ[envname], "env"
+ cfgval = early_config.getini(envname)
+ if cfgval:
+ return cfgval, "ini"
+ return None, None
- if ds:
- early_config._dsm_report_header = "Django settings: %s (from %s)" % (
- ds,
- ds_source,
- )
- else:
- early_config._dsm_report_header = None
-
- # Configure DJANGO_CONFIGURATION
- dc = (
- options.dc
- or os.environ.get(CONFIGURATION_ENV)
- or early_config.getini(CONFIGURATION_ENV)
- )
+ ds, ds_source = _get_option_with_source(options.ds, SETTINGS_MODULE_ENV)
+ dc, dc_source = _get_option_with_source(options.dc, CONFIGURATION_ENV)
if ds:
+ _report_header.append("settings: %s (from %s)" % (ds, ds_source))
os.environ[SETTINGS_MODULE_ENV] = ds
if dc:
+ _report_header.append("configuration: %s (from %s)" % (dc,
dc_source))
os.environ[CONFIGURATION_ENV] = dc
# Install the django-configurations importer
@@ -337,9 +325,9 @@
_setup_django()
-def pytest_report_header(config):
- if config._dsm_report_header:
- return [config._dsm_report_header]
+def pytest_report_header():
+ if _report_header:
+ return ["django: " + ", ".join(_report_header)]
@pytest.mark.trylast
@@ -427,7 +415,7 @@
_disable_class_methods(item.cls)
-def pytest_collection_modifyitems(session, config, items):
+def pytest_collection_modifyitems(items):
def get_order_number(test):
marker_db = test.get_closest_marker('django_db')
if marker_db:
@@ -565,7 +553,7 @@
@pytest.fixture(scope="function")
-def mailoutbox(monkeypatch, django_mail_patch_dns, _dj_autoclear_mailbox):
+def mailoutbox(django_mail_patch_dns, _dj_autoclear_mailbox):
if not django_settings_is_configured():
return
@@ -582,7 +570,7 @@
@pytest.fixture(scope="function")
-def django_mail_dnsname(monkeypatch):
+def django_mail_dnsname():
return "fake-tests.example.com"
@@ -617,7 +605,7 @@
@pytest.fixture(autouse=True, scope="session")
-def _fail_for_invalid_template_variable(request):
+def _fail_for_invalid_template_variable():
"""Fixture that fails for invalid variables in templates.
This fixture will fail each test that uses django template rendering
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.7.0/pytest_django.egg-info/PKG-INFO
new/pytest-django-3.8.0/pytest_django.egg-info/PKG-INFO
--- old/pytest-django-3.7.0/pytest_django.egg-info/PKG-INFO 2019-11-09
07:16:53.000000000 +0100
+++ new/pytest-django-3.8.0/pytest_django.egg-info/PKG-INFO 2020-01-14
06:19:20.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pytest-django
-Version: 3.7.0
+Version: 3.8.0
Summary: A Django plugin for pytest.
Home-page: https://pytest-django.readthedocs.io/
Author: Andreas Pelme
@@ -8,6 +8,7 @@
Maintainer: Andreas Pelme
Maintainer-email: [email protected]
License: BSD-3-Clause
+Project-URL: Source, https://github.com/pytest-dev/pytest-django
Description: .. image::
https://img.shields.io/pypi/v/pytest-django.svg?style=flat
:alt: PyPI Version
:target: https://pypi.python.org/pypi/pytest-django
@@ -82,6 +83,7 @@
Classifier: Framework :: Django :: 2.0
Classifier: Framework :: Django :: 2.1
Classifier: Framework :: Django :: 2.2
+Classifier: Framework :: Django :: 3.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
@@ -91,6 +93,7 @@
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Testing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-django-3.7.0/pytest_django.egg-info/SOURCES.txt
new/pytest-django-3.8.0/pytest_django.egg-info/SOURCES.txt
--- old/pytest-django-3.7.0/pytest_django.egg-info/SOURCES.txt 2019-11-09
07:16:53.000000000 +0100
+++ new/pytest-django-3.8.0/pytest_django.egg-info/SOURCES.txt 2020-01-14
06:19:20.000000000 +0100
@@ -26,6 +26,7 @@
docs/usage.rst
docs/_ext/pytestdocs.py
pytest_django/__init__.py
+pytest_django/asserts.py
pytest_django/compat.py
pytest_django/django_compat.py
pytest_django/fixtures.py
@@ -58,6 +59,7 @@
pytest_django_test/app/migrations/__init__.py
pytest_django_test/app/static/a_file.txt
tests/conftest.py
+tests/test_asserts.py
tests/test_database.py
tests/test_db_access_in_repr.py
tests/test_db_setup.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.7.0/setup.py
new/pytest-django-3.8.0/setup.py
--- old/pytest-django-3.7.0/setup.py 2019-11-09 07:16:37.000000000 +0100
+++ new/pytest-django-3.8.0/setup.py 2020-01-14 06:19:05.000000000 +0100
@@ -54,6 +54,7 @@
'Framework :: Django :: 2.0',
'Framework :: Django :: 2.1',
'Framework :: Django :: 2.2',
+ 'Framework :: Django :: 3.0',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
@@ -63,9 +64,13 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development :: Testing',
],
+ project_urls={
+ 'Source': 'https://github.com/pytest-dev/pytest-django',
+ },
# the following makes a plugin available to pytest
entry_points={'pytest11': ['django = pytest_django.plugin']})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.7.0/tests/test_asserts.py
new/pytest-django-3.8.0/tests/test_asserts.py
--- old/pytest-django-3.7.0/tests/test_asserts.py 1970-01-01
01:00:00.000000000 +0100
+++ new/pytest-django-3.8.0/tests/test_asserts.py 2020-01-14
06:19:05.000000000 +0100
@@ -0,0 +1,56 @@
+"""
+Tests the dynamic loading of all Django assertion cases.
+"""
+import inspect
+
+import pytest
+import pytest_django
+
+from pytest_django.asserts import __all__ as asserts_all
+
+
+def _get_actual_assertions_names():
+ """
+ Returns list with names of all assertion helpers in Django.
+ """
+ from django.test import TestCase as DjangoTestCase
+ from unittest import TestCase as DefaultTestCase
+
+ obj = DjangoTestCase('run')
+
+ def is_assert(func):
+ return func.startswith('assert') and '_' not in func
+
+ base_methods = [name for name, member in
+ inspect.getmembers(DefaultTestCase)
+ if is_assert(name)]
+
+ return [name for name, member in inspect.getmembers(obj)
+ if is_assert(name) and name not in base_methods]
+
+
+def test_django_asserts_available():
+ django_assertions = _get_actual_assertions_names()
+ expected_assertions = asserts_all
+ assert set(django_assertions) == set(expected_assertions)
+
+ for name in expected_assertions:
+ assert hasattr(pytest_django.asserts, name)
+
+
[email protected]_db
+def test_sanity():
+ from django.http import HttpResponse
+ from pytest_django.asserts import assertContains, assertNumQueries
+
+ response = HttpResponse('My response')
+
+ assertContains(response, 'My response')
+ with pytest.raises(AssertionError):
+ assertContains(response, 'Not my response')
+
+ assertNumQueries(0, lambda: 1 + 1)
+ with assertNumQueries(0):
+ pass
+
+ assert assertContains.__doc__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-django-3.7.0/tests/test_django_configurations.py
new/pytest-django-3.8.0/tests/test_django_configurations.py
--- old/pytest-django-3.7.0/tests/test_django_configurations.py 2019-11-09
07:16:37.000000000 +0100
+++ new/pytest-django-3.8.0/tests/test_django_configurations.py 2020-01-14
06:19:05.000000000 +0100
@@ -40,11 +40,14 @@
"""
)
result = testdir.runpytest_subprocess()
- result.stdout.fnmatch_lines(["* 1 passed in*"])
+ result.stdout.fnmatch_lines([
+ 'django: settings: tpkg.settings_env (from env), configuration:
MySettings (from env)',
+ "* 1 passed in*",
+ ])
assert result.ret == 0
-def test_dc_ini(testdir, monkeypatch):
+def test_dc_env_overrides_ini(testdir, monkeypatch):
monkeypatch.setenv("DJANGO_SETTINGS_MODULE", "tpkg.settings_env")
monkeypatch.setenv("DJANGO_CONFIGURATION", "MySettings")
@@ -68,7 +71,40 @@
"""
)
result = testdir.runpytest_subprocess()
- result.stdout.fnmatch_lines(["* 1 passed in*"])
+ result.stdout.fnmatch_lines([
+ 'django: settings: tpkg.settings_env (from env), configuration:
MySettings (from env)',
+ "* 1 passed in*",
+ ])
+ assert result.ret == 0
+
+
+def test_dc_ini(testdir, monkeypatch):
+ monkeypatch.delenv("DJANGO_SETTINGS_MODULE")
+
+ testdir.makeini(
+ """
+ [pytest]
+ DJANGO_SETTINGS_MODULE = tpkg.settings_ini
+ DJANGO_CONFIGURATION = MySettings
+ """
+ )
+ pkg = testdir.mkpydir("tpkg")
+ settings = pkg.join("settings_ini.py")
+ settings.write(BARE_SETTINGS)
+ testdir.makepyfile(
+ """
+ import os
+
+ def test_ds():
+ assert os.environ['DJANGO_SETTINGS_MODULE'] == 'tpkg.settings_ini'
+ assert os.environ['DJANGO_CONFIGURATION'] == 'MySettings'
+ """
+ )
+ result = testdir.runpytest_subprocess()
+ result.stdout.fnmatch_lines([
+ 'django: settings: tpkg.settings_ini (from ini), configuration:
MySettings (from ini)',
+ "* 1 passed in*",
+ ])
assert result.ret == 0
@@ -96,5 +132,9 @@
"""
)
result = testdir.runpytest_subprocess("--ds=tpkg.settings_opt",
"--dc=MySettings")
- result.stdout.fnmatch_lines(["* 1 passed in*"])
+ result.stdout.fnmatch_lines([
+ 'django: settings: tpkg.settings_opt (from option),'
+ ' configuration: MySettings (from option)',
+ "* 1 passed in*",
+ ])
assert result.ret == 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-django-3.7.0/tests/test_django_settings_module.py
new/pytest-django-3.8.0/tests/test_django_settings_module.py
--- old/pytest-django-3.7.0/tests/test_django_settings_module.py
2019-11-09 07:16:37.000000000 +0100
+++ new/pytest-django-3.8.0/tests/test_django_settings_module.py
2020-01-14 06:19:05.000000000 +0100
@@ -38,10 +38,10 @@
"""
)
result = testdir.runpytest_subprocess()
- assert result.parseoutcomes()["passed"] == 1
- result.stdout.fnmatch_lines(
- ["Django settings: tpkg.settings_ini " "(from ini file)*"]
- )
+ result.stdout.fnmatch_lines([
+ "django: settings: tpkg.settings_ini (from ini)",
+ "*= 1 passed in *",
+ ])
assert result.ret == 0
@@ -59,10 +59,10 @@
"""
)
result = testdir.runpytest_subprocess()
- result.stdout.fnmatch_lines(
- ["Django settings: tpkg.settings_env (from " "environment variable)*"]
- )
- assert result.parseoutcomes()["passed"] == 1
+ result.stdout.fnmatch_lines([
+ "django: settings: tpkg.settings_env (from env)",
+ "*= 1 passed in *",
+ ])
def test_ds_option(testdir, monkeypatch):
@@ -85,10 +85,10 @@
"""
)
result = testdir.runpytest_subprocess("--ds=tpkg.settings_opt")
- result.stdout.fnmatch_lines(
- ["Django settings: tpkg.settings_opt " "(from command line option)"]
- )
- assert result.parseoutcomes()["passed"] == 1
+ result.stdout.fnmatch_lines([
+ "django: settings: tpkg.settings_opt (from option)",
+ "*= 1 passed in *",
+ ])
def test_ds_env_override_ini(testdir, monkeypatch):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-django-3.7.0/tests/test_fixtures.py
new/pytest-django-3.8.0/tests/test_fixtures.py
--- old/pytest-django-3.7.0/tests/test_fixtures.py 2019-11-09
07:16:37.000000000 +0100
+++ new/pytest-django-3.8.0/tests/test_fixtures.py 2020-01-14
06:19:05.000000000 +0100
@@ -417,13 +417,12 @@
"""
django_testdir.create_test_module(
"""
- import pytest
from django.utils.encoding import force_str
try:
- from urllib2 import urlopen, HTTPError
+ from urllib2 import urlopen
except ImportError:
- from urllib.request import urlopen, HTTPError
+ from urllib.request import urlopen
class TestLiveServer:
def test_a(self, live_server, settings):