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

Random port assignment doesn't work #132

Open
kbalonek opened this issue Feb 11, 2019 · 0 comments
Open

Random port assignment doesn't work #132

kbalonek opened this issue Feb 11, 2019 · 0 comments

Comments

@kbalonek
Copy link

kbalonek commented Feb 11, 2019

I tried using the "Dynamic LiveServerTestCase port" feature as described in the docs. I am setting the LIVESERVER_PORT setting to 0 but the test server always falls back to flask default, port 5000. This failing python2 test case illustrates this:

from urllib2 import urlopen
from flask import Flask
from flask_testing import LiveServerTestCase

class MyTest(LiveServerTestCase):

    def create_app(self):
        app = Flask(__name__)
        app.config['TESTING'] = True
        # Default port is 5000
        app.config['LIVESERVER_PORT'] = 0
        # Default timeout is 5 seconds
        app.config['LIVESERVER_TIMEOUT'] = 10
        return app

    def test_server_doesnt_use_flask_default_port(self):
        self.assertNotEqual(self.get_server_url(), 'http://localhost:5000')
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

1 participant