py.test

    1熱度

    1回答

    我剛將一個pytest測試套件從quickcheck遷移到hypothesis。這工作得很好(並立即發現了一些隱藏的邊緣案例錯誤),但我看到的一個主要區別與兩個物業經理之間的測試隔離有關。 quickcheck似乎只是用不同的參數值多次運行測試函數,每次運行我的函數範圍的燈具。這也導致pytest的輸出中有更多的點。 hypothesis然而,似乎多次運行測試函數的主體,這意味着例如單個運行之間沒

    3熱度

    2回答

    如何導入或以其他方式綁定pytest燈具以供交互使用,而不使用斷點? 例如,我想了解REPL中的tmpdir_factory夾具的一些行爲。 from pytest import tmpdir_factory # note: this doesn't actually work # setup/context has already been entered tmpdir_factory.e

    1熱度

    1回答

    我在用pytest單元測試時遇到困難。 我使用的是測試類是這樣的: class TestMyApp(object): def setup(self): self.client = mock_client() @pytest.fixture def client_item(self): return self.client.create_it

    4熱度

    1回答

    我正在使用pytest編寫一些測試,其中許多測試具有類似的裝置。我想將這些「全局」燈具放在一個文件中,以便它們可以在多個測試文件中重複使用。我首先想到的是要建立一個fixtures.py文件如 import pytest @pytest.fixture() def my_fixture(): # do something 現在我該怎樣在my_tests.py使用夾具? def

    0熱度

    1回答

    我在它周圍創建了一個Python庫和一組Python腳本。這個小腳本的一個例子可能是這樣的rna_ex2x.py: ./rna_ec2x.py usage: rna_ec2x.py [-h] [--sep SEP] [--chain CHAIN] [--ec-pairs] [--ss-pairs SS_PAIRS] [--pairs-delta] intera

    1熱度

    3回答

    我試圖用pytest測試文件解析。我有一個看起來像這樣爲我的項目的目錄樹: project project/ cool_code.py setup.py setup.cfg test/ test_read_files.py test_files/ data_file1.txt data_file

    2熱度

    1回答

    我使用預先創建的postgres數據庫進行測試。在這裏,pytest設置: pytest.ini: [pytest] norecursedirs = frontend static .svn _build tmp* DJANGO_SETTINGS_MODULE = src.settings.testing addopts = --reuse-db testing.py: from .b

    0熱度

    1回答

    我正在編寫一些測試,依靠用戶輸入來決定它們是否已通過。 我有這樣的功能: def viewable(actual_proj): print("\nCan you see %s projects named:\n"%len(actual_proj)) for i in actual_proj: print (i+"\n") return input("(y/

    2熱度

    2回答

    方法 house.py: class House: def is_habitable(self): return True def is_on_the_ground(self): return True conftest.py: import pytest from house import House @pytest.fixture(sc

    0熱度

    3回答

    我有一個conftest文件來處理在pytest中運行測試時selenium驅動程序的安裝和拆卸。我試圖添加一個命令行選項來確定我是否運行本地內置的硒和Web驅動程序或遠程硒服務器和驅動程序等... 我已經添加了一個名爲「runenv」的命令行選項我試圖通過命令行輸入字符串值來確定系統是否應該運行本地或遠程webdriver配置。這使得測試人員可以在本地開發自己的機器,但也意味着我們可以將測試編寫