Skip to content

Commit

Permalink
Adding a test for rhino3dm dev samples
Browse files Browse the repository at this point in the history
  • Loading branch information
fraguada committed Jan 24, 2025
1 parent 7a8e6f0 commit 731dee3
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions rhino3dm/tests/py/test_samples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import os
import subprocess
import unittest

class TestRhino3dmSamples(unittest.TestCase):

def test_samples(self):

samplesDir = os.path.dirname(os.getcwd())
samplesDir = os.path.dirname(samplesDir)
samplesDir = os.path.join(samplesDir, "py")

os.chdir(samplesDir)

for file in os.listdir(samplesDir):
if file.endswith(".py"):
filepath = os.path.join(samplesDir, file)

cmd = subprocess.run(["python", filepath], capture_output=True)

with self.subTest(msg=filepath):
#print(cmd.returncode)
if cmd.returncode != 0:
print(cmd.stderr.decode())
#else:
#stdout = cmd.stdout.decode()
#print(stdout)
#print(filepath)
self.assertEqual(cmd.returncode, 0)



if __name__ == '__main__':
print("running tests")
unittest.main()
print("tests complete")

0 comments on commit 731dee3

Please sign in to comment.