Projet

Général

Profil

0009-tests-remove-warning-unclosed-file.patch

Lauréline Guérin, 11 décembre 2020 11:52

Télécharger (1,49 ko)

Voir les différences:

Subject: [PATCH 09/10] tests: remove warning unclosed file

 tests/test_astregs.py | 5 +++--
 tests/test_maelis.py  | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)
tests/test_astregs.py
19 19
BASE_URL = 'https://test-ws-astre-gs.departement06.fr/axis2/services/'
20 20

  
21 21
def get_xml_file(filename):
22
    return open(os.path.join(os.path.dirname(__file__),
23
                'data', 'astregs', filename), 'rb').read()
22
    filepath = os.path.join(os.path.dirname(__file__), 'data', 'astregs', filename)
23
    with open(filepath, 'rb') as f:
24
        return f.read()
24 25

  
25 26
def contact_search_side_effect(wsdl_url, **kwargs):
26 27
    if 'Tiers' in wsdl_url:
tests/test_maelis.py
14 14

  
15 15

  
16 16
def get_xml_file(filename):
17
    return open(os.path.join(os.path.dirname(__file__),
18
                             'data', 'maelis', filename), 'rb').read()
17
    filepath = os.path.join(os.path.dirname(__file__), 'data', 'maelis', filename)
18
    with open(filepath, 'rb') as f:
19
        return f.read()
19 20

  
20 21

  
21 22
@pytest.fixture
22
-