Test: Do not write test files into CWD
When running the tests make sure to write the test files into the temp directory. This fixes issue 19112
This commit is contained in:
@@ -23,8 +23,10 @@
|
||||
|
||||
""" Tests related to the Topological Naming Problem """
|
||||
|
||||
import os
|
||||
import math
|
||||
import unittest
|
||||
import tempfile
|
||||
|
||||
import FreeCAD as App
|
||||
import Part
|
||||
@@ -2484,10 +2486,10 @@ class TestTopologicalNamingProblem(unittest.TestCase):
|
||||
self.Body = self.Doc.addObject("PartDesign::Body", "Body")
|
||||
self.create_t_sketch()
|
||||
self.assertEqual(self.Doc.Sketch.Shape.ElementMapSize, 18)
|
||||
filename = self.Doc.Name
|
||||
filename = tempfile.gettempdir() + os.sep + self.Doc.Name
|
||||
# Act
|
||||
self.Doc.saveAs(filename)
|
||||
App.closeDocument(filename)
|
||||
App.closeDocument(self.Doc.Name)
|
||||
self.Doc = App.openDocument(filename + ".FCStd")
|
||||
self.Doc.recompute()
|
||||
# Assert
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
# **************************************************************************
|
||||
|
||||
|
||||
import FreeCAD, os, sys, unittest, Part, Sketcher
|
||||
import os, tempfile, unittest
|
||||
import FreeCAD, Part, Sketcher
|
||||
from Part import Precision
|
||||
|
||||
App = FreeCAD
|
||||
@@ -558,7 +559,7 @@ class TestSketcherSolver(unittest.TestCase):
|
||||
self.Doc.recompute()
|
||||
|
||||
# Act: Save and reload the file
|
||||
filename = self.Doc.Name + ".FCStd"
|
||||
filename = tempfile.gettempdir() + os.sep + self.Doc.Name + ".FCStd"
|
||||
self.Doc.saveAs(filename)
|
||||
FreeCAD.closeDocument(self.Doc.Name)
|
||||
self.Doc = FreeCAD.openDocument(filename)
|
||||
@@ -607,7 +608,7 @@ class TestSketcherSolver(unittest.TestCase):
|
||||
self.assertEqual(len(extRefsAll), 3)
|
||||
self.assertEqual(root.tag, "all")
|
||||
# Act
|
||||
filename = self.Doc.Name + ".FCStd"
|
||||
filename = tempfile.gettempdir() + os.sep + self.Doc.Name + ".FCStd"
|
||||
self.Doc.saveAs(filename)
|
||||
FreeCAD.closeDocument(self.Doc.Name)
|
||||
self.Doc = FreeCAD.openDocument(filename)
|
||||
|
||||
Reference in New Issue
Block a user