You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by al...@apache.org on 2019/01/24 00:21:20 UTC
[beam] branch master updated: Skipping cython-requiring tests on
cython absence
This is an automated email from the ASF dual-hosted git repository.
altay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new f899965 Skipping cython-requiring tests on cython absence
new fc4c6ba Merge pull request #7606 from pabloem/fastcodtest
f899965 is described below
commit f8999656e46301d40452a6371cfcb87776455675
Author: Pablo <pa...@google.com>
AuthorDate: Wed Jan 23 11:56:55 2019 -0800
Skipping cython-requiring tests on cython absence
---
sdks/python/apache_beam/coders/fast_coders_test.py | 5 +++++
sdks/python/apache_beam/coders/typecoders_test.py | 7 +++++++
sdks/python/apache_beam/tools/utils.py | 2 +-
sdks/python/setup.cfg | 6 ------
4 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/sdks/python/apache_beam/coders/fast_coders_test.py b/sdks/python/apache_beam/coders/fast_coders_test.py
index eb40773..2a43c614 100644
--- a/sdks/python/apache_beam/coders/fast_coders_test.py
+++ b/sdks/python/apache_beam/coders/fast_coders_test.py
@@ -24,11 +24,16 @@ import unittest
# Run all the standard coder test cases.
from apache_beam.coders.coders_test_common import *
+from apache_beam.tools import utils
class FastCoders(unittest.TestCase):
def test_using_fast_impl(self):
+ try:
+ utils.check_compiled('apache_beam.coders')
+ except RuntimeError:
+ self.skipTest('Cython is not installed')
# pylint: disable=wrong-import-order, wrong-import-position
# pylint: disable=unused-variable
import apache_beam.coders.stream
diff --git a/sdks/python/apache_beam/coders/typecoders_test.py b/sdks/python/apache_beam/coders/typecoders_test.py
index cff2506..64843ae 100644
--- a/sdks/python/apache_beam/coders/typecoders_test.py
+++ b/sdks/python/apache_beam/coders/typecoders_test.py
@@ -24,6 +24,7 @@ from builtins import object
from apache_beam.coders import coders
from apache_beam.coders import typecoders
from apache_beam.internal import pickler
+from apache_beam.tools import utils
from apache_beam.typehints import typehints
@@ -60,6 +61,12 @@ class CustomCoder(coders.Coder):
class TypeCodersTest(unittest.TestCase):
+ def setUp(self):
+ try:
+ utils.check_compiled('apache_beam.coders')
+ except RuntimeError:
+ self.skipTest('Cython is not installed')
+
def test_register_non_type_coder(self):
coder = CustomCoder()
with self.assertRaises(TypeError) as e:
diff --git a/sdks/python/apache_beam/tools/utils.py b/sdks/python/apache_beam/tools/utils.py
index 203d629..0d99b46 100644
--- a/sdks/python/apache_beam/tools/utils.py
+++ b/sdks/python/apache_beam/tools/utils.py
@@ -34,7 +34,7 @@ def check_compiled(module):
Args:
module: string, module name
"""
- check_module = __import__(module, globals(), locals(), -1)
+ check_module = __import__(module, globals(), locals())
ext = os.path.splitext(check_module.__file__)[-1]
if ext in ('.py', '.pyc'):
raise RuntimeError(
diff --git a/sdks/python/setup.cfg b/sdks/python/setup.cfg
index 041d6fa..69a5187 100644
--- a/sdks/python/setup.cfg
+++ b/sdks/python/setup.cfg
@@ -19,12 +19,6 @@
# Allow discovery of Python test files marked executable.
exe=True
verbosity=2
-# TODO(silviuc): Find a way to run the remaining tests excluded here.
-#
-# The following tests are excluded because they try to load the Cython-based
-# fast_coders module which is not available when running unit tests:
-# fast_coders_test and typecoders_test.
-exclude=fast_coders_test|typecoders_test
# Creates an xml file compatible with standard XUnit XML format.
with-xunit=1