Should I introduce a new friendly and efficient way to running and debugging numpy test case?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Should I introduce a new friendly and efficient way to running and debugging numpy test case?

ChunLin Fang

Hi, everyone!

 

I'm Qiyu8, Currently, Numpy recommend a command line method to run test case as demonstrated in Testing Guidelines ,Which is heavy and inconvenient, It's also a little painful if test cases can not debug in a visualize way, I happened to find an easier way to running and debugging numpy test case as below:

1.Download VS Code here.

2.Open numpy source folder. File -> Open Folder.

image.png

3.Install the Python extension from your extensions:

image.png

4.Configuring Tests: Pytest

The VS Code Python extension supports unit tests as well as pytest. Here's how to enable the framework:

Open Command Palette (ctrl +shift +P) and start typing ‘python: configure tests.’ It will display a list of available python linters. You can add any of the settings to your user settings.json file (opened with the File > Preferences > Settings)

image.png

Edit the settings.json file like this:

{

    "python.pythonPath""C:\\Python36\\python.exe",

    "python.linting.pylintEnabled"true,

    "python.linting.enabled"true,

    "python.testing.unittestEnabled"false,

    "python.testing.nosetestsEnabled"false,

    "python.testing.pytestEnabled"true,

    "python.testing.pytestArgs": [

        "./numpy/tests/",

        "./numpy/core/tests/"

    ]

}

Click "Discover Tests"

image.png

Then you can running and debugging any test case that you want.

image.png
image.png

The fallback of this method is that you have to rebuild numpy before execute testcase if you changed numpy's source code.

 


_______________________________________________
NumPy-Discussion mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion