Python Forum
capture pytest results to a file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
capture pytest results to a file
#1
Hi,

my_test.py::test_001_mytest PASSED                                               [ 50%]
my_test.py::test_002_mytest PASSED                                               [100%]

=========================================== 2 passed in 35.24s ===========================================
how to capture these pytest results to a file along with the stdout. Thanks for the suggestion.

Regards,
Maiya
Reply
#2
(Oct-16-2020, 12:44 PM)maiya Wrote: Hi,

my_test.py::test_001_mytest PASSED                                               [ 50%]
my_test.py::test_002_mytest PASSED                                               [100%]

=========================================== 2 passed in 35.24s ===========================================
how to capture these pytest results to a file along with the stdout. Thanks for the suggestion.

Regards,
Maiya

I would type something like this in CMD (shell):
pytest >>results_test.txt

The results will be saved in the txt file
Reply
#3
Quote:
(Oct-16-2020, 02:21 PM)Askic Wrote:
(Oct-16-2020, 12:44 PM)maiya Wrote: Hi,

my_test.py::test_001_mytest PASSED                                               [ 50%]
my_test.py::test_002_mytest PASSED                                               [100%]

=========================================== 2 passed in 35.24s ===========================================
how to capture these pytest results to a file along with the stdout. Thanks for the suggestion.

Regards,
Maiya

I would type something like this in CMD (shell):
pytest >>results_test.txt

The results will be saved in the txt file
Hi,
Thanks for your quick reply, however am looking for the pythonic way of doing it. since shell redirect or even using 'tee' command to redirect and display on stdout may not be looks good since it may not be colorized the output result of PASSED/FAILED.

If any suggestion or hint about the pythonic way of approach would be much appreciated. Thanks a lot.

Regards,
Maiya
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to save some results in .txt file with Python? Melcu54 4 2,380 May-26-2021, 08:15 AM
Last Post: snippsat
  Running A Parser In VSCode - And Write The Results Into A Csv-File apollo 5 1,871 Jan-14-2021, 08:58 PM
Last Post: snippsat
  Unable to capture all images of a multipage TIFF file in a merge bendersbender 0 947 Nov-19-2020, 03:09 PM
Last Post: bendersbender
  Writing unit test results into a text file ateestructural 3 1,500 Nov-15-2020, 05:41 PM
Last Post: ateestructural
  Search Results Web results Printing the number of days in a given month and year afefDXCTN 1 927 Aug-21-2020, 12:20 PM
Last Post: DeaD_EyE
  Pytest and rootdirectory Master_Sergius 4 1,355 Jun-01-2020, 05:05 PM
Last Post: Master_Sergius
  How to append one function1 results to function2 results SriRajesh 5 1,513 Jan-02-2020, 12:11 PM
Last Post: Killertjuh
  capture next block of text after finding error in file kdefilip2 6 1,635 Nov-27-2019, 07:36 PM
Last Post: buran
  Pytest with requests a21250450 3 1,614 Mar-21-2019, 03:24 PM
Last Post: buran
  append my results to a file clarablanes 9 3,021 Nov-23-2018, 10:38 PM
Last Post: clarablanes

Forum Jump:

User Panel Messages

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