Closed Bug 1650870 Opened 5 years ago Closed 5 years ago

Fix ResourceWarning from unclosed files in ichnaea tests

Categories

(Location :: General, defect, P3)

Tracking

(Not tracked)

RESOLVED MOVED

People

(Reporter: jwhitlock, Unassigned)

References

()

Details

With warnings enabled (make testshell, and pytest -Wd ichnaea), there are warnings about unclosed files:

ichnaea/api/submit/tests/test_submit_v1.py::TestView::test_batches
  /app/ichnaea/api/submit/tests/test_submit_v1.py:240: ResourceWarning: unclosed file <_io.BufferedRandom name=14>
    {

ichnaea/api/submit/tests/test_submit_v2.py::TestView::test_batches
  /usr/local/lib/python3.8/site-packages/sqlalchemy/event/attr.py:319: ResourceWarning: unclosed file <_io.BufferedRandom name=14>
    for fn in self.parent_listeners:

ichnaea/content/tests/test_views.py::TestFunctionalContent::test_content[/stats/regions-200-stats.regions-1]
  /usr/local/lib/python3.8/site-packages/chameleon/astutil.py:48: ResourceWarning: unclosed file <_io.BufferedRandom name=14>
    return compile(source, '', mode, ast.PyCF_ONLY_AST)

Further research is needed to determine if this is a issue with test setup and teardown, or if this may be causing problems in production as well. This stack overflow answer has some tips for investigating this issue.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → MOVED
You need to log in before you can comment on or make changes to this bug.