pytest-cache.PY.TEST Ç÷¯±×ÀÎ Å×½ºÆ®¸¦ °¡·Î Áö¸£´Â ij½ÌÀ»À§ÇÑ ¸ÞÄ¿´ÏÁòÀÌÀÖ´Â | |
Áö±Ý ´Ù¿î·Îµå |
pytest-cache. ¼øÀ§ ¹× ¿ä¾à
±¤°í
pytest-cache. ű×
pytest-cache. ¼³¸í
pytest-cache´Â Test RunÀ» °¡·Î Áö¸£´Â ¸ÞÄ¿´ÏÁòÀÌÀÖ´Â Py.test Ç÷¯±×ÀÎÀÔ´Ï´Ù. PIP´Â Py.test È£Ãâ°£¿¡ °ªÀ» °øÀ¯ÇÏ´Â µ¥ µµ¿òÀ̵Ǵ ´Ù¸¥ Ç÷¯±×ÀÎÀÌ »õ Config.cache °³Ã¼¿¡ ¾×¼¼½º ÇÒ ¼öÀÖ´Â PIP ¼³Ä¡ÀÔ´Ï´Ù. Ç÷¯±×Àεµ ¼Ò°³ÇÕ´Ï´Ù. ¸¶Áö¸·À¸·Î ½ÇÆÐÇÑ Å×½ºÆ®¸¦ ´Ù½Ã ½ÇÇàÇÏ´Â »õ·Î¿î -lf ¿É¼Ç°ú Å×½ºÆ® ½ÇÇຸ´Ù ¾Õ¼ ij½Ã ³»¿ëÀ» Á¦°ÅÇϱâ À§ÇØ --clearcache ¿É¼ÇÀ» Àç½ÇÇàÇϽʽÿÀ. »õ·Î¿î --lf (¸¶Áö¸· ½ÇÆÐÇÑ) ¿É¼ÇÀ» ¼±ÅÃÇϽʽÿÀ. ÀÌÀü Å×½ºÆ® ½ÇÇàÀÇ ¸ðµç Å×½ºÆ® ½ÇÆи¦ ´Ù½Ã ½ÇÇàÇÏ´Â ¹æ¹ýÀ» Å×½ºÆ®ÇÕ´Ï´Ù. Å×½ºÆ®°¡ ½ÇÆÐÇÏÁö ¾ÊÀ¸¸é ¸ðµç Å×½ºÆ®°¡ Á¤»óÀ¸·Î ½ÇÇàµË´Ï´Ù. µû¶ó¼ Ç×»ó -lf.as¸¦ Ç×»ó Åë°úÇÏ´Â °ÍÀÌ ÁÁ½À´Ï´Ù. ¿¹¸¦ µé¾î 50 °³ÀÇ Å×½ºÆ® È£Ãâ ¸¸ »ý¼ºÇÕ´Ï´Ù. # Test_50.pyimport pytest@pytest.mark.parametrize ( "I"¹üÀ§ (50)ÀÇ ³»¿ë). def test_num (i) : i-25¿¡ÀÖ´Â °æ¿ì (17,25) : pytest.fail ( "bad luck") óÀ½ À¸·ÎÀÌ ÀÛ¾÷À» ½ÇÇàÇÏ¸é µÎ °¡Áö ½ÇÆи¦ º¼ ¼ö ÀÖ½À´Ï´Ù : $ py.test -qCollecting ... ¼öÁý µÈ 50 Ç׸ñ ................................................ ======================= ½ÇÆÐ ===============. ================ _______________________________ test_num _______________________________i = 17 @ pytest.mark.ParametRize ( "i", ¹üÀ§ (50)) DEF TEST_NUM (i) : i (17,25) :> pytest.fail ( "bad luck") e ½ÇÆÐ : bad lucktest_50.py:6 : ½ÇÆÐ _______________________________ test_num _______________________________i = 25 @ pytest.mark.ParametRize ( "i", ¹üÀ§ (50)) DEF TEST_NUM (i) : i IN (17,25) :> pytest.fail ( "bad luck") ´ç½ÅÀº T¸¦ ´Ù½Ã ½ÇÇàÇÒ °ÍÀÔ´Ï´Ù ±×´Â ¸¶Áö¸· µÎ ½ÇÆÐ : $ py.test -q --lfcollecting ... ¼öÁý µÈ 50 itemsff ============================================================================================================================== === FAILURES ================================= _______________________________ test_num = 17 _______________________________i @ pytest.mark. parametrize ( "i", ¹üÀ§ (50)) def test_num (i) : i-inter (17,25) :> pytest.fail ( "bad luck") e ½ÇÆÐ : bad lucktest_50.py:6 : failed _______________________________ test_num _______________________________i = 25 @ pytest.mark.ParametRize ( "I", ¹üÀ§ (50)) DEF TEST_NUM (i) : IN (17,25) :> pytest.fail ( "ºÒ¿î") e ½ÇÆÐ : Bad LuckTest_50 .py : 6 : ½ÇÆÐ ==================================================================== =========== 2 Failed, 48 ¸¶Áö¸· ÁÙ¿¡¼ 48ÀÇ ¼±Åà Ãë¼ÒµÊ 48 Å×½ºÆ®°¡ ½ÇÇàµÇÁö ¾Ê¾Ò À½À» ³ªÅ¸³À´Ï´Ù. »õ Config.cache objectPlugins ¶Ç´Â conftest.py Áö¿ø ÄÚµå´Â pytest¸¦ »ç¿ëÇÏ¿© ij½Ã µÈ °ªÀ» ¾òÀ» ¼ö ÀÖ½À´Ï´Ù. ±¸¼º °´Ã¼. ´ÙÀ½Àº Py.test È£Ãâ¿¡¼ ÀÌÀü¿¡ »ý¼º µÈ »óŸ¦ ´Ù½Ã »ç¿ëÇÏ´Â Funcarg¸¦ ±¸ÇöÇÏ´Â ±âº» ¿¹Á¦ Ç÷¯±×ÀÎÀÔ´Ï´Ù. # test_caching.pyimport timedef pytest_funcarg__mydata (¿äû) : val = request.config.cache.get ( "¿¹Á¦ / °ª" , ¾øÀ½) valÀÌ noneÀÔ´Ï´Ù : time.sleep (9 * 0.6) # °ª ºñ½Ñ °è»ê :) val = 42 request.config.cache.set ( "¿¹Á¦ / °ª", val) return valdef test_function (mydata) : assert mydata = = 23If ´ç½ÅÀºÀÌ ¶§¹®¿¡ ÀáÀÌ Á» °É¸± °ÍÀÔ´Ï´Ù, ÀÏ´ÜÀÌ ¸í·ÉÀ» ½ÇÇà : $ py.test -qcollecting ... 1 itemsF ¼öÁý ==================== ============ ½ÇÆÐ ============================================ ______________________________ TEST_FUNCTION _______________________________MYDATA. = 42 DEF TEST_FUNCTION (MYDATA) :> ASSERT MYDATA == 23E ASSERT 42 == 23TEST_CACHING.PY:12 : ASSERTIONERROR15.43 ÃÊ¿¡ ½ÇÆÐÇÑ °æ¿ì °¡Ä¡°¡ ij½Ã¿¡¼ °Ë»ö µÉ °ªÀ» µÎ ¹ø°·Î ½ÇÇàÇÏ¸ç ºü¸£°Ô °ªÀÌ ºü¸¨´Ï´Ù. Py.Test -qCollecting ... ¼öÁý µÈ 1 itemsf ============================= == FAILURES ================================= ______________________________ test_function _______________________________mydata = 42 µ¥ÇÁ test_function (MyData·Î)> ¾î¼³ÀÇ MyData == 23E Assert 42 == 23test_caching.py:12 : AssertionError1Àº 0.02 SecondSconsult¿¡ ½ÇÆÐÇß½À´Ï´Ù. ÀÚ¼¼ÇÑ ³»¿ëÀº PyTest-Cache API¸¦ »ç¿ëÇÏÁö ¸øÇß½À´Ï´Ù. Cache ContentYou´Â Ç×»ó --cache ¸í·É ÁÙ ¿É¼ÇÀ» »ç¿ëÇÏ¿© ij½ÃÀÇ ³»¿ë¿¡¼ Ç×»ó PEEK¸¦ ¿³º¼ ¼ö ÀÖ½À´Ï´Ù. .test --cache =========================== Å×½ºÆ® ¼¼¼ÇÀÌ ½ÃÀÛ =============== ============ Platform Linux2 - Python 2.7.3 - pytest-2.2.5.dev2cachedir : /home/hpk/tmp/doc-exec-257/.cache --------------------------- ij½Ã °ª -------------------- --------- ij½Ã / LastFailed Æ÷ÇÔ : ¼³Á¤ ( Æ÷ÇÔ : 42 ========= ============= 0.01 ÃÊ ============================= Áö¿ì±â ij½Ã contentYouÀº Áö½Ã ÇÒ ¼ö ÀÖ½À´Ï´Ù pytest´Â ´ÙÀ½°ú °°ÀÌ --clearcache ¿É¼ÇÀ» Ãß°¡ÇÏ¿© ¸ðµç ij½Ã ÆÄÀÏ°ú °ªÀ» Áö¿ì·Á¸é ´ÙÀ½À» ¼öÇàÇÕ´Ï´Ù. py.test --clearcachethis´Â RECOÀÔ´Ï´Ù. ½ºÇǵ庸´Ù °í¸³ ¹× Á¤È®¼ºÀÌ ´õ Áß¿äÇÑ Áö¼ÓÀûÀÎ ÅëÇÕ ¼¹öÀÇ È£ÃâÀ» À§ÇØ mmended. Á¦Ç°ÀÇ È¨ÆäÀÌÁö
pytest-cache. °ü·Ã ¼ÒÇÁÆ®¿þ¾î