fluentpython / example-code

Example code for the book Fluent Python, 1st Edition (O'Reilly, 2015)
http://bit.ly/fluentpy
MIT License
5.56k stars 2.18k forks source link

Tests should use a separate shelve test database #14

Closed erika-dike closed 3 years ago

erika-dike commented 7 years ago

While trying to run the tests locally, I ran into errors when pickle tried to load the already existing database. I think it would be nice if readers do not have to waste any time with this error.

This PR fixes that by creating a temporary database before any tests in the module run and deleting it afterwards. I also took the liberty of switching from the deprecated @pytest.yield_fixture to @pytest.fixture.

Thanks for a wonderful book 😃.

ramalho commented 3 years ago

Thank you for this contribution @erika-dike!