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

Update Flask to 2.1.1 #3687

Open
ksy36 opened this issue Apr 3, 2022 · 2 comments
Open

Update Flask to 2.1.1 #3687

ksy36 opened this issue Apr 3, 2022 · 2 comments

Comments

@ksy36
Copy link
Contributor

ksy36 commented Apr 3, 2022

There are failing tests in the recent builds: https://app.circleci.com/pipelines/github/webcompat/webcompat.com/1893/workflows/3241893d-f701-43bd-b512-94fe64743ad0/jobs/1894

  if request is None:
>           builder = EnvironBuilder(*args, **kwargs)
E           TypeError: __init__() got an unexpected keyword argument 'as_tuple'

env/lib/python3.9/site-packages/werkzeug/test.py:1081: TypeError

Looks like this is happening because in version 2.1.0, werkzeug has removed the as_tuple argument and this most recent version is installed as a dependency of Flask. Our current version of Flask installed from requirements.txt is 2.0.1 still passes it, therefore the error is thrown.

https://flask.palletsprojects.com/en/2.1.x/changes/#version-2-1-0
The test client’s as_tuple parameter is removed. Use response.request.environ instead.

@ksy36
Copy link
Contributor Author

ksy36 commented Apr 3, 2022

I have actually removed the freezing of version of werkzeug in #3621, but maybe the best would be to bring it back to avoid similar issues in the future.

Also see Karl's #3621 (comment) for more information

@ksy36
Copy link
Contributor Author

ksy36 commented Apr 4, 2022

With the update I'm getting 1 failing test:

_______________________________________________________________________________________________ TestURLs.test_successful_post_new_issue __________________________________________________________________________________________________

self = <tests.unit.test_urls.TestURLs testMethod=test_successful_post_new_issue>, mock_proxy = <MagicMock name='report_issue' id='4515001488'>

    @patch('webcompat.views.report_issue')
    def test_successful_post_new_issue(self, mock_proxy):
        """Test that anonymous post succeeds on /issues/new."""
        webcompat.app.config['ANONYMOUS_REPORTING_ENABLED'] = True
        mock_proxy.return_value = POST_RESPONSE
        rv = self.app.post(
            '/issues/new',
            content_type='multipart/form-data',
            environ_base=headers,
            data=dict(
                browser='Firefox Mobile 45.0',
                description='testing 2971',
                os='macos',
                problem_category='yada',
                submit_type='github-proxy-report',
                url='http://testing.example.org',
                username='yeeha'))
        assert rv.status_code == 302
        print(rv.headers)
>       assert rv.headers['Location'] == 'http://localhost/issues/1544'
E       AssertionError: assert '/issues/1544' == 'http://localhost/issues/1544'
E         - http://localhost/issues/1544
E         + /issues/1544

tests/unit/test_urls.py:78: AssertionError

The test is failing because of this change pallets/werkzeug#2352. Also, the corresponding tests are here https://github.com/pallets/flask/pull/4496/files

This is not affecting the app, just the tests as far as I can tell, but I'll test the reporting on staging just in case :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@ksy36 and others