Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sdks/python/apache_beam/io/filesystem_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,8 @@ def test_tell(self):
self.assertEqual(current_offset, readable.tell())
if not line:
break


if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
5 changes: 5 additions & 0 deletions sdks/python/apache_beam/io/filesystemio_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,8 @@ def test_pipe_stream(self):
parent_conn.send_bytes(data)
parent_conn.close()
child_thread.join()


if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
5 changes: 5 additions & 0 deletions sdks/python/apache_beam/io/filesystems_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,8 @@ def test_delete_error(self):
r'^Delete operation failed') as error:
FileSystems.delete([path1])
self.assertEqual(error.exception.exception_details.keys(), [path1])


if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
5 changes: 5 additions & 0 deletions sdks/python/apache_beam/io/gcp/gcsfilesystem_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,3 +340,8 @@ def test_delete_error(self, mock_gcsio):
self.fs.delete(files)
self.assertEqual(error.exception.exception_details, expected_results)
gcsio_mock.delete_batch.assert_called()


if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
5 changes: 5 additions & 0 deletions sdks/python/apache_beam/io/hadoopfilesystem_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,3 +493,8 @@ def test_delete_error(self):
r'^Delete operation failed .* %s' % path1):
self.fs.delete([url1, url2])
self.assertFalse(self.fs.exists(url2))


if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
5 changes: 5 additions & 0 deletions sdks/python/apache_beam/io/localfilesystem_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,8 @@ def test_delete_error(self):
r'^Delete operation failed') as error:
self.fs.delete([path1])
self.assertEqual(error.exception.exception_details.keys(), [path1])


if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
5 changes: 5 additions & 0 deletions sdks/python/apache_beam/options/value_provider_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,8 @@ def _add_argparse_args(cls, parser):
options = UserDefinedOptions(['--vpt_vp_arg13', 'a', '--vpt_vp_arg14', '2'])
self.assertEqual(options.vpt_vp_arg13.get(), 'a')
self.assertEqual(options.vpt_vp_arg14.get(), 2)


if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
5 changes: 5 additions & 0 deletions sdks/python/apache_beam/transforms/create_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,8 @@ def test_create_source_progress(self):

self.assertEqual(
expected_split_points_report, split_points_report)


if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
5 changes: 5 additions & 0 deletions sdks/python/apache_beam/transforms/util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,8 @@ def test_reshuffle_streaming_global_window(self):
assert_that(after_reshuffle, equal_to(expected_data),
label='after reshuffle')
pipeline.run()


if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
13 changes: 13 additions & 0 deletions sdks/python/run_pylint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ echo "Running pycodestyle for module $MODULE:"
pycodestyle "$MODULE" --exclude="$FILES_TO_IGNORE"
echo "Running flake8 for module $MODULE:"
flake8 $MODULE --count --select=E999 --show-source --statistics
Copy link

@cclauss cclauss Mar 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My sense is that E901,E999,F821,F822,F823 are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. The other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety.

I would therefore suggest replacing --select=E999 with --select=E901,E999,F822,F823 because the codebase currently passes all of these tests and we would like to avoid any backsliding. We would also want to add F821 (undefined names!) to that list but work must be completed on basestring, buffer(), cmp(), file(), unicode, xrange(), and #4561 before that can be done.

@holdenk

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, did you mean to make a comment on this PR?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. As long as changes are being made, this is a good one to make as well. Just want to avoid backsliding.


echo "Running isort for module $MODULE:"
# Skip files where isort is behaving weirdly
ISORT_EXCLUDED=(
Expand All @@ -87,6 +88,7 @@ done
pushd "$MODULE"
isort -p apache_beam --line-width 120 --check-only --order-by-type --combine-star --force-single-line-imports --diff ${SKIP_PARAM}
popd

FUTURIZE_EXCLUDED=(
"typehints.py"
"pb2"
Expand All @@ -105,3 +107,14 @@ if [ "$count" != "0" ]; then
exit 1
fi
echo "No future changes needed"

echo "Checking unittest.main for module ${MODULE}:"
TESTS_MISSING_MAIN=$(find ${MODULE} | grep '\.py$' | xargs grep -l '^import unittest$' | xargs grep -L unittest.main)
if [ -n "${TESTS_MISSING_MAIN}" ]; then
echo -e "\nThe following files are missing a call to unittest.main():"
for FILE in ${TESTS_MISSING_MAIN}; do
echo " ${FILE}"
done
echo
exit 1
fi