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

Allow custom parameters to pytest.main #21

Closed
stappersg opened this issue Jan 8, 2023 · 7 comments
Closed

Allow custom parameters to pytest.main #21

stappersg opened this issue Jan 8, 2023 · 7 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@stappersg
Copy link
Contributor

stappersg commented Jan 8, 2023

Good stuff, thanks for your contribution. Now that the integration tests are working, a new test case covering this new endpoint will be ideal.

Originally posted by @raul-te in #18 (comment)

@stappersg
Copy link
Contributor Author

Despite having

--- a/Makefile
+++ b/Makefile
@@ -19,8 +19,8 @@ shoelaces.8:
 docs: shoelaces.8
 
 test: fmt
-               $(GO) test -v $(pkgs) && \
-                       ./test/integ-test/integ_test.py
+               $(GO) test -vv $(pkgs) && \
+                       ./test/integ-test/integ_test.py -vv
 
 .PHONY: all clean docs
 

so -vv at two places, I keep getting

=============================================== FAILURES ================================================
________________________________ test_request_response[/start-start.txt] ________________________________

shoelaces_instance = <Popen: returncode: None args: ['/usr/src/github/shoelaces/shoelaces', '-con...>
request_path = '/start', response_file = 'start.txt'

    @pytest.mark.parametrize(("request_path", "response_file"), REQUEST_RESPONSE_PAIRS)
    def test_request_response(shoelaces_instance, request_path, response_file):
        with open(os.path.join(FIXTURE_DIR, response_file)) as response_body:
>           assert requests.get(
                API_URL + request_path).text == response_body.read()
E           AssertionError: assert '#!ipxe\necho...ll receive.\n' == '#!ipxe\necho...ll receive.\n'
E               #!ipxe
E               echo Shoelaces starts polling
E               chain --autofree --replace \
E                   http://localhost:18888/poll/1/${netX/mac:hexhyp}
E               #
E               #
E               # Do...
E             
E             ...Full output truncated (5 lines hidden), use '-vv' to show

/usr/src/github/shoelaces/test/integ-test/integ_test.py:116: AssertionError
----------------------------------------- Captured stdout call ------------------------------------------
ts=2023-01-08T17:49:37.517846401Z caller=server.go:2109 level=info component=http type=request src=127.0.0.1:57620 method=GET url=/start
======================================== short test summary info ========================================
FAILED test/integ-test/integ_test.py::test_request_response[/start-start.txt] - AssertionError: assert...
===================================== 1 failed, 34 passed in 0.35s ======================================

Repeating the

E             ...Full output truncated (5 lines hidden), use '-vv' to show

Where to add the -vv?

@stappersg stappersg changed the title a new test case a new test case and -vv Jan 8, 2023
@stappersg
Copy link
Contributor Author

The problem of "Where to add the -vv?" can been seen with either #22 or #23.

@raul-te
Copy link
Contributor

raul-te commented Jan 9, 2023

The parameters to pytest.main are hardcoded:

if __name__ == "__main__":
    pytest.main(args=['-v'], plugins=None)

Ideally, would like to support custom parameters to have the flexibility of choosing either -v or -vv.

@raul-te raul-te changed the title a new test case and -vv Allow custom parameters to pytest.main Jan 9, 2023
@raul-te raul-te added enhancement New feature or request good first issue Good for newcomers labels Jan 9, 2023
@stappersg
Copy link
Contributor Author

Where to add the -vv?

The parameters to pytest.main are hardcoded:

if __name__ == "__main__":
    pytest.main(args=['-v'], plugins=None)

Ideally, would like to support custom parameters to have the flexibility of choosing either -v or -vv.

There is now #26.

@raul-te
Copy link
Contributor

raul-te commented Jan 17, 2023

I think we will benefit if we add support for passing custom parameters to integ_test.py. Let me know if you're interested in implementing this feature.

We should leave the issue open until the feature reaches master.

@stappersg
Copy link
Contributor Author

stappersg commented Jan 17, 2023 via email

@stappersg
Copy link
Contributor Author

I did not create this issue with subject "Allow custom parameters to pytest.main"
and I don't like the opened by me in the overview.

image

So now another close attempt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants