bookcut icon indicating copy to clipboard operation
bookcut copied to clipboard

More efficient testing

Open DerPhysikeR opened this issue 3 years ago • 3 comments

Hi

In general, test cases should be independent of real server connections. They should run fast so that one can run them frequently during development. Also, they shouldn't spam webpages with requests, every time a developer runs the tests. If a test would require a server connection, use pytest.monkeypatch or something similar to mock it.

However, having a few connection dependent test cases, which run only once before deployment, is probably a good idea. But, for the previously mentioned reasons, they should be separated from the rest of the tests. I suggest using @pytest.mark.online or something similar.

Pytest marks allow you to skip specific tests if for example the option -m "not online" is passed. I would create a conftest.py file to make this behavior the default and only if a new custom --online option is passed to pytest, the tests marked with @pytest.mark.online are run.

I can send you a merge request for that if you want.

Also, don't use copyrighted material, like Hararis "Sapiens", in your test cases, that screams for legal trouble. On the contrary, I would love for bookcut to also support entirely legal book repositories like project gutenberg in the future, maybe even scientific publications from platforms like arxiv.

DerPhysikeR avatar Jun 06 '21 10:06 DerPhysikeR

Hi again!

All your suggestions and recommendations about testing sounding reasonable, but I have to spend some time studying the mentioned concepts and the good practices of testing. Please feel free to contribute.

Also, on this point, I want to thank you for your overall contribution and to note that your idea of ​​adding Project Gutenberg and other book repositories is superb and from now on a high priority. I will create a new issue about it.

costis94 avatar Jun 06 '21 13:06 costis94

What is the correct way to upgrade (using the install link in the main page seems to point/download an old version). I am stuck on 1.3.3

DarrenPIngram avatar Jun 18 '21 05:06 DarrenPIngram

What is the correct way to upgrade (using the install link in the main page seems to point/download an old version). I am stuck on 1.3.3

I created a new issue.

costis94 avatar Jun 18 '21 09:06 costis94