2
私はcondaでpythonをインストールしました。名前 'pytest'は定義されていません。 testpyを実行する方法?
pytest --version
This is pytest version 3.0.5, imported from /home/fabiano/anaconda3/lib/python3.6/site-packages/pytest.py
私のテストスクリプト
def tc1():
given="49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"
expected=b"SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t"
assert base64.b64encode(bytes.fromhex(given)) == expected
私はPythonのシェルからしようとしたとき、私はpytest.Butでいくつかのものをしようとしています
import pytest
、私はこの
ような問題を抱えているpytest輸入してきましたtestset.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'testset' is not defined
私のsh私はtestset.pyファイルを保存する必要がありエル pytest
<module 'pytest' from '/home/fabiano/anaconda3/lib/python3.6/site-packages/pytest.py'>
?
pythonスクリプトにpytestをインポートしましたか? (私たちはあなたのテストスクリプトの例を得ることができます) –
標準のシェルとして実行しているかのようにpythonシェルから 'testset.py'を実行しようとしているようです。 Pythonはすべてをbashのような文字列として扱いません。 –
@KindStrangerどうすればいいですか? –