Closed
Description
The failure is not present when running under python 3.7, or with pytest-django 3.4.7 and python 2.7.
=================================== FAILURES ===================================
________ TestSqliteWithMultipleDbsAndXdist.test_sqlite_database_renamed ________
self = <test_db_setup.TestSqliteWithMultipleDbsAndXdist instance at 0x7f49a08c0518>
django_testdir = <Testdir local('/tmp/pytest-of-builduser/pytest-1/test_sqlite_database_renamed0')>
def test_sqlite_database_renamed(self, django_testdir):
pytest.importorskip("xdist")
django_testdir.create_test_module(
"""
import pytest
from django.db import connections
@pytest.mark.django_db
def test_a():
(conn_db2, conn_default) = sorted(
connections.all(),
key=lambda conn: conn.alias,
)
assert conn_default.vendor == 'sqlite'
db_name = conn_default.creation._get_test_db_name()
assert 'file:memorydb' in db_name
assert conn_db2.vendor == 'sqlite'
db_name = conn_db2.creation._get_test_db_name()
assert 'test_custom_db_name_gw' in db_name
"""
)
result = django_testdir.runpytest_subprocess("--tb=short", "-vv", "-n1")
> assert result.ret == 0
E assert 1 == 0
E + where 1 = <RunResult ret=1 len(stdout.lines)=60 len(stderr.lines)=0 duration=2.17s>.ret
/build/python-pytest-django/src/pytest-django-3.4.8-py2/tests/test_db_setup.py:258: AssertionError
----------------------------- Captured stdout call -----------------------------
running: /usr/bin/python2 -mpytest --basetemp=/tmp/pytest-of-builduser/pytest-1/test_sqlite_database_renamed0/runpytest-0 --tb=short -vv -n1
in: /tmp/pytest-of-builduser/pytest-1/test_sqlite_database_renamed0
============================= test session starts ==============================
platform linux2 -- Python 2.7.16, pytest-4.3.1, py-1.8.0, pluggy-0.9.0 -- /usr/bin/python2
cachedir: .pytest_cache
Django settings: tpkg.the_settings (from environment variable)
rootdir: /tmp/pytest-of-builduser/pytest-1/test_sqlite_database_renamed0, inifile: tox.ini
plugins: django-3.4.8, xdist-1.26.1, forked-1.0.2
gw0 I
[gw0] linux2 Python 2.7.16 cwd: /tmp/pytest-of-builduser/pytest-1/test_sqlite_database_renamed0
[gw0] Python 2.7.16 (default, Mar 11 2019, 18:59:25) -- [GCC 8.2.1 20181127]
gw0 [1]
scheduling tests via LoadScheduling
tpkg/test_the_test.py::test_a
[gw0] FAILED tpkg/test_the_test.py::test_a
=================================== FAILURES ===================================
____________________________________ test_a ____________________________________
[gw0] linux2 -- Python 2.7.16 /usr/bin/python2
tpkg/test_the_test.py:14: in test_a
assert 'file:memorydb' in db_name
E AssertionError: assert 'file:memorydb' in ':memory:'