From fef18507c711d2c366a7f92ed822cd236095cbb2 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Fri, 19 Jun 2020 16:28:00 +0200 Subject: [PATCH] tests: do not leak file descriptors --- tests/test_schema2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_schema2.py b/tests/test_schema2.py index f5d4b86..57b32e9 100644 --- a/tests/test_schema2.py +++ b/tests/test_schema2.py @@ -12,13 +12,13 @@ def pytest_generate_tests(metafunc): if hasattr(metafunc, 'function'): fcode = metafunc.function.__code__ if 'visualization' in fcode.co_varnames[:fcode.co_argcount]: - tables = json.load( - open( + with open( os.path.join( os.path.dirname(__file__), 'fixtures', 'schema2', - 'tables.json'))) + 'tables.json')) as fd: + tables = json.load(fd) metafunc.parametrize(['visualization'], [[x] for x in tables])