This is an automated email from the ASF dual-hosted git repository. mergebot-role pushed a commit to branch mergebot in repository https://gitbox.apache.org/repos/asf/beam-site.git
commit d5e1fdc01eb485a39d9cba2f2b544e79b7d07faf Author: Robert Bradshaw <[email protected]> AuthorDate: Tue Nov 14 18:44:24 2017 -0800 Update testing docs to account for Python. --- src/contribute/testing.md | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/contribute/testing.md b/src/contribute/testing.md index 322591f..ed733f9 100644 --- a/src/contribute/testing.md +++ b/src/contribute/testing.md @@ -303,7 +303,21 @@ importance of testing, Beam has a robust set of unit tests, as well as testing coverage measurement tools, which protect the codebase from simple to moderate breakages. Beam Java unit tests are written in JUnit. -#### How to run NeedsRunner tests +#### How to run Python unit tests + +Python tests are written using the standard Python unittest library. +To run all unit tests, execute the following command in the ``sdks/python`` +subdirectory + +``` +python setup.py test [-s apache_beam.package.module.TestClass.test_method] +``` + +We also provide a [tox](https://tox.readthedocs.io/en/latest/) configuration +in that same directory to run all the tests, including lint, cleanly in all +desired configurations. + +#### How to run Java NeedsRunner tests NeedsRunner is a category of tests that require a Beam runner. A subset of these tests cannot be executed while building their corresponding modules because all @@ -453,7 +467,13 @@ PAssert.that(pCollection).containsInAnyOrder(WHATEVER); ``` ```py -# Unsupported in Beam's Python SDK. +# The suggested pattern of using pipelines as targets of with statements +# eliminates the possibility for this kind of error or a framework +# to catch it. + +with beam.Pipeline(...) as p: + [...arbitrary construction...] + # p.run() is automatically called on successfully exiting the context ``` The `PAssert` at the end of this test method will not be executed, since @@ -490,7 +510,7 @@ public void testReadingFailsTableDoesNotExist() throws Exception { ``` ```py -# Unsupported in Beam's Python SDK. +# Unneeded in Beam's Python SDK. ``` The application of the `read` transform throws an exception, which is then -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
