Pylons / waitress

Waitress - A WSGI server for Python 3
https://docs.pylonsproject.org/projects/waitress/en/latest/
Other
1.44k stars 164 forks source link

test_gardenpath fails on OpenIndiana #395

Closed mtelka closed 1 year ago

mtelka commented 1 year ago

The test_gardenpath test fails on OpenIndiana because the string returned from strerror() is implementation specific.

Simple test case in C:

#include <stdio.h>
#include <string.h>
#include <errno.h>

int main(void)
{
        printf("%s\n", strerror(EPERM));
        return 0;
}

On linux it prints: Operation not permitted, but on OpenIndiana (and thus on all illumos based distros, and likely Solaris too) it prints: Not owner.

Here is the test failure:

________________________ Test__strerror.test_gardenpath ________________________

self = <tests.test_wasyncore.Test__strerror testMethod=test_gardenpath>

    def test_gardenpath(self):
>       self.assertEqual(self._callFUT(1), "Operation not permitted")

tests/test_wasyncore.py:1199:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.9/vendor-packages/teamcity/diff_tools.py:33: in _patched_equals
    old(self, first, second, msg)
E   AssertionError: 'Not owner' != 'Operation not permitted'
E   - Not owner
E   + Operation not permitted
digitalresistor commented 1 year ago

I wonder if the original test suite ever passed on OpenIndiana as asyncore was vendored from Python when they dropped support for it.

mtelka commented 1 year ago

All tests pass with both Python 3.7 and 3.9 when I replace Operation not permitted by Not owner in test_wasyncore.py (see https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/python/waitress/patches/02-test_gardenpath.patch)

digitalresistor commented 1 year ago

@mtelka sure, I get that changing the test works.

My question is how did the Python 3.5 test suite pass on OpenIndiana? wasyncore is directly vendoring asyncore as it was shipped with Python 3.5 including all tests.

mtelka commented 1 year ago

I'm not sure I fully understand your question because both Python-3.5.10/Lib/test/test_asyncore.py and waitress-2.1.2/tests/test_wasyncore.py files differs significantly. For example, there is no class Test__strerror in Python-3.5.10/Lib/test/test_asyncore.py.

digitalresistor commented 1 year ago

I thought that when it was vendored it was from the 3.5 branch of Python, I wonder where @mcdonc stole it from instead. I can add a patch, unfortunately I don't have a machine to test on and it won't be tested in CI either, so there may be other regressions.

digitalresistor commented 1 year ago

Looks like @mcdonc made that test up as the original code is not tested in cpython. I'm changing the test a little bit which should help make it pass on all platforms.