본문 바로가기
Python

[Error해결] ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...] / __main__.py: error: unrecognized arguments: --score

by mimi_Bo 2021. 5. 6.

pytest로 수행한 과제를 제출하는 python -m pytest --submit 까지는 잘됐으나,

나의 점수를 확인하기 위해 python -m pytest --score는 실행이 되지 않고 에러가 생기는 문제가 생겼습니다.  

🚫 오류

ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__mian__.py: error: unrecognized arguments: --score

inifile: C:\Users\Desktop\Section5\setup.cfg
rootdir: C:\Users\Desktop\Section5

아래의 블로그에서 비슷한 오류가 있었지만 pytest-xdist라는 패키지 설치를 통해 해결했다고 해서 저도 설치해봤지만 해결되지 않았습니다.

itkmj.blogspot.com/2019/12/python-pytest-unrecognized-arguments-n.html

 

python pytest unrecognized arguments: -n error

pycharm을 통해서 pytest를 하려고 하니 아래의 에러가 발생하였다. 해당 에러는 pycharm의 고유 에러는 아닌듯 하다. (keras) C:\repo\keras\mgim>pytest ERROR: usage: pytest [options]...

itkmj.blogspot.com

✔ 해결방법

원인은 버전이 맞지 않았기 때문입니다.

제가 만든 가상환경에 설치된 pytest-submit의 버전은 1.1.1이나 필요한 버전은 1.2.1이였습니다. requirements.txt로 설치했음에도 불구하고 1.1.1버전으로 설치가 되서 기존 pytest-submit을 제거하고 다른 경로로 설치했습니다.

# 기존의 pytest-submit 제거
pip uninstall pytest-submit

# 아래의 경로로 설치
pip install git+https://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@github.com/aib-contents/pytest-submit-plugin#egg=pytest-submit

이후 버전을 확인해보니 pytest-submit 버전이 1.2.1이고 --all과 --score 모두 잘 수행되었습니다!

댓글