Browse Source

Workaround for python2 deprecation in tests

When checking the version the test now gets a
CryptographyDeprecationWarning plus an import code line instead of the
version. As a workaround we now ignore the first two lines when checking
for the version string.
Sebastian Lohff 1 year ago
parent
commit
ef41f65996
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      tests/test_servefile.py

+ 6
- 0
tests/test_servefile.py View File

@@ -97,6 +97,12 @@ def _test_version(run_servefile, standalone):
97 97
     s.wait()
98 98
     version = s.stdout.readline().decode().strip()
99 99
 
100
+    # python2 is deprecated, but we still want our tests to run for it
101
+    # CryptographyDeprecationWarnings get in the way for this
102
+    if 'CryptographyDeprecationWarning' in version:
103
+        s.stdout.readline()  # ignore "from x import y" line
104
+        version = s.stdout.readline().decode().strip()
105
+
100 106
     # hardcode version as string until servefile is a module
101 107
     assert version == 'servefile 0.4.4'
102 108
 

Loading…
Cancel
Save