rpdelaney-archive / python-chess-annotator

Reads chess games in PGN format and adds annotations using an engine
GNU General Public License v3.0
61 stars 29 forks source link

Test coverage needs improvement #11

Closed rpdelaney closed 5 years ago

rpdelaney commented 6 years ago

In general, the test coverage is not where I would like it to be. This is partly for two reasons:

1) It's hard to do lots of functional tests for stuff that requires engine execution, since engine operations take so long to finish, and engine behavior can be non-deterministic. (It might be fruitful to investigate whether UCI engine behavior can be mocked in the testing environment.)

2) Overall the functions in python-chess-annotator are too long and complex (especially analyze_game()), which does not lend itself well to unit testing. (This is a bigger problem than just testing, since over-long functions make the application's behavior harder to read, harder follow during debugging, and make the project harder to maintain in general.)

I'm going to leave this issue here to prod myself to improve this situation, and also to invite help from others on building in more tests.

rpdelaney commented 6 years ago

13 exposed a bug in parse_args where an exception was raised if the user passed the -h switch at runtime. This bug got through because the argument parser doesn't have any tests. It will probably have to be refactored to accept functional testing, maybe like described here: https://stackoverflow.com/questions/18160078/how-do-you-write-tests-for-the-argparse-portion-of-a-python-module

rpdelaney commented 5 years ago

I'm planning a rewrite so this should go to the back-burner.