[Numpy-discussion] Should I introduce a new friendly and efficient way to running and debugging numpy test case?
ChunLin Fang
qiyu8f at gmail.com
Wed May 13 08:11:39 EDT 2020
Hi, everyone!
I'm Qiyu8 <https://github.com/Qiyu8>, Currently, Numpy recommend a command
line method to run test case as demonstrated in Testing Guidelines
<https://numpy.org/devdocs/reference/testing.html#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 <https://code.visualstudio.com/Download>.*
*2.Open numpy source folder. File -> Open Folder.*
[image: image.png]
*3.Install the Python extension from your extensions:*
[image: 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: 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: image.png]
Then you can running and debugging any test case that you want.
[image: image.png]
[image: image.png]
The fallback of this method is that you have to rebuild numpy before
execute testcase if you changed numpy's source code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20200513/c8ff8fe2/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 37393 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20200513/c8ff8fe2/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 139766 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20200513/c8ff8fe2/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 103333 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20200513/c8ff8fe2/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 4144 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20200513/c8ff8fe2/attachment-0009.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 32230 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20200513/c8ff8fe2/attachment-0010.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 65449 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20200513/c8ff8fe2/attachment-0011.png>
More information about the NumPy-Discussion
mailing list