Skip to content

Commit

Permalink
Restructured test directory to make python happy and added test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
kieraneglin committed Sep 13, 2023
1 parent a3e19ed commit 13797e8
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
Empty file added test/__init__.py
Empty file.
Empty file added test/components/__init__.py
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
from components.mmu_server import MmuServer

class TestMmuServerFileProcessor(unittest.TestCase):
TOOLCHANGE_FILEPATH = 'tests/support/toolchange.gcode'
NO_TOOLCHANGE_FILEPATH = 'tests/support/no_toolchange.gcode'
TOOLCHANGE_FILEPATH = 'test/support/toolchange.gcode'
NO_TOOLCHANGE_FILEPATH = 'test/support/no_toolchange.gcode'

def setUp(self):
self.subject = MmuServer(MagicMock())
shutil.copyfile('tests/support/toolchange.orig.gcode', self.TOOLCHANGE_FILEPATH)
shutil.copyfile('tests/support/no_toolchange.orig.gcode', self.NO_TOOLCHANGE_FILEPATH)
shutil.copyfile('test/support/toolchange.orig.gcode', self.TOOLCHANGE_FILEPATH)
shutil.copyfile('test/support/no_toolchange.orig.gcode', self.NO_TOOLCHANGE_FILEPATH)

def tearDown(self):
os.remove(self.TOOLCHANGE_FILEPATH)
Expand Down
8 changes: 8 additions & 0 deletions test/runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# NOTE: in order for tests to get picked up automatically, you must do the following:
# 1. Create a file in the test directory with the name test_*.py
# 2. Create a class in that file that inherits from unittest.TestCase
# 3. Ensure that each test directory has a blank file named `__init__.py`

python3 -m unittest
File renamed without changes.
File renamed without changes.

0 comments on commit 13797e8

Please sign in to comment.