mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 06:21:40 +00:00
Bugfix for BIMTester purge function to overwrite existing feature files
This commit is contained in:
@@ -54,19 +54,22 @@ class TestPurger:
|
|||||||
def purge(self):
|
def purge(self):
|
||||||
for filename in Path('features/').glob('*.feature'):
|
for filename in Path('features/').glob('*.feature'):
|
||||||
with open(filename, 'r') as feature_file:
|
with open(filename, 'r') as feature_file:
|
||||||
with open('{}.purged'.format(filename), 'w') as new_file:
|
old_file = feature_file.readlines()
|
||||||
for line in feature_file:
|
with open(filename, 'w') as new_file:
|
||||||
if 'Given the IFC file ' in line:
|
for line in old_file:
|
||||||
filename = line.split('"')[1]
|
is_purged = False
|
||||||
print('Loading file {} ...'.format(filename))
|
if 'Given the IFC file ' in line:
|
||||||
self.file = ifcopenshell.open(filename)
|
filename = line.split('"')[1]
|
||||||
if line.strip()[0:4] == 'Then':
|
print('Loading file {} ...'.format(filename))
|
||||||
words = line.strip().split()
|
self.file = ifcopenshell.open(filename)
|
||||||
for word in words:
|
if line.strip()[0:4] == 'Then':
|
||||||
if self.is_a_global_id(word):
|
words = line.strip().split()
|
||||||
if not self.does_global_id_exist(word):
|
for word in words:
|
||||||
print('Test for {} purged ...'.format(word))
|
if self.is_a_global_id(word):
|
||||||
continue
|
if not self.does_global_id_exist(word):
|
||||||
|
print('Test for {} purged ...'.format(word))
|
||||||
|
is_purged = True
|
||||||
|
if not is_purged:
|
||||||
new_file.write(line)
|
new_file.write(line)
|
||||||
|
|
||||||
def is_a_global_id(self, word):
|
def is_a_global_id(self, word):
|
||||||
|
|||||||
Reference in New Issue
Block a user