-
Notifications
You must be signed in to change notification settings - Fork 188
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
Turn as many tests into unittests as possible #52
Comments
As I said, I will try to work on it. |
As noted in #121, I have started porting scripts under
Aside from that, I have configured |
That's great! Thanks for working on this. For 1 you can use pytest fixtures. For 2 you can use threads, and send signals to the server process. Or you can wrap a I think the Python coverage tool works well with multiple processes or threads |
Signed-off-by: Oleg Höfling <[email protected]>
I'm not sure if I can use threads - I can only send signals to the main thread, not to spawned ones. As for the suggestion with piping data between processes - great suggestion, thanks! This what I used in the end. I hadn't any success with As for the I think I'm ready for the initial unit tests proposal (#164). It would be awesome if you find time to look at this! I tried to port the test scripts as close to the original code as possible, but had to improvise at some spots. Also, I'm interested in your opinion about the def test_fizz(httpclient):
def app(e, s):
s('200 ok', [])
return b'hello world'
httpclient.host = '0.0.0.0' # optional configuration
httpclient.start(app) # server is started in another process
response = httpclient.get()
response.raise_for_status() The server is queried for errors on each request, so assertions in app function are possible: def test_buzz(httpclient):
def app(e, s):
s('200 ok', [])
value = env['foo'] # 'foo' not available in env
return b'hello world'
httpclient.start(app)
with pytest.raises(KeyError):
httpclient.get() Also, each test using the To execute the tests locally, the easiest way is to use Another thing - if you take a look at the latest test run on Travis, you will notice that some tests fail with Python 2.7, but pass with Python 3.X - this is because the trailing whitespaces in headers are not stripped with |
Sidenote: I'd suggest consider |
Please don't waste your time on coming up with a PR unless we have discussed and agreed on that beforehand. I have no plans to move away from tox at the moment |
No description provided.
The text was updated successfully, but these errors were encountered: