OpenDataServices / lib-cove-web

Other
1 stars 1 forks source link

fix: Use FieldFile.path instead of File.name, to avoid unclosed file warnings #108

Closed jpmckinney closed 1 year ago

jpmckinney commented 1 year ago

Otherwise I get failures when running with pytest -W like:

tests/test_basic.py ...E                                                 [ 80%]
Exception ignored in: <_io.FileIO name='/home/runner/work/cove-oc4ids/cove-oc4ids/media/d79f724e-4217-4432-8728-a5222bc1517f/test.json' mode='rb' closefd=True>
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/tokenize.py", line 528, in _tokenize
    spos, epos, pos = (lnum, start), (lnum, end), end
ResourceWarning: unclosed file <_io.BufferedReader name='/home/runner/work/cove-oc4ids/cove-oc4ids/media/d79f724e-4217-4432-8728-a5222bc1517f/test.json'>
Exception ignored in: <socket.socket fd=14, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 53186), raddr=('127.0.0.1', 52031)>
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/tokenize.py", line 528, in _tokenize
    spos, epos, pos = (lnum, start), (lnum, end), end
ResourceWarning: unclosed <socket.socket fd=14, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 53186), raddr=('127.0.0.1', 52031)>

Note to myself to remove STANDARD_MAINTENANCE_SCRIPTS_IGNORE from lint.yml in cove-oc4ids and cove-ocds after upgrading to a new release of libcoveweb.

jpmckinney commented 1 year ago

Closed via #110.