Skip to content

Commit 9159205

Browse files
authored
fix test run on appveyor (xmlsec#231)
Signed-off-by: oleg.hoefling <[email protected]> Signed-off-by: oleg.hoefling <[email protected]>
1 parent c39eeff commit 9159205

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

tests/base.py

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
11
import gc
22
import os
3-
import resource
43
import sys
54
import unittest
65

76
from lxml import etree
87

98
import xmlsec
109

11-
etype = type(etree.Element("test"))
10+
etype = type(etree.Element('test'))
1211

1312
ns = {'dsig': xmlsec.constants.DSigNs, 'enc': xmlsec.constants.EncNs}
1413

1514

16-
def get_iterations():
17-
"""Parse iterations amount."""
18-
if sys.platform in ('win32',):
19-
return 0
15+
try:
16+
import resource
2017

21-
try:
22-
return int(os.getenv("PYXMLSEC_TEST_ITERATIONS", "10"))
23-
except ValueError:
24-
return 0
18+
test_iterations = int(os.environ.get('PYXMLSEC_TEST_ITERATIONS', '10'))
19+
except (ImportError, ValueError):
20+
test_iterations = 0
2521

2622

2723
class TestMemoryLeaks(unittest.TestCase):
2824
maxDiff = None
2925

30-
iterations = get_iterations()
26+
iterations = test_iterations
3127

3228
data_dir = os.path.join(os.path.dirname(__file__), "data")
3329

0 commit comments

Comments
 (0)