Fix several issues in tests

- regex-escape file names for regex matching in tests
- add a missing pytest import to test_file_handler.py
- pep8/flake8 fixes for test files