Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 2, 2021. It is now read-only.

Commit 17dac42

Browse files
author
andela-cdike
committed
Tests should use separate shelve test database
- Switch from depreccated yield_fixture to fixture decorator
1 parent 3d74f0e commit 17dac42

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

‎19-dyn-attr-prop/oscon/test_schedule1.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1+
import os
12
import shelve
3+
24
import pytest
35

46
import schedule1 as schedule
57

8+
DB_NAME = 'data/test_db'
9+
610

7-
@pytest.yield_fixture
11+
@pytest.fixture(scope='module')
812
def db():
9-
with shelve.open(schedule.DB_NAME) as the_db:
13+
with shelve.open(DB_NAME) as the_db:
1014
if schedule.CONFERENCE not in the_db:
1115
schedule.load_db(the_db)
1216
yield the_db
17+
os.remove(DB_NAME)
1318

1419

1520
def test_record_class():

‎19-dyn-attr-prop/oscon/test_schedule2.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1+
import os
12
import shelve
3+
24
import pytest
35

46
import schedule2 as schedule
57

68

7-
@pytest.yield_fixture
9+
@pytest.fixture(scope='module')
810
def db():
9-
with shelve.open(schedule.DB_NAME) as the_db:
11+
with shelve.open(DB_NAME) as the_db:
1012
if schedule.CONFERENCE not in the_db:
1113
schedule.load_db(the_db)
1214
yield the_db
15+
os.remove(DB_NAME)
1316

1417

1518
def test_record_attr_access():

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /