diff --git a/kibot/out_step.py b/kibot/out_step.py index b78194e7..7bda9f59 100644 --- a/kibot/out_step.py +++ b/kibot/out_step.py @@ -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) diff --git a/tests/test_plot/test_step.py b/tests/test_plot/test_step.py index 9b7381b0..4fbec7bd 100644 --- a/tests/test_plot/test_step.py +++ b/tests/test_plot/test_step.py @@ -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)