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

Support to capture "===Flaky Test Report===" content in order to dump it in multiple log streams #174

Open
tarunmudgal opened this issue Jan 30, 2021 · 1 comment

Comments

@tarunmudgal
Copy link

Currently there is no way to read ===Flaky Test Report=== details through any hook or fixture. There is a need to read this test report and write it to different loggers e.g. log files, error files

===Flaky Test Report===
test_example1 passed 1 out of the required 1 times. Success!
test_example2 failed (1 runs remaining out of 2).
        <class 'AssertionError'>
        assert 0 == 1
  +0
  -1
        [<TracebackEntry /Users/mtarun/tests/test_dummy.py:51>]
test_example2 failed; it passed 0 out of the required 1 times.
        <class 'AssertionError'>
        assert 0 == 1
  +0
  -1
        [<TracebackEntry /Users/mtarun/tests/test_dummy.py:51>]

===End Flaky Test Report===

@adiroiban
Copy link

It looks like nose is loading the tests before loading the plugins... so you can monkey patch the code

def patch_add_flaky_report(self, stream):
    """
    Patch flaky reporting to also write the output to a file.
    """
    original_add_flaky_report(self, stream)
    with open('flaky-report.txt', 'w') as output:
        original_add_flaky_report(self, output)

original_add_flaky_report = FlakyPlugin._add_flaky_report
FlakyPlugin._add_flaky_report = patch_add_flaky_report

Maybe add a ``--flaky-report-file=path/to/file` configuration

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

No branches or pull requests

2 participants