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/coders/fast_coders_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@

# 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
Expand Down
7 changes: 7 additions & 0 deletions sdks/python/apache_beam/coders/typecoders_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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


Expand Down Expand Up @@ -60,6 +61,12 @@ def is_deterministic(self):

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:
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/apache_beam/tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 0 additions & 6 deletions sdks/python/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down