test_assert_with_last_unmatched_request fails on Fedora
ignatenkobrain opened this issue · comments
---- test_assert_with_last_unmatched_request stdout ----
thread 'test_assert_with_last_unmatched_request' panicked at '
> Expected 1 request(s) to:
GET /hello
...but received 0
> The last unmatched request was:
GET /bye
> Difference:
GET /hello
GET /bye
', src/lib.rs:1045:44
note: panic did not contain expected string
panic message: `"\n> Expected 1 request(s) to:\n\r\nGET /hello\r\n\n...but received 0\n\n> The last unmatched request was:\n\r\nGET /bye\r\n\n> Difference:\n\nGET /hello\nGET /bye\n\n\n"`,
expected substring: `"\n> Expected 1 request(s) to:\n\r\nGET /hello\r\n\n...but received 0\n\n> The last unmatched request was:\n\r\nGET /bye\r\n\n> Difference:\n\n\u{1b}[31mGET /hello\u{1b}[0m\n\u{1b}[32mGET\u{1b}[0m \u{1b}[42;37m/bye\u{1b}[0m\n\n\n"`
---- test_assert_with_last_unmatched_request_and_headers stdout ----
thread 'test_assert_with_last_unmatched_request_and_headers' panicked at '
> Expected 1 request(s) to:
GET /hello
...but received 0
> The last unmatched request was:
GET /bye
authorization: 1234
accept: text
> Difference:
GET /hello
GET /bye
authorization: 1234
accept: text
', src/lib.rs:1045:44
note: panic did not contain expected string
panic message: `"\n> Expected 1 request(s) to:\n\r\nGET /hello\r\n\n...but received 0\n\n> The last unmatched request was:\n\r\nGET /bye\r\nauthorization: 1234\r\naccept: text\r\n\n> Difference:\n\nGET /hello\nGET /bye\nauthorization: 1234\naccept: text\n\n\n"`,
expected substring: `"\n> Expected 1 request(s) to:\n\r\nGET /hello\r\n\n...but received 0\n\n> The last unmatched request was:\n\r\nGET /bye\r\nauthorization: 1234\r\naccept: text\r\n\n> Difference:\n\n\u{1b}[31mGET /hello\u{1b}[0m\n\u{1b}[32mGET\u{1b}[0m \u{1b}[42;37m/bye\nauthorization: 1234\naccept: text\u{1b}[0m\n\n\n"`
failures:
test_assert_with_last_unmatched_request
test_assert_with_last_unmatched_request_and_headers
I originally saw this both on openSUSE and Fedora with 0.22, so today I was updating mockito and found that it still happens on 0.23.1.
I can't reproduce this on my laptop, but can easily reproduce this in Fedora/openSUSE build infrastructure.
Let me know any details you need.
@ignatenkobrain could be the colors. does the environment you're running the tests in support colors? can you enable this?
otherwise try running cargo test --no-default-features
instead. this command disables the color codes, which is also how I'm running the Windows tests.
It doesn't get tty, so no colors I guess. Would it be possible to check if terminal supports colors and skip the tests if not?
@ignatenkobrain not sure Rust provides compiler flags for that. if you have any ideas let me know but as mentioned earlier, just run your tests with cargo test --no-default-features
, which disables the colour tests (the test cases are still covered, just the colors won't be checked). let me know if we can close this.
Thanks!