Skip to content
Snippets Groups Projects
Commit 2baf041b authored by jack-parsons's avatar jack-parsons
Browse files

Fixing the Gitlab sample_test

parent bc9d22c7
Branches
No related tags found
1 merge request!23Merge in Jack's changes
Pipeline #844 passed
......@@ -31,8 +31,8 @@ class TestBasicFunction(unittest.TestCase):
self.assertEqual(s, "<class 'module'>")
def test_rotate(self):
stlPath = "sample_stl_sphere_BIN.stl"
from AmpScan.core import AmpObject
stlPath = self.get_path("sample_stl_sphere_BIN.stl")
Amp = AmpObject(stlPath)
s = str(type(Amp))
self.assertEqual(s, "<class 'AmpScan.core.AmpObject'>", "Not expected Object")
......@@ -42,12 +42,29 @@ class TestBasicFunction(unittest.TestCase):
def test_trim(self):
# a new test for the trim module
stlPath = "sample_stl_sphere_BIN.stl"
stlPath = self.get_path("sample_stl_sphere_BIN.stl")
from AmpScan.core import AmpObject
Amp = AmpObject(stlPath)
#with self.assertRaises(TypeError):
#Amp.planarTrim([], plane=[])
def get_path(self, filename):
"""
Method to get the absolute path to the testing files
:param filename: Name of the file in tests folder
:return: The absolute path to the file
"""
# Check if the parent directory is tests (this is for Pycharm unittests)
if os.path.basename(os.getcwd()) == "tests":
# This is for Pycharm testing
stlPath = filename
else:
# This is for the Gitlab testing
stlPath = os.path.abspath(os.getcwd()) + "\\tests\\"+filename
return stlPath
if __name__ == '__main__':
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment