locustio / locust

Write scalable load tests in plain Python 🚗💨
https://locust.cloud
MIT License
25.06k stars 2.99k forks source link

make test is failing on 0.7 tags due to Flask 0.12 #637

Closed AmineChikhaoui closed 7 years ago

AmineChikhaoui commented 7 years ago

running make test on all tags of version 0.7 fails during the tests due to the Flask version Note that setting Flask to 0.10.1 fixes the issue.

test_wrong_url (locust.test.test_client.TestHttpSession) ... ok

======================================================================
FAIL: test_request_stats_no_content_length (locust.test.test_stats.TestRequestStatsWithWebserver)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/aminechikhaoui/work/locust/locust/test/test_stats.py", line 136, in test_request_stats_no_content_length
    self.assertEqual(global_stats.get(path, "GET").avg_content_length, len("This response does not have content-length in the header"))
AssertionError: 0 != 56

----------------------------------------------------------------------
Ran 73 tests in 0.663s

FAILED (failures=1)
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/lib/python2.7/logging/__init__.py", line 1653, in shutdown
    h.flush()
  File "/usr/lib/python2.7/logging/__init__.py", line 834, in flush
    if self.stream and hasattr(self.stream, "flush"):
  File "/home/aminechikhaoui/work/locust/.eggs/Werkzeug-0.12.2-py2.7.egg/werkzeug/local.py", line 328, in __bool__
    return bool(self._get_current_object())
  File "/home/aminechikhaoui/work/locust/.eggs/Werkzeug-0.12.2-py2.7.egg/werkzeug/local.py", line 306, in _get_current_object
    return self.__local()
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.12.2-py2.7.egg/flask/logging.py", line 37, in _proxy_stream
    ctx = _request_ctx_stack.top
AttributeError: 'NoneType' object has no attribute 'top'
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/lib/python2.7/logging/__init__.py", line 1653, in shutdown
    h.flush()
  File "/usr/lib/python2.7/logging/__init__.py", line 834, in flush
    if self.stream and hasattr(self.stream, "flush"):
  File "/home/aminechikhaoui/work/locust/.eggs/Werkzeug-0.12.2-py2.7.egg/werkzeug/local.py", line 328, in __bool__
    return bool(self._get_current_object())
  File "/home/aminechikhaoui/work/locust/.eggs/Werkzeug-0.12.2-py2.7.egg/werkzeug/local.py", line 306, in _get_current_object
    return self.__local()
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.12.2-py2.7.egg/flask/logging.py", line 37, in _proxy_stream
    ctx = _request_ctx_stack.top
AttributeError: 'NoneType' object has no attribute 'top'
make: *** [test] Error 1

Running make test with flask=0.10.1:

