This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new 0147388 Some Python 3 fixes in ./tests (#11799)
0147388 is described below
commit 01473884c1e228a6d330faa640725ec9c70fb846
Author: cclauss <[email protected]>
AuthorDate: Fri Jul 20 05:02:22 2018 +0200
Some Python 3 fixes in ./tests (#11799)
* Some Python 3 fixes in ./tests
* What version of Python are we testing on?
* Rebuild to workaround of Jenkins issues
* assert False, 'Python ' + sys.version
* Simplify reload() logic
* Revert all changes to test_engine_import.py
---
tests/nightly/TestDoc/doc_spell_checker.py | 7 +++++--
tests/python/gpu/test_operator_gpu.py | 4 ++--
tests/python/unittest/test_engine_import.py | 2 ++
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/tests/nightly/TestDoc/doc_spell_checker.py
b/tests/nightly/TestDoc/doc_spell_checker.py
index 88baab8..53941c3 100644
--- a/tests/nightly/TestDoc/doc_spell_checker.py
+++ b/tests/nightly/TestDoc/doc_spell_checker.py
@@ -32,8 +32,11 @@ from enchant.checker import SpellChecker
import grammar_check
import html2text
-reload(sys)
-sys.setdefaultencoding('utf-8')
+try:
+ reload(sys) # Python 2
+ sys.setdefaultencoding('utf-8')
+except NameError:
+ pass # Python 3
GRAMMAR_CHECK_IGNORE = ['WHITESPACE_RULE', 'DOUBLE_PUNCTUATION',
'EN_QUOTES[1]',
diff --git a/tests/python/gpu/test_operator_gpu.py
b/tests/python/gpu/test_operator_gpu.py
index 458028b..99d8d09 100644
--- a/tests/python/gpu/test_operator_gpu.py
+++ b/tests/python/gpu/test_operator_gpu.py
@@ -46,8 +46,8 @@ from test_sparse_operator import *
from test_ndarray import *
set_default_context(mx.gpu(0))
-del test_support_vector_machine_l1_svm
-del test_support_vector_machine_l2_svm
+del test_support_vector_machine_l1_svm # noqa
+del test_support_vector_machine_l2_svm # noqa
def check_countsketch(in_dim,out_dim,n):
diff --git a/tests/python/unittest/test_engine_import.py
b/tests/python/unittest/test_engine_import.py
index bd34eff..7395e7e 100644
--- a/tests/python/unittest/test_engine_import.py
+++ b/tests/python/unittest/test_engine_import.py
@@ -18,6 +18,7 @@
import os
import sys
+
def test_engine_import():
import mxnet
def test_import():
@@ -39,6 +40,7 @@ def test_engine_import():
os.environ['MXNET_ENGINE_TYPE'] = type
test_import()
+
if __name__ == '__main__':
import nose
nose.runmodule()