diff options
author | Alex Grönholm <alex.gronholm@nextday.fi> | 2015-12-10 22:37:27 +0200 |
---|---|---|
committer | Alex Grönholm <alex.gronholm@nextday.fi> | 2015-12-10 22:53:17 +0200 |
commit | 2b36ece23a5060b2b82dce98eb12b177615bd198 (patch) | |
tree | 235676523544d89671f0393793d96c7a14cd65c2 /tests | |
parent | bf99bff8ea683b98756313ff34a22320d141186c (diff) | |
download | apscheduler-2b36ece23a5060b2b82dce98eb12b177615bd198.tar.gz |
Store the test SQLite database in a temporary directory
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_jobstores.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test_jobstores.py b/tests/test_jobstores.py index 89e9c65..5348a91 100644 --- a/tests/test_jobstores.py +++ b/tests/test_jobstores.py @@ -1,5 +1,4 @@ from datetime import datetime -import os import pytest @@ -25,13 +24,14 @@ def memjobstore(): @pytest.yield_fixture -def sqlalchemyjobstore(): +def sqlalchemyjobstore(tmpdir): + db_path = tmpdir.join('apscheduler_unittest.sqlite') sqlalchemy = pytest.importorskip('apscheduler.jobstores.sqlalchemy') - store = sqlalchemy.SQLAlchemyJobStore(url='sqlite:///apscheduler_unittest.sqlite') + store = sqlalchemy.SQLAlchemyJobStore(url='sqlite:///%s' % db_path) store.start(None, 'sqlalchemy') yield store store.shutdown() - os.remove('apscheduler_unittest.sqlite') + db_path.remove() @pytest.yield_fixture @@ -253,7 +253,7 @@ def test_repr_memjobstore(memjobstore): def test_repr_sqlalchemyjobstore(sqlalchemyjobstore): - assert repr(sqlalchemyjobstore) == '<SQLAlchemyJobStore (url=sqlite:///apscheduler_unittest.sqlite)>' + assert repr(sqlalchemyjobstore).startswith('<SQLAlchemyJobStore (url=') def test_repr_mongodbjobstore(mongodbjobstore): |