Skip to content

Commit

Permalink
fix, remove unnecessary lines
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-sommer committed Nov 28, 2023
1 parent ae6c143 commit bc80c07
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions unittests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,23 @@ def test_file_existence(self):
os.path.isfile(importer_test_file),
f"Unittest of importer '{importer_test_file}' is missing or using different name"
)
for parser_dir in os.scandir(os.path.join(basedir, 'dojo', 'tools')):
if parser_dir.is_dir():
for file in os.scandir(os.path.join(basedir, 'dojo', 'tools', parser_dir.name)):
if file.is_file() and file.name != '__pycache__' and file.name != "__init__.py":
f = os.path.join(basedir, 'dojo', 'tools', parser_dir.name, file.name)
import subprocess
task = subprocess.Popen(["cat", f], stdout=subprocess.PIPE)
read_true = False
for line in task.stdout:
if read_true is True:
if ('"utf-8"' in str(line) or "'utf-8'" in str(line) or '"utf-8-sig"' in str(line) or "'utf-8-sig'" in str(line)) and i <= 4:
read_true = False
i = 0
elif i > 4:
self.assertTrue(False, "In file " + str(os.path.join('dojo', 'tools', parser_dir.name, file.name)) + " the test is failing because you don't have utf-8 after .read()")
i = 0
read_true = False
else:
i += 1
if ".read()" in str(line):
read_true = True
for file in os.scandir(os.path.join(basedir, 'dojo', 'tools', parser_dir.name)):
if file.is_file() and file.name != '__pycache__' and file.name != "__init__.py":
f = os.path.join(basedir, 'dojo', 'tools', parser_dir.name, file.name)
import subprocess
task = subprocess.Popen(["cat", f], stdout=subprocess.PIPE)
read_true = False
for line in task.stdout:
if read_true is True:
if ('"utf-8"' in str(line) or "'utf-8'" in str(line) or '"utf-8-sig"' in str(line) or "'utf-8-sig'" in str(line)) and i <= 4:
read_true = False
i = 0
elif i > 4:
self.assertTrue(False, "In file " + str(os.path.join('dojo', 'tools', parser_dir.name, file.name)) + " the test is failing because you don't have utf-8 after .read()")
i = 0
read_true = False
else:
i += 1
if ".read()" in str(line):
read_true = True
i = 0

0 comments on commit bc80c07

Please sign in to comment.