szha closed pull request #11799:  Some Python 3 fixes in ./tests
URL: https://github.com/apache/incubator-mxnet/pull/11799
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/tests/nightly/TestDoc/doc_spell_checker.py 
b/tests/nightly/TestDoc/doc_spell_checker.py
index 88baab85f8d..53941c3d4d7 100644
--- a/tests/nightly/TestDoc/doc_spell_checker.py
+++ b/tests/nightly/TestDoc/doc_spell_checker.py
@@ -32,8 +32,11 @@
 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 458028b9e53..99d8d09805e 100644
--- a/tests/python/gpu/test_operator_gpu.py
+++ b/tests/python/gpu/test_operator_gpu.py
@@ -46,8 +46,8 @@
 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 bd34eff1116..7395e7ecce4 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_import():
             os.environ['MXNET_ENGINE_TYPE'] = type
         test_import()
 
+
 if __name__ == '__main__':
     import nose
     nose.runmodule()


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to