Skip to content

Commit 2df89ca

Browse files
committed
Turns out I didn't know how relative imports work in Python3
1 parent ba1fd9f commit 2df89ca

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

tests/test_marks.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
import os
2-
import sys
3-
41
def test_mark_rolls_back_db_updates(db_testdir):
52
'''
63
Test that the mark can successfully roll back any database transactions
74
triggered by a test.
85
'''
9-
# The Testdir fixture appears to alter sys.path such that the import path
10-
# finder starts at the parent directory -- adjust this behavior so that we
11-
# can perform relative imports
12-
sys.path.append(os.getcwd())
13-
146
db_testdir.makeini("""
157
[pytest]
16-
mocked-sessions=database.db.session
8+
mocked-sessions=test_mark_rolls_back_db_updates0.database.db.session
179
""")
1810

1911
db_testdir.makepyfile(__init__='')
@@ -25,7 +17,7 @@ def test_mark_rolls_back_db_updates(db_testdir):
2517
""")
2618

2719
db_testdir.makepyfile("""
28-
from database import db
20+
from .database import db
2921
import pytest
3022
3123
@pytest.mark.transactional

0 commit comments

Comments
 (0)