FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Tests should use a separate shelve test database by erika-dike · Pull Request #14 · fluentpython/example-code · GitHub

This repository was archived by the owner on Dec 2, 2021. It is now read-only.
/ example-code Public archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
9 changes: 7 additions & 2 deletions 19-dyn-attr-prop/oscon/test_schedule1.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL