Skip to content

Commit

Permalink
Fix travis file due to flask dependency change
Browse files Browse the repository at this point in the history
  • Loading branch information
corydolphin committed Aug 30, 2020
1 parent 53e284d commit 6eb9c04
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
20 changes: 7 additions & 13 deletions .travis.yml
Expand Up @@ -7,23 +7,17 @@ python:
- '3.4'
- '3.5'
- '3.6'
- '3.7'
- '3.8'
- pypy

# from https://github.com/travis-ci/travis-ci/issues/9815
# https://github.com/travis-ci/travis-ci/issues/9069#issuecomment-425720905
# Enable 3.7 without globally enabling sudo and dist: xenial for other build jobs
matrix:
include:
- python: 3.7
dist: xenial
sudo: true

env:
- FLASK=0.10.1
- FLASK=0.10

- FLASK=0.10.1 WERKZEUG_DEP="werkzeug==0.16.1"
- FLASK=0.10 WERKZEUG_DEP="werkzeug==0.16.1"
- FLASK=1.0 WERKZEUG_DEP=""
- FLASK=1.1 WERKZEUG_DEP=""
install:
- pip install -U setuptools pep8 six coverage docutils pygments flask==$FLASK
- pip install -U setuptools pep8 six coverage docutils pygments flask==$FLASK $WERKZEUG_DEP

script:
- coverage erase
Expand Down
2 changes: 1 addition & 1 deletion examples/app_based_example.py
Expand Up @@ -124,7 +124,7 @@ def get_exception():
Browsers will first make a preflight request to verify that the resource
allows cross-origin POSTs with a JSON Content-Type, which can be simulated
as:
$ curl --include -X OPTIONS http://127.0.0.1:5000/exception \
$ curl --include -X OPTIONS http://127.0.0.1:5000/api/exception \
--header Access-Control-Request-Method:POST \
--header Access-Control-Request-Headers:Content-Type \
--header Origin:www.examplesite.com
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -33,7 +33,8 @@
platforms='any',
install_requires=install_requires,
tests_require=[
'nose'
'nose',
'packaging'
],
test_suite='nose.collector',
classifiers=[
Expand Down
7 changes: 7 additions & 0 deletions tests/decorator/test_exception_interception.py
Expand Up @@ -8,6 +8,10 @@
:copyright: (c) 2016 by Cory Dolphin.
:license: MIT, see LICENSE for more details.
"""
import unittest

import flask
from packaging import version
from ..base_test import FlaskCorsTestCase
from flask import Flask, abort
from flask_cors import *
Expand Down Expand Up @@ -198,6 +202,9 @@ def get_with_origins(path):
self.assertEqual(resp.status_code, 200)
self.assertFalse(ACL_ORIGIN in resp.headers)

@unittest.skipIf(version.parse(flask.__version__) > version.parse("1.1"),
"Flask 1.1 changed interception behavior, so after request handlers are always run. "
"This obviates the need for our hacky interception")
def test_acl_uncaught_exception_500(self):
'''
Uncaught exceptions will trigger Flask's internal exception
Expand Down
6 changes: 5 additions & 1 deletion tests/extension/test_app_extension.py
Expand Up @@ -204,7 +204,7 @@ class AppExtensionString(FlaskCorsTestCase):
def setUp(self):
self.app = Flask(__name__)
CORS(self.app, resources=r'/api/*',
headers='Content-Type',
allow_headers='Content-Type',
expose_headers='X-Total-Count',
origins='http://bar.com')

Expand All @@ -225,6 +225,10 @@ def overridden():
def index():
return 'Welcome'

@self.app.route('/foo.txt')
def foo_txt():
return 'Welcome'

def test_exposed(self):
for path in '/api/v1/foo', '/api/v1/bar':
for resp in self.iter_responses(path, origin='http://bar.com'):
Expand Down

0 comments on commit 6eb9c04

Please sign in to comment.