Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem in running a code
#7
(Feb-14-2024, 06:56 AM)akbarza Wrote:
(Feb-13-2024, 10:06 AM)snippsat Wrote: pytest should be used from command line,not at all from any Editor/Ide(even if can get it do work with some effort).
Also as you use Windows get a better terminal sell eg cmder.
[Image: aIdQxC.png]
Make a error,see that if will give full diff of where the error is.
[Image: KHNGcr.png]

please see below:


Output:
D:\Desktop\pythonmorsels_add λ ls __pycache__/ add.py add_functions.py add_solution.pdf akb_add.py hello.py pytest_usage_for_test.py test_add.py D:\Desktop\pythonmorsels_add λ pytest -v -s ==================================================================== test session starts ================================ platform win32 -- Python 3.11.5, pytest-7.4.3, pluggy-1.3.0 -- C:\python_3_11_5\python.exe cachedir: .pytest_cache rootdir: D:\Desktop\pythonmorsels_add plugins: anyio-3.7.1 collected 9 items pytest_usage_for_test.py::test_add[add1-input_matrices0-expected_output0] Running add1 with input [[[5]], [[-2]]]: Output: [[3]] PASSED pytest_usage_for_test.py::test_add[add2-input_matrices1-expected_output1] Running add2 with input [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]: Output: [[6, 8], [10, 12]] PASSED test_add.py::AddTests::test_any_number_of_matrixes XFAIL test_add.py::AddTests::test_different_matrix_size XFAIL test_add.py::AddTests::test_input_unchanged PASSED test_add.py::AddTests::test_single_items PASSED test_add.py::AddTests::test_two_by_three_matrixes PASSED test_add.py::AddTests::test_two_by_two_matrixes PASSED test_add.py::AddTests::test_zreturn_instead_of_print PASSED =============================================================== 7 passed, 2 xfailed in 1.22s ============================
it is ok?
but when in cmder wrote: pytest_usage_for_test.py,again nothing occured.

hi
the running of pytest is strange:
in cmd or cmder, I have to go to the folder where my .py file is there, and then in cmd(or cmder) I have write pytest -v -s to take results. if I call Python file, nothing is displayed
Reply


Messages In This Thread
problem in running a code - by akbarza - Feb-12-2024, 01:29 PM
RE: problem in running a code - by deanhystad - Feb-12-2024, 04:41 PM
RE: problem in running a code - by snippsat - Feb-12-2024, 05:43 PM
RE: problem in running a code - by akbarza - Feb-13-2024, 07:14 AM
RE: problem in running a code - by snippsat - Feb-13-2024, 10:06 AM
RE: problem in running a code - by akbarza - Feb-14-2024, 06:56 AM
RE: problem in running a code - by akbarza - Feb-14-2024, 07:14 AM
RE: problem in running a code - by snippsat - Feb-14-2024, 02:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  writing and running code in vscode without saving it akbarza 1 542 Jan-11-2024, 02:59 PM
Last Post: deanhystad
  the order of running code in a decorator function akbarza 2 686 Nov-10-2023, 08:09 AM
Last Post: akbarza
  Code running many times nad not just one? korenron 4 1,520 Jul-24-2022, 08:12 AM
Last Post: korenron
  Error while running code on VSC maiya 4 4,158 Jul-01-2022, 02:51 PM
Last Post: maiya
  code running for more than an hour now, yet didn't get any result, what should I do? aiden 2 1,684 Apr-06-2022, 03:41 PM
Last Post: Gribouillis
  Why is this Python code running twice? mcva 5 5,615 Feb-02-2022, 10:21 AM
Last Post: mcva
  Python keeps running the old version of the code quest 2 4,066 Jan-20-2022, 07:34 AM
Last Post: ThiefOfTime
  My python code is running very slow on millions of records shantanu97 7 2,813 Dec-28-2021, 11:02 AM
Last Post: Larz60+
  I am getting ValueError from running my code PythonMonkey 0 1,559 Dec-26-2021, 06:14 AM
Last Post: PythonMonkey
  rtmidi problem after running the code x times philipbergwerf 1 2,564 Apr-04-2021, 07:07 PM
Last Post: philipbergwerf

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020