Closed mdublin closed 8 years ago
What's the output of pip freeze
in the context of your virtual environment?
I updated Selenium in an attempt to fix the issue, but it didn't change anything. I did have a 2.4 version installed prior.
alembic==0.8.4
amqp==1.4.9
anyjson==0.3.3
astroid==1.4.5
autopep8==1.2.1
awscli==1.10.32
billiard==3.3.0.22
blinker==1.4
boto3==1.3.1
botocore==1.4.22
boxsdk==1.5.3
celery==3.1.20
cffi==1.8.2
click==6.6
colorama==0.3.3
cov-core==1.15.0
coverage==3.7.1
cryptography==1.5
cssmin==0.2.0
Django==1.10
docutils==0.12
dominate==2.2.0
enum34==1.1.6
env==0.1.0
feedparser==5.2.1
flake8==2.4.0
Flask==0.10.1
Flask-Assets==0.10
Flask-BasicAuth==0.2.0
Flask-Bootstrap==3.3.5.7
Flask-Cache==0.13.1
Flask-DebugToolbar==0.10.0
Flask-HTTPAuth==3.1.2
Flask-Login==0.3.2
Flask-Migrate==1.7.0
Flask-Restless==0.13.1
Flask-Script==2.0.5
Flask-Session==0.2.3
Flask-SQLAlchemy==2.1
Flask-WTF==0.12
futures==3.0.5
gunicorn==19.4.5
httplib2==0.9.2
idna==2.1
ipaddress==1.0.17
itsdangerous==0.24
Jinja2==2.8
jmespath==0.9.0
jsmin==2.1.1
kombu==3.0.33
lazy-object-proxy==1.2.2
mailthon==0.1.1
Mako==1.0.3
manhole==1.3.0
MarkupSafe==0.23
mccabe==0.3
mimerender==0.5.4
mistune==0.7.1
mysql==0.0.1
mysql-connector-python-cext==2.1.3
MySQL-python==1.2.5
oauth2client==2.2.0
oauthlib==1.1.2
passlib==1.6.5
pep8==1.5.7
psycopg2==2.6.1
py==1.4.31
py-mysql2pgsql==0.1.5
pyasn1==0.1.9
pyasn1-modules==0.0.8
pycparser==2.14
pyflakes==0.8.1
PyJWT==1.4.2
pylint==1.5.5
pytest==2.7.0
pytest-cov==1.8.1
python-dateutil==2.1
python-editor==0.5
python-mimeparse==0.1.4
pytz==2015.7
PyYAML==3.11
rauth==0.7.2
requests==2.11.1
requests-oauthlib==0.6.2
requests-toolbelt==0.7.0
requirements==0.1
rsa==3.3
s3transfer==0.0.1
selenium==2.53.6
six==1.10.0
splinter==0.7.4
SQLAlchemy==1.0.14
termcolor==1.1.0
vboxapi==1.0
virtualenv==13.1.2
visitor==0.1.2
webassets==0.11.1
Werkzeug==0.10.4
whitenoise==3.0
wrapt==1.10.8
WTForms==2.1
I can't reproduce the problem here. I tested Python 2.7 and 3.5 with Chrome 53. I used the versions in the requirements.txt of this repo, which are now a bit old, and also the versions that you have in your virtualenv.
Can I ask you to clone a clean copy of the project, make a new virtualenv and try it there? Maybe there is something in your project that causes the server to hang on exit?
Thanks Miguel, I will try that now. Just to be clear, the procedure to run the Selenium test doesn't require me to first start the server manually via $ python manage.py run
in testing mode, and THEN kick off the tests with $ python mange.py test --coverage
? Instead, I'm just running$ python manage.py test --coverage
?
Correct. All you need to do is run the tests, the server starts and stops on its own.
Realized that app.run() defaults to port 5000, whereas I had set my project to run 0.0.0.0:8080, stupid mistake but completely explains why kicking off the server via the threading line wasn't working properly.
(running project with python 2.7, Flask 0.10, Mac OSX 10.10.5, Chrome Version 52.0.2743.82 (64-bit))
With the addition of
test_selenium.py
totests
run with Unittest and Coverage, the selenium test seems to execute properly, browser opens (using Chrome driver here because the current code does not work with Firefox 49.0.1), etc, and the Flask server is started in testing mode and is shutdown with a GET request in the test to the shutdown endpoint, however the terminal window thatpython manage.py test --coverage
was executed in just hangs afterRan 10 tests in 6.00s
and doesn't close/return to the shell prompt. Only way to release process is to kill viakill [PID]
.Using PyVmMonitor, it appears that the hanging process is indeed associated with the test (this is also confirmed with
pgrep -lf python
), but specifically line 340 in threading.py file and line 155 in SocketServer.py are identified as connected to the hanging process.My initial interpretation from pages 205-206 is that you have to run
$ python manage.py run
(after you've done$ export FLASK_CONFIG='testing'
and THEN you run your tests in another shell in the same virtualenv activated environment with$ python manage.py test --coverage
, but that's when things fail/hang as described above.But after re-reading, perhaps the procedure is to just let the line
threading.Thread(target=cls.app.run).start()
and you don't manually start the server? But this fails as well, with the same process hang.However, if I comment out
threading.Thread(target=cls.app.run).start()
and manually start the server, the test runs perfectly and there is no process hang, tests exists and returns me to shell prompt with no issue.What's the intended correct procedure here?