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
  Updating sharepoint excel file odd results cubangt 1 752 Nov-03-2023, 05:13 PM
Last Post: noisefloor
  Pytest Installed, but VS Code Won’t Access Pytest AstralWeeks 9 2,874 Sep-13-2023, 03:00 PM
Last Post: AstralWeeks
  Pytest mocks anthonyrmoss78 0 426 May-30-2023, 08:28 PM
Last Post: anthonyrmoss78
  Trying to send file to printer with no results. chob_thomas 2 3,258 Dec-21-2022, 07:12 AM
Last Post: Pedroski55
  Writing string to file results in one character per line RB76SFJPsJJDu3bMnwYM 4 1,305 Sep-27-2022, 01:38 PM
Last Post: buran
  [split] Results of this program in an excel file eisamabodian 1 1,543 Feb-11-2022, 03:18 PM
Last Post: snippsat
  How to save some results in .txt file with Python? Melcu54 4 7,230 May-26-2021, 08:15 AM
Last Post: snippsat
  Running A Parser In VSCode - And Write The Results Into A Csv-File apollo 5 4,533 Jan-14-2021, 08:58 PM
Last Post: snippsat
  Unable to capture all images of a multipage TIFF file in a merge bendersbender 0 2,174 Nov-19-2020, 03:09 PM
Last Post: bendersbender
  Writing unit test results into a text file ateestructural 3 4,653 Nov-15-2020, 05:41 PM
Last Post: ateestructural

Forum Jump:

User Panel Messages

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