From 9100c4004fe32c2b28510baf47e3588a0364dadc Mon Sep 17 00:00:00 2001 From: Shay Palachy Date: Sat, 13 Jul 2019 19:41:22 +0300 Subject: [PATCH] fixing python versions --- .travis.yml | 10 +++++----- tests/test_pickle_core.py | 25 ++++++++++++++++++++----- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3b31119..cea765e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ matrix: before_install: - python --version # - pip install -U pip - - python -m pip install --upgrade pip + # - python -m pip install --upgrade pip - pip install pytest - pip install codecov - pip install pymongo @@ -62,21 +62,21 @@ matrix: - pip install --upgrade pytest - pip install codecov env: PATH=/c/Python27:/c/Python27/Scripts:$PATH - - name: "Python 3.5.7 on Windows" + - name: "Python 3.5.4 on Windows" os: windows # Windows 10.0.17134 N/A Build 17134 language: shell # 'language: python' is an error on Travis CI Windows before_install: - - choco install python --version 3.5.7 + - choco install python --version 3.5.4 - python --version - python -m pip install --upgrade pip - pip3 install --upgrade pytest - pip3 install codecov env: PATH=/c/Python35:/c/Python35/Scripts:$PATH - - name: "Python 3.6.9 on Windows" + - name: "Python 3.6.8 on Windows" os: windows # Windows 10.0.17134 N/A Build 17134 language: shell # 'language: python' is an error on Travis CI Windows before_install: - - choco install python --version 3.6.9 + - choco install python --version 3.6.8 - python --version - python -m pip install --upgrade pip - pip3 install --upgrade pytest diff --git a/tests/test_pickle_core.py b/tests/test_pickle_core.py index 80d5f16..99fba23 100644 --- a/tests/test_pickle_core.py +++ b/tests/test_pickle_core.py @@ -306,7 +306,7 @@ def _calls_delete_cache(res_queue, del_cache): res_queue.put(exc) -def test_delete_cache_file(): +def _helper_delete_cache_file(sleeptime): """Test pickle core handling of missing cache files.""" _delete_cache.clear_cache() res_queue = queue.Queue() @@ -317,20 +317,35 @@ def test_delete_cache_file(): target=_calls_delete_cache, kwargs={'res_queue': res_queue, 'del_cache': False}) thread1.start() - sleep(0.5) + sleep(sleeptime) thread2.start() thread1.join() thread2.join() - assert res_queue.qsize() == 2 + if not res_queue.qsize() == 2: + return False res1 = res_queue.get() # print(res1) - assert isinstance(res1, float) + if not isinstance(res1, float): + return False res2 = res_queue.get() - assert isinstance(res2, KeyError) or (res2 is None) + if not (isinstance(res2, KeyError)) or ( + (res2 is None)): + return False + return True # print(res2) # print(type(res2)) +def test_delete_cache_file(): + """Test pickle core handling of missing cache files.""" + sleeptimes = [0.5, 0.3, 0.1, 0.2, 0.8, 1] + sleeptimes = sleeptimes + sleeptimes + for sleeptime in sleeptimes: + if _helper_delete_cache_file(sleeptime): + return + assert False + + def test_clear_being_calculated(): """Test pickle core clear `being calculated` functionality.""" _takes_time.clear_being_calculated()