Skip to content
This repository was archived by the owner on Dec 2, 2021. It is now read-only.

Tests should use a separate shelve test database #14

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions 19-dyn-attr-prop/oscon/test_schedule1.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import os
import shelve

import pytest

import schedule1 as schedule

DB_NAME = 'data/test_db'


@pytest.yield_fixture
@pytest.fixture(scope='module')
def db():
with shelve.open(schedule.DB_NAME) as the_db:
with shelve.open(DB_NAME) as the_db:
if schedule.CONFERENCE not in the_db:
schedule.load_db(the_db)
yield the_db
os.remove(DB_NAME)


def test_record_class():
Expand Down
7 changes: 5 additions & 2 deletions 19-dyn-attr-prop/oscon/test_schedule2.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import os
import shelve

import pytest

import schedule2 as schedule


@pytest.yield_fixture
@pytest.fixture(scope='module')
def db():
with shelve.open(schedule.DB_NAME) as the_db:
with shelve.open(DB_NAME) as the_db:
if schedule.CONFERENCE not in the_db:
schedule.load_db(the_db)
yield the_db
os.remove(DB_NAME)


def test_record_attr_access():
Expand Down