How to test the changes done in sympy

30 views
Skip to first unread message

Praneeth Shetty

unread,
Jan 3, 2021, 3:08:41 PM1/3/21
to sympy
I recently started Open-Sourcing.....
As I was Familiar with Python and Sympy. I installed the repository successfully and am trying to fix some bugs to get familiar with its directories and code flow. So I just needed to know that how to build the sympy or how to test the changes that I have done in the codes....

Regards,
Praneeth

gu...@uwosh.edu

unread,
Jan 3, 2021, 3:50:21 PM1/3/21
to sympy
Praneeth,

I agree this can be confusing. To get started testing your code you will need some things installed in your venv:
1. pytest
2. pytest-doctestplus
3. pyflakes
You can see what is installed if you are in your venv shell (`pipenv shell` to enter if you are using pipenv), using the `pip list` command.
Within your environment all three of these tools can be installed using statements of the form `pip install -U ...`.

Once these are installed you need to use `pyflakes` to check format, syntax and simple coding mistakes. Then `pytest` for running tests. I suggest your start by running these only on the parts of the code you are working on. For example if you modified the file `ppp.py` then you should run do the following different runs:
```
pyflakes <path-to>/ppp.py
[read the output carefully]
pytest <path-to>/test_ppp.py
[read the output carefully]
pytest --doctest-plus <path-to>/ppp.py
[read the output carefully]
```
Where <path-to> needs to be replaced with the appropriate path in your directory structure.

If you think what you are doing might impact other parts of the code you can just run a bare `pytest` command. This will take a long time (many hours unless you have a very fast machine and break it up into separate processes) as it will run all the tests in sympy.

Hope this helps.
JG
Reply all
Reply to author
Forward
0 new messages