15
0
forked from pool/python-Beaker
2020-07-23 00:24:38 +00:00
committed by Git OBS Bridge
parent adb95bf563
commit 465c03092a

View File

@@ -136,6 +136,15 @@
import shutil
shutil.rmtree('./cache', True)
@@ -58,7 +58,7 @@ def test_parse_doesnt_allow_empty_region
def test_decorators():
for func in (make_region_cached_func, make_cached_func):
- yield check_decorator, func()
+ check_decorator(func())
def check_decorator(func):
result = func('Fred')
@@ -119,7 +119,7 @@ def test_long_name():
name = 'Fred' * 250
result = func(name)
@@ -163,18 +172,19 @@
+ assert msg2 != msg3, (msg2, msg3)
--- a/tests/test_container.py
+++ b/tests/test_container.py
@@ -1,6 +1,10 @@
@@ -1,6 +1,11 @@
import os
+import pickle
import random
+import shutil
+import sys
import time
+import pytest
+
from beaker.container import *
from beaker.synchronization import _synchronizers
from beaker.cache import clsmap
@@ -34,10 +38,10 @@ def _run_container_test(cls, totaltime,
@@ -34,10 +39,10 @@ def _run_container_test(cls, totaltime,
if threadlocal:
localvalue = Value(
@@ -189,7 +199,7 @@
starttime=starttime)
localvalue.clear_value()
else:
@@ -60,10 +64,10 @@ def _run_container_test(cls, totaltime,
@@ -60,10 +65,10 @@ def _run_container_test(cls, totaltime,
if not threadlocal:
value = Value(
@@ -204,7 +214,17 @@
starttime=starttime)
value.clear_value()
else:
@@ -137,35 +141,29 @@ def test_file_open_bug():
@@ -124,6 +129,9 @@ def test_file_container_3():
def test_file_container_tlocal():
test_file_container(expiretime=15, delay=2, threadlocal=True)
+
+@pytest.mark.skipif(sys.version_info < (3, 6),
+ reason="Cryptography not supported on Python 3 lower than 3.6")
def test_file_open_bug():
"""ensure errors raised during reads or writes don't lock the namespace open."""
@@ -137,35 +145,29 @@ def test_file_open_bug():
f.write("BLAH BLAH BLAH")
f.close()
@@ -245,7 +265,7 @@
createfunc=create, starttime=time.time()
)
if os.path.exists(value.namespace.file):
@@ -176,6 +174,5 @@ def test_removing_file_refreshes():
@@ -176,6 +178,5 @@ def test_removing_file_refreshes():
assert value.get_value() == 2
@@ -269,7 +289,7 @@
- from webtest import TestApp
-except ImportError:
- raise SkipTest("webtest not installed")
+webtest = pytest.importorskip("webtest", reason="webtest not installed")
+webtest = pytest.importorskip("webtest")
+
+pytest.mark.skipif(not crypto.get_crypto_module('default').has_aes,
+ reason="No AES library is installed, can't test " +