Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle case when test reports are missing timestamp and file #6

Merged
merged 1 commit into from
Nov 29, 2024

Conversation

vmilosevic
Copy link
Contributor

Handle case when test reports are missing timestamp and file

  • use parsing time
  • use empty file name
    Also:
  • download artifacts with "report" in name
  • skip downloading the logs

Copy link

Coverage

Coverage Report
FileStmtsMissCoverMissing
src
   cicd.py64395%85–87
   generate_data.py19668%32–44
   pydantic_models.py560100% 
   test_parser.py13285%28–29
   utils.py94397%97, 150–153
src/parsers
   junit_xml_utils.py47687%85–89, 93–97
   parser.py10280%23, 33
   python_pytest_parser.py68691%18, 51, 54, 80, 130–131
   python_unittest_parser.py550100% 
TOTAL4262893% 

Tests Skipped Failures Errors Time
3 0 💤 0 ❌ 0 🔥 0.419s ⏱️

@vmilosevic vmilosevic merged commit eea8fd5 into main Nov 29, 2024
2 checks passed
@jsjtadie
Copy link

When dealing with test reports in Python that lack a timestamp and file information, you can take the following steps.

Adding Timestamp

You can use the  datetime  module to add a timestamp to the test report. For example:

import datetime

timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
 

Then, insert this timestamp into the appropriate place in your test report, such as in the report header or metadata section.

Adding File Information

To include file information, you need to determine which files are relevant to the test. If it's about test scripts themselves, you can use the  file  attribute in Python. For example, if you want to record the name of the test script file in the report:

import os

test_file_name = os.path.basename(file)
 

This will give you the name of the current Python file. You can then append this information to the test report at a suitable location, making it more comprehensive and traceable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants