Search code examples
pythonxmlunit-testingtestingxsd-1.1

Should I create a new .py script for unit tests?


I have written a Python script for parsing and validating XML files against an .XSD schema (and some other constraints), and I am about to write tests for it. I was thinking of using Python's unittest because it is built in and has assertions that I am familiar with. I have never tested with Python before, but have done JUnit testing with Java. I was wondering if I should create a new .py script for the tests?


Solution

  • I suggest using Py.test instead of the built-in unittest module -- it's way more ergonomic.

    With Py.test, you'd have a separate test_foo.py file (it discovers test-containing files by default by a test_ prefix).