opendata-yamanashi / hanzai-api

山梨県 犯罪オープンデータAPI
https://opendata.yamanashi.dev/api/hanzai/docs
MIT License
2 stars 0 forks source link

自動テスト対応 #1

Closed yuukis closed 2 years ago

yuukis commented 2 years ago
yuukis commented 2 years ago

ローカル環境では動作しています PR 出します

# pytest
============================= test session starts ==============================
platform linux -- Python 3.8.12, pytest-7.1.1, pluggy-1.0.0
rootdir: /app
collected 4 items                                                              

test_main.py ....                                                        [100%]

============================== 4 passed in 1.47s ===============================
yuukis commented 2 years ago

@hroabe テストは OK で成功しているのですが、 Ctrl + C で終了しないと pytest が終了しない状況です。

スレッドで実行している箇所に起因しているようなのですが、解決方法がわかっておらず...

$ pytest                   
============================= test session starts ==============================
platform darwin -- Python 3.9.12, pytest-7.1.2, pluggy-1.0.0
rootdir: /Users/yuuki/Sync/git/opendata-yamanashi/hanzai-api
plugins: anyio-3.5.0
collected 4 items                                                              

app/tests/test_main.py ....                                              [100%]

============================== 4 passed in 1.11s ===============================
^CException ignored in: <module 'threading' from '/usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py'>
Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 1470, in _shutdown
    lock.acquire()
KeyboardInterrupt: