geneagrapher
geneagrapher copied to clipboard
Don't assume that database files have .db extension in tests
I'm getting the following test error:
ERROR: test_init2 (tests.geneagrapher.test_cache_grabber.TestCacheGrabberMethods)
Test constructor with non-default filename.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/profzoom/src/geneagrapher/geneagrapher/tests/geneagrapher/test_cache_grabber.py", line 42, in test_init2
os.remove("mycachename.db")
FileNotFoundError: [Errno 2] No such file or directory: 'mycachename.db'
This is because the file that was created by CacheGrabber
's initialization method doesn't have the .db
extension:
$ ls mycachename*
mycachename
According to the shelve
docs, there's no guarantee as to the presence of an extension (or even the number of files created!):
The filename specified is the base filename for the underlying database. As a side-effect, an extension may be added to the filename and more than one file may be created.