Removed temporal project left by out_step

Closes #124
This commit is contained in:
Diego Capusotto 2021-12-18 11:11:55 -03:00
parent 5d1ecfbae4
commit d989857ac7
2 changed files with 7 additions and 1 deletions

View File

@ -5,6 +5,7 @@
# Project: KiBot (formerly KiPlot)
import re
import os
from glob import glob
from subprocess import (check_output, STDOUT, CalledProcessError)
from shutil import rmtree
from .error import KiPlotConfigurationError
@ -80,7 +81,9 @@ class STEPOptions(Base3DOptions):
finally:
# Remove the temporal PCB
if board_name != GS.pcb_file:
os.remove(board_name)
# KiCad likes to create project files ...
for f in glob(board_name.replace('.kicad_pcb', '.*')):
os.remove(f)
# Remove the downloaded 3D models
if self._tmp_dir:
rmtree(self._tmp_dir)

View File

@ -11,6 +11,7 @@ pytest-3 --log-cli-level debug
import os
import sys
from glob import glob
# Look for the 'utils' module from where the script is running
prev_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if prev_dir not in sys.path:
@ -60,6 +61,8 @@ def test_step_variant_1(test_dir):
ctx.run(extra_debug=True)
# Check all outputs are there
ctx.expect_out_file(prj+'-3D.step')
tmps = glob(os.path.join(ctx.get_board_dir(), 'tmp*pro'))
assert len(tmps) == 0, tmps
ctx.clean_up(keep_project=True)