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 f31f0cb

Browse files
authored
Merge pull request #14 from erika-dike/setup_tests_to_use_separate_shelve_test_db
Tests should use a separate shelve test database
2 parents 03d3494 + 17dac42 commit f31f0cb

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 によって変換されたページ (->オリジナル) /