[
https://issues.apache.org/jira/browse/AVRO-2437?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Fokko Driesprong updated AVRO-2437:
-----------------------------------
Resolution: Fixed
Fix Version/s: 1.10.0
Status: Resolved (was: Patch Available)
> Fix Py3 test not to omit "test skipped" message
> -----------------------------------------------
>
> Key: AVRO-2437
> URL: https://issues.apache.org/jira/browse/AVRO-2437
> Project: Apache Avro
> Issue Type: Improvement
> Components: build, python
> Reporter: Kengo Seki
> Assignee: Kengo Seki
> Priority: Minor
> Fix For: 1.10.0
>
>
> In connection with AVRO-2436, the tests for Python3 doesn't show the
> following message,
> {code:title=lang/py3/avro/tests/test_datafile.py}
> try:
> import snappy
> CODECS_TO_VALIDATE += ('snappy',)
> except ImportError:
> logging.info('Snappy not present, will skip testing it.')
> {code}
> even if python3-snappy is not installed.
> {code}
> $ cd lang/py3
> $ python -c "import snappy"
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> ImportError: No module named snappy
> $ python3 setup.py test 2>&1 | grep skip
> $
> {code}
> So users can't notice that snappy codec is not tested.
> This is because of the processing order in run_tests.py. It imports
> test_datafile.py before calling {{SetupLogging()}}, so the logging message in
> test_datafile.py is not displayed.
> {code:title=lang/py3/avro/tests/run_tests.py}
> from avro.tests.test_datafile import *
> (snip)
> def SetupLogging():
> log_level = int(os.environ.get('PYTHON_LOG_LEVEL', logging.INFO))
> log_formatter = logging.Formatter(
> '%(asctime)s %(levelname)s %(filename)s:%(lineno)s : %(message)s')
> logging.root.handlers = list() # list.clear() only exists in python 3.3+
> logging.root.setLevel(log_level)
> console_handler = logging.StreamHandler()
> console_handler.setFormatter(log_formatter)
> console_handler.setLevel(logging.DEBUG)
> logging.root.addHandler(console_handler)
> SetupLogging()
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)