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

Can't verify logs and function output at the same time #145

Open
tmylk opened this issue Aug 20, 2023 · 3 comments
Open

Can't verify logs and function output at the same time #145

tmylk opened this issue Aug 20, 2023 · 3 comments

Comments

@tmylk
Copy link
Contributor

tmylk commented Aug 20, 2023

I tried verify_logging and it doesn't quite work as expected in this scenario. i want a separate output file for logging, and another one for function return

def fizzbuzz(n):
    out_str = "\n".join(map(lambda n: fizzbuzz_single(n), range(1, n)))
    logging.info(f"Fizzbuss log says {out_str}")
    return out_str

def test_fizzbuzz_ten():
    with verify_logging():
        verify(fizzbuzz(10)    )

suggested solution is to have two separate output files - one for logs, one for output. Some kind of NamerFactory

@isidore
Copy link
Member

isidore commented Sep 10, 2023

Would expect test_fizzbuzz_ten.logging.approved.txt in addition test_fizzbuzz_ten.approved.txt

There are two verifies happening and if one fails the test should fail and we would need to indicate why

@isidore
Copy link
Member

isidore commented Sep 10, 2023

@isidore
Copy link
Member

isidore commented Sep 10, 2023

We want this to not be confusing and we know people get confused by when and how to use multiple verifies in a single test. A warning might be helpful, especially if you are attempting to compare against the same file multiple times in one test

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