-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a test for rhino3dm dev samples
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |