Skip to content

Commit

Permalink
unittest.main()
Browse files Browse the repository at this point in the history
run unittest.main() if called as __main__

closes issue #14
  • Loading branch information
adrianschlatter committed Sep 15, 2023
1 parent 12392e2 commit 9e9cb01
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/test_codec_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ def test_unpack_invalid_words(self):
words = 3 * b'\x00' # length not even
with self.assertRaises(ValueError):
codec_common.unpack_words(words)


if __name__ == '__main__':
# This enables running the unit tests by running this script which is
# much more convenient than 'python setup.py test' while developing tests.
# Note: package-under-test needs to be in python-path
unittest.main()
7 changes: 7 additions & 0 deletions tests/test_datamatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,10 @@ def test_random_messages(self):
msg = ''.join(random.choices(ASCII, k=n))
datamatrix = put.DataMatrix(msg)
self.assertTrue(len(datamatrix.matrix) > 0)


if __name__ == '__main__':
# This enables running the unit tests by running this script which is
# much more convenient than 'python setup.py test' while developing tests.
# Note: package-under-test needs to be in python-path
unittest.main()

0 comments on commit 9e9cb01

Please sign in to comment.