leezu commented on a change in pull request #18363:
URL: https://github.com/apache/incubator-mxnet/pull/18363#discussion_r427640438



##########
File path: conftest.py
##########
@@ -229,3 +230,50 @@ def doctest(doctest_namespace):
         logging.warning('Unable to import numpy/mxnet. Skipping conftest.')
     import doctest
     doctest.ELLIPSIS_MARKER = '-etc-'
+
+
[email protected](scope='session')
+def mxnet_module():
+    import mxnet
+    return mxnet
+
+
[email protected]()
+# @pytest.fixture(autouse=True)  # Fix all the bugs and mark this autouse=True
+def check_leak_ndarray(mxnet_module):

Review comment:
       conftest is run for any pytest session started in the mxnet folder. But 
some of our tests (such as for website build) do not have mxnet present. So we 
can't just 'import mxnet' in the top of the file.
   
   Instead, the mxnet_module is a pytest fixture that can be used to get mxnet 
module. It will only be run if the tests requests it (as here).
   
   Autouse must be used to apply the check_leak_ndarray before and after every 
other mxnet test. Currently there are too many bugs, so we can't enable it. 
Later, when the bugs are fixed it can be enabled.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to