Tests: python 3.5 compatibility fixes

pull/900/head
Micah Snyder 2 years ago committed by Micah Snyder
parent 59f06d7579
commit 5a8ec70447
  1. 4
      unit_tests/clamscan/container_sigs_test.py
  2. 4
      unit_tests/clamscan/fp_check_test.py
  3. 2
      unit_tests/clamscan/heuristics_test.py
  4. 4
      unit_tests/sigtool_test.py

@ -90,7 +90,7 @@ class TC(testcase.TestCase):
not_eicar_file = TC.path_tmp / 'not_eicar'
if not not_eicar_file.exists():
with open(not_eicar_file, 'wb') as f:
with not_eicar_file.open('wb') as f:
f.write(b"CLAMAV-TEST-STRING-NOT-EICAR")
not_eicar_zip = TC.path_tmp / 'not_eicar.zip'
@ -131,7 +131,7 @@ class TC(testcase.TestCase):
not_eicar_file = TC.path_tmp / 'not_eicar'
if not not_eicar_file.exists():
with open(not_eicar_file, 'wb') as f:
with not_eicar_file.open('wb') as f:
f.write(b"CLAMAV-TEST-STRING-NOT-EICAR")
not_eicar_zip = TC.path_tmp / 'not_eicar.zip'

@ -19,7 +19,7 @@ class TC(testcase.TestCase):
super(TC, cls).setUpClass()
TC.test_file = TC.path_tmp / "test_file"
with open(TC.test_file, "wb") as testfile:
with TC.test_file.open('wb') as testfile:
testfile.write(
b"""<?php
IGNORE_user_abort(asdf) scandir(asdfasdfasf]);
@ -50,7 +50,7 @@ rename()
TC.test_file_zipped = TC.path_tmp / 'test_file.zip'
with ZipFile(str(TC.test_file_zipped), 'w', ZIP_DEFLATED) as zf:
# Add truncted PNG file that will alert with --alert-broken-media
with open(TC.path_source / 'logo.png', 'br') as logo_png:
with (TC.path_source / 'logo.png').open('br') as logo_png:
zf.writestr('test_file', b"""<?php
IGNORE_user_abort(asdf) scandir(asdfasdfasf]);
foreach(asdfasfs) strpos(asdfasfsfasf) sdfasdfasdf .php.suspected

@ -29,7 +29,7 @@ class TC(testcase.TestCase):
TC.heuristics_testfile = TC.path_tmp / 'heuristics-test.zip'
with ZipFile(str(TC.heuristics_testfile), 'w', ZIP_DEFLATED) as zf:
# Add truncted PNG file that will alert with --alert-broken-media
with open(TC.path_source / 'logo.png', 'br') as logo_png:
with (TC.path_source / 'logo.png').open('br') as logo_png:
zf.writestr('logo.png.truncated', logo_png.read(6378))
# Add clam.exe which will alert normally

@ -92,7 +92,7 @@ class TC(testcase.TestCase):
self.log.warning('VG: {}'.format(os.getenv("VG")))
(TC.path_tmp / 'run_cdiff').mkdir()
os.chdir(TC.path_tmp / 'run_cdiff')
os.chdir(str(TC.path_tmp / 'run_cdiff'))
command = '{valgrind} {valgrind_args} {sigtool} --unpack {cvd}'.format(
valgrind=TC.valgrind, valgrind_args=TC.valgrind_args, sigtool=TC.sigtool,
@ -131,7 +131,7 @@ class TC(testcase.TestCase):
self.log.warning('VG: {}'.format(os.getenv("VG")))
(TC.path_tmp / 'run_cdiff_log').mkdir()
os.chdir(TC.path_tmp / 'run_cdiff_log')
os.chdir(str(TC.path_tmp / 'run_cdiff_log'))
command = '{valgrind} {valgrind_args} {sigtool} --unpack {cvd}'.format(
valgrind=TC.valgrind, valgrind_args=TC.valgrind_args, sigtool=TC.sigtool,

Loading…
Cancel
Save