$ git diff
diff --git a/setup.py b/setup.py
index 2b466db..8a07349 100644
--- a/setup.py
+++ b/setup.py
@@ -44,7 +44,7 @@ setup(
     packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
     include_package_data=True,
     zip_safe=False,
-    install_requires=["gevent>=1.0.1", "flask>=0.10.1", "requests>=2.4.1", "msgpack-python>=0.4.2"],
+    install_requires=["gevent>=1.0.1", "flask==0.10.1", "requests>=2.4.1", "msgpack-python>=0.4.2"],
     tests_require=['unittest2', 'mock', 'pyzmq'],
     entry_points={
         'console_scripts': [

aminechikhaoui at PDXL0711-LatE6530 in ~/work/locust
$ sudo  make test                         
python setup.py test
running test
Searching for flask==0.10.1
Best match: Flask 0.10.1
Processing Flask-0.10.1-py2.7.egg

Using /home/aminechikhaoui/work/locust/.eggs/Flask-0.10.1-py2.7.egg
Searching for gevent>=1.0.1
Best match: gevent 1.2.2
Processing gevent-1.2.2-py2.7-linux-x86_64.egg

Using /home/aminechikhaoui/work/locust/.eggs/gevent-1.2.2-py2.7-linux-x86_64.egg
Searching for itsdangerous>=0.21
Best match: itsdangerous 0.24
Processing itsdangerous-0.24-py2.7.egg

Using /home/aminechikhaoui/work/locust/.eggs/itsdangerous-0.24-py2.7.egg
Searching for Werkzeug>=0.7
Best match: Werkzeug 0.12.2
Processing Werkzeug-0.12.2-py2.7.egg

Using /home/aminechikhaoui/work/locust/.eggs/Werkzeug-0.12.2-py2.7.egg
Searching for greenlet>=0.4.10
Best match: greenlet 0.4.12
Processing greenlet-0.4.12-py2.7-linux-x86_64.egg

Using /home/aminechikhaoui/work/locust/.eggs/greenlet-0.4.12-py2.7-linux-x86_64.egg
Searching for pyzmq
Best match: pyzmq 16.0.2
Processing pyzmq-16.0.2-py2.7-linux-x86_64.egg

Using /home/aminechikhaoui/work/locust/.eggs/pyzmq-16.0.2-py2.7-linux-x86_64.egg
Searching for mock
Best match: mock 2.0.0
Processing mock-2.0.0-py2.7.egg

Using /home/aminechikhaoui/work/locust/.eggs/mock-2.0.0-py2.7.egg
Searching for pbr>=0.11
Best match: pbr 3.1.1
Processing pbr-3.1.1-py2.7.egg

Using /home/aminechikhaoui/work/locust/.eggs/pbr-3.1.1-py2.7.egg
Searching for funcsigs>=1
Best match: funcsigs 1.0.2
Processing funcsigs-1.0.2-py2.7.egg

Using /home/aminechikhaoui/work/locust/.eggs/funcsigs-1.0.2-py2.7.egg
running egg_info
writing requirements to locustio.egg-info/requires.txt
writing locustio.egg-info/PKG-INFO
writing top-level names to locustio.egg-info/top_level.txt
writing dependency_links to locustio.egg-info/dependency_links.txt
writing entry points to locustio.egg-info/entry_points.txt
reading manifest file 'locustio.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'locustio.egg-info/SOURCES.txt'
running build_ext
test_task_ratio_command (locust.test.test_taskratio.TestTaskRatio) ... ok
test_task_ratio_command_with_locust_weight (locust.test.test_taskratio.TestTaskRatio) ... ok
test_get_task_ratio_dict_relative (locust.test.test_stats.TestInspectLocust) ... ok
test_get_task_ratio_dict_total (locust.test.test_stats.TestInspectLocust) ... ok
test_aggregation (locust.test.test_stats.TestRequestStats) ... ok
test_avg (locust.test.test_stats.TestRequestStats) ... ok
test_current_rps (locust.test.test_stats.TestRequestStats) ... ok
test_median (locust.test.test_stats.TestRequestStats) ... ok
test_num_reqs_fails (locust.test.test_stats.TestRequestStats) ... ok
test_percentile (locust.test.test_stats.TestRequestStats) ... ok
test_reset (locust.test.test_stats.TestRequestStats) ... ok
test_reset_min_response_time (locust.test.test_stats.TestRequestStats) ... ok
test_serialize_through_message (locust.test.test_stats.TestRequestStats) ... ok
test_total_rps (locust.test.test_stats.TestRequestStats) ... ok
test_max_requests (locust.test.test_stats.TestRequestStatsWithWebserver) ... ok
test_max_requests_failed_requests (locust.test.test_stats.TestRequestStatsWithWebserver) ... ok
test_request_connection_error (locust.test.test_stats.TestRequestStatsWithWebserver) ... ok
test_request_stats_content_length (locust.test.test_stats.TestRequestStatsWithWebserver) ... ok
test_request_stats_named_endpoint (locust.test.test_stats.TestRequestStatsWithWebserver) ... ok
test_request_stats_no_content_length (locust.test.test_stats.TestRequestStatsWithWebserver) ... ok
test_request_stats_no_content_length_streaming (locust.test.test_stats.TestRequestStatsWithWebserver) ... ok
test_request_stats_query_variables (locust.test.test_stats.TestRequestStatsWithWebserver) ... ok
test_catch_response (locust.test.test_locust_class.TestCatchResponse) ... ok
test_catch_response_allow_404 (locust.test.test_locust_class.TestCatchResponse) ... ok
test_catch_response_connection_error_fail (locust.test.test_locust_class.TestCatchResponse) ... ok
test_catch_response_connection_error_success (locust.test.test_locust_class.TestCatchResponse) ... ok
test_catch_response_http_fail (locust.test.test_locust_class.TestCatchResponse) ... ok
test_catch_response_http_manual_fail (locust.test.test_locust_class.TestCatchResponse) ... ok
test_catch_response_http_manual_success (locust.test.test_locust_class.TestCatchResponse) ... ok
test_interrupt_taskset_with_catch_response (locust.test.test_locust_class.TestCatchResponse) ... ok
test_interrupt_taskset_in_main_taskset (locust.test.test_locust_class.TestTaskSet) ... ok
test_on_start (locust.test.test_locust_class.TestTaskSet) ... ok
test_on_start_interrupt (locust.test.test_locust_class.TestTaskSet) ... ok
test_parent_attribute (locust.test.test_locust_class.TestTaskSet) ... ok
test_schedule_task (locust.test.test_locust_class.TestTaskSet) ... ok
test_schedule_task_bound_method (locust.test.test_locust_class.TestTaskSet) ... ok
test_schedule_task_with_kwargs (locust.test.test_locust_class.TestTaskSet) ... ok
test_sub_taskset (locust.test.test_locust_class.TestTaskSet) ... ok
test_sub_taskset_arguments (locust.test.test_locust_class.TestTaskSet) ... ok
test_sub_taskset_tasks_decorator (locust.test.test_locust_class.TestTaskSet) ... ok
test_task_decorator_ratio (locust.test.test_locust_class.TestTaskSet) ... ok
test_task_decorator_with_or_without_argument (locust.test.test_locust_class.TestTaskSet) ... ok
test_task_ratio (locust.test.test_locust_class.TestTaskSet) ... ok
test_taskset_inheritance (locust.test.test_locust_class.TestTaskSet) ... ok
test_client_basic_auth (locust.test.test_locust_class.TestWebLocustClass) ... ok
test_client_delete (locust.test.test_locust_class.TestWebLocustClass) ... ok
test_client_get (locust.test.test_locust_class.TestWebLocustClass) ... ok
test_client_get_absolute_url (locust.test.test_locust_class.TestWebLocustClass) ... ok
test_client_head (locust.test.test_locust_class.TestWebLocustClass) ... ok
test_client_post (locust.test.test_locust_class.TestWebLocustClass) ... ok
test_client_put (locust.test.test_locust_class.TestWebLocustClass) ... ok
test_client_request_headers (locust.test.test_locust_class.TestWebLocustClass) ... ok
test_get_request (locust.test.test_locust_class.TestWebLocustClass) ... ok
test_locust_client_error (locust.test.test_locust_class.TestWebLocustClass) ... ok
test_log_request_name_argument (locust.test.test_locust_class.TestWebLocustClass) ... ok
test_redirect_url_original_path_as_name (locust.test.test_locust_class.TestWebLocustClass) ... ok
test_exception_in_task (locust.test.test_runners.TestMasterRunner) ... ok
test_exception_is_catched (locust.test.test_runners.TestMasterRunner)
Test that exceptions are stored, and execution continues ... ok
test_slave_connect (locust.test.test_runners.TestMasterRunner) ... ok
test_slave_stats_report_median (locust.test.test_runners.TestMasterRunner) ... ok
test_spawn_fewer_locusts_than_slaves (locust.test.test_runners.TestMasterRunner) ... ok
test_spawn_uneven_locusts (locust.test.test_runners.TestMasterRunner) ... ok
test_spawn_zero_locusts (locust.test.test_runners.TestMasterRunner) ... ok
test_message_serialize (locust.test.test_runners.TestMessageSerializing) ... ok
test_distribution_stats_csv (locust.test.test_web.TestWebUI) ... ok
test_index (locust.test.test_web.TestWebUI) ... ok
test_request_stats_csv (locust.test.test_web.TestWebUI) ... ok
test_stats (locust.test.test_web.TestWebUI) ... ok
test_stats_cache (locust.test.test_web.TestWebUI) ... ok
test_stats_no_data (locust.test.test_web.TestWebUI) ... ok
test_is_locust (locust.test.test_main.TestTaskSet) ... ok
test_connection_error (locust.test.test_client.TestHttpSession) ... ok
test_get (locust.test.test_client.TestHttpSession) ... ok
test_slow_redirect (locust.test.test_client.TestHttpSession) ... ok
test_streaming_response (locust.test.test_client.TestHttpSession) ... ok
test_wrong_url (locust.test.test_client.TestHttpSession) ... ok

----------------------------------------------------------------------
Ran 76 tests in 2.639s

OK
aldenpeterson-wf commented 7 years ago

Closing as 0.8 has now been released, we can reopen if needed.