Skip to content

Commit

Permalink
Merge pull request #643 from EducationalTestingService/bugfix/close_l…
Browse files Browse the repository at this point in the history
…ogger_file_handlers_in_tests

Add closing of logger file handlers to tearDown method in test_input.py
  • Loading branch information
desilinguist committed Nov 13, 2020
2 parents 91f4d19 + 3cb8656 commit d4811c1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ def tearDown():
Clean up after tests.
"""

# We need to first ensure that all logger file handlers are closed
# before trying to unlink any of the log files. Otherwise, the
# tearDown fixture will not work on Windows.
logger = get_skll_logger('experiment')
close_and_remove_logger_handlers(logger)

for path in (glob(join(config_dir, 'test_config_parsing_*.cfg')) +
glob(join(config_dir, 'test_relative_paths_auto_dir*.cfg')) +
glob(join(output_dir, 'config_parsing*.log')) +
Expand Down Expand Up @@ -1044,12 +1050,6 @@ def test_config_parsing_automatic_output_directory_creation():
ok_(exists(new_models_path))
ok_(exists(new_predictions_path))

# we need to close the experiment log file
# that would also have been created otherwise
# the teardown fixture on Windows will not work
logger = get_skll_logger('experiment')
close_and_remove_logger_handlers(logger)


def test_cv_folds_and_grid_search_folds():

Expand Down

0 comments on commit d4811c1

Please sign in to comment.