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
test_get_brotli failed in whitenoise 4.1.3 #225
Comments
Thanks for reporting this. Are you able to run |
Looks like the description is not accurate - I can reproduce this with 4.1.2 as well, so it should be related to a brotli update. |
Hi, I can't easily reproduce this myself as I don't run Arch. But nothing has changed with respect to our Brotli handling for quite a long time. The last commit which touched anything to do with it was this, which changed the dependency from Is that the commit which causes the probem? |
@evansd FWIW I also found this error in Fedora when attempting to package whitenoise 4.1:
The full logs of the whitenoise build are here: https://koji.fedoraproject.org/koji/taskinfo?taskID=37472344 I'll investigate and try 4.1.3 to see what happens. |
I am able to reproduce the issue on both Fedora and Ubuntu with the following: #!/bin/bash
rm -rf /tmp/test
mkdir -p /tmp/test
python3 -m venv /tmp/test/venv
source /tmp/test/venv/bin/activate
pip install whitenoise
pip install requests
pip install Django
pip install "coverage<4.3"
pip install brotli
git clone https://github.com/evansd/whitenoise /tmp/test/whitenoise
pushd /tmp/test/whitenoise
export DJANGO_SETTINGS_MODULE=tests.django_settings
python3 -m unittest discover
popd However, on these same systems, running the tests from source with tox doesn't return any failures. |
I've isolated the issue to the requests python library. tox installs Line 22 in 5595618
The issue occurs only with the current latest version of requests, 2.22.0. This works: #!/bin/bash
rm -rf /tmp/test
mkdir -p /tmp/test
python3 -m venv /tmp/test/venv
source /tmp/test/venv/bin/activate
pip install whitenoise
pip install "requests==2.21.0"
pip install Django
pip install "coverage<4.3"
pip install brotli
git clone https://github.com/evansd/whitenoise /tmp/test/whitenoise
pushd /tmp/test/whitenoise
export DJANGO_SETTINGS_MODULE=tests.django_settings
python3 -m unittest discover
popd And this doesn't: #!/bin/bash
rm -rf /tmp/test
mkdir -p /tmp/test
python3 -m venv /tmp/test/venv
source /tmp/test/venv/bin/activate
pip install whitenoise
pip install "requests==2.22.0"
pip install Django
pip install "coverage<4.3"
pip install brotli
git clone https://github.com/evansd/whitenoise /tmp/test/whitenoise
pushd /tmp/test/whitenoise
export DJANGO_SETTINGS_MODULE=tests.django_settings
python3 -m unittest discover
popd @evansd do you know what could be happening ? |
@dmsimard Thanks for the excellent issue isolation here. Based on that it was quite easy to figure out. Between v2.21.0 and v2.22.0 In between those version, It should be fairly easy to update the test to handle this. I'll try to do that as soon as I have a minute. |
@evansd great find and thanks for your help. Happy to test an eventual fix to make sure the issue is resolved. |
Newer versions of `requests` depend on an updated version of `urllib3` which transparently decodes Brotli just as it does for gzip. References #225
@dmsimard I've actually had a slight change of heart on this fix. It involves dropping Python 3.4 support for no other reason than the latest version of I wonder if another solution is to just to make the tests easier to run outside of #!/bin/bash
rm -rf /tmp/test
mkdir -p /tmp/test
python3 -m venv /tmp/test/venv
source /tmp/test/venv/bin/activate
git clone https://github.com/evansd/whitenoise /tmp/test/whitenoise
pushd /tmp/test/whitenoise
pip install -r requirements.test.txt
export DJANGO_SETTINGS_MODULE=tests.django_settings
python3 -m unittest discover
popd Would that work for you? |
Works for me. |
@evansd tried a scratch build of the current master branch and the good news is that the brotli error is gone but there's a new one now:
That said, I noticed that the version of requests is still pinned in the test requirements and unpinning it brings back the brotli issue, reproducible with tox. |
That's very odd. Can you provide a link to the full build log which contains that error? As I understood the issue it was just that newer versions of |
@evansd sorry, missed your reply -- I just tried a build off of a forked/tagged 4.1.4 here: https://koji.fedoraproject.org/koji/taskinfo?taskID=37841593 I'm not sure how I ended up with that previous error but it's failing on the brotli thing again:
It's not easily possible for us to pin to an older version of requests in Fedora -- we have just the latest versions available: https://koji.fedoraproject.org/koji/packageinfo?packageID=12446 The alternative would be to disable unit tests during the build but that would be unfortunate as it is a good sanity to check to make sure we haven't messed up somewhere. |
This is to enable running the tests as part of Fedora's build pipeline when packing WhiteNoise. See #225
@dmsimard OK, that makes sense. I've just stuck a conditional in which allows the tests to run under older and newer versions of |
This is to enable running the tests as part of Fedora's build pipeline when packing WhiteNoise. See evansd#225
@evansd works for me, I managed to get a successful scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=37843426 I can submit the updated spec to get the successful build into the distro as soon as 4.1.4 is tagged. Thanks a lot for your help :) |
No problem. Glad it's all working now. Just pushed out the 4.1.4 release. |
v4.1.4 * Make tests more deterministic and easier to run outside of ``tox``. * Fix Fedora packaging `issue <https://github.com/evansd/whitenoise/issues/225>`_. * Use `Black <https://github.com/psf/black>`_ to format all code. v4.1.3 * Fix handling of zero-valued mtimes which can occur when running on some filesystems. * Fix potential path traversal attack while running in autorefresh mode on Windows.
I am getting the following test failures with the new release:
Test environment contains the following Arch Linux x86_64 packages:
The text was updated successfully, but these errors were encountered: