elifesciences / elife-tools

Python library for parsing eLife article XML data.
MIT License
15 stars 7 forks source link

Test scenarios refactoring #356

Closed gnott closed 3 years ago

gnott commented 3 years ago

Re issue https://github.com/elifesciences/elife-tools/issues/311

Lots of files changed in this PR, limited to files in the tests/ folder. The primary goal was to get rid of all the old JSON fixture tests, and instead use the "expected" fixtures, or make assertions directly in the test file.

Some abbreviated XML fixtures are added to the tests/fixtures/ folder which have only parts of the kitchen sink XML file, which speeds up test runs and may make it easier to understand some test cases.

In addition, I noticed test_raw_parser.py was relatively slow, and I was able to speed it up by caching some of the soup parsed from XML files so it can be used in multiple tests.

Overall, test coverage remains the same, and running the tests for me has been reduced from 140 seconds originally down to 40 seconds now.

Bumping the version number from 0.9.0 to 0.9.1, because there are no enhancements or changes to the main library modules.