[PATCH 1 of 2] CleanUp: strip whitespaces from setup.py

3 views
Skip to first unread message

Ondrej Certik

unread,
May 7, 2008, 9:34:35 AM5/7/08
to sympy-...@googlegroups.com
Patch subject is complete summary.


cleanup.patch

Ondrej Certik

unread,
May 7, 2008, 9:34:36 AM5/7/08
to sympy-...@googlegroups.com
Also the test file was refactored a bit.


sympy-2.patch

Felix Kaiser

unread,
May 7, 2008, 11:55:25 AM5/7/08
to sympy-...@googlegroups.com
On Wednesday 07 May 2008 15:34:36 Ondrej Certik wrote:
> Also the test file was refactored a bit.
>

From the patch:
>-test_no_trailing_whitespace_and_no_tabs()
>+ # go to the root directory (where setup.py is)
>+ path = path + sep + pardir + sep + pardir + sep + pardir
>+ sympy_root = abspath(path)
>+ check_directory_tree(sympy_root)

This might be a bad idea: what if you want to run the tests *after*
installation?

I think putting the code-quality tests into sympy/utilities/tests was a bad
idea. I should have chosen bin/.

Ondrej Certik

unread,
May 7, 2008, 12:47:18 PM5/7/08
to sympy-...@googlegroups.com
On Wed, May 7, 2008 at 5:55 PM, Felix Kaiser <what...@gmail.com> wrote:
>
> On Wednesday 07 May 2008 15:34:36 Ondrej Certik wrote:
>> Also the test file was refactored a bit.
>>
>
> From the patch:
>>-test_no_trailing_whitespace_and_no_tabs()
>>+ # go to the root directory (where setup.py is)
>>+ path = path + sep + pardir + sep + pardir + sep + pardir
>>+ sympy_root = abspath(path)
>>+ check_directory_tree(sympy_root)
>
> This might be a bad idea: what if you want to run the tests *after*
> installation?

Thanks for noticing. Well I think the tests are not copied by
"setup.py install", are they?

So you probably mean just copying the sympy dir by hand, right?

> I think putting the code-quality tests into sympy/utilities/tests was a bad
> idea. I should have chosen bin/.

Let's move it, no problem. However moving it to bin, it won't be
executed by py.tests, as they test the sympy/ dir only, so
I suggest to leave it in utilities, but only test files in the sympy/ dir.
And create another one (in bin/ dir) that will test examples +
setup.py and this will be run by hand on each release. What do you
think?

Ondrej

Felix Kaiser

unread,
May 7, 2008, 2:22:48 PM5/7/08
to sympy-...@googlegroups.com
On Wednesday 07 May 2008 18:47:18 Ondrej Certik wrote:
> On Wed, May 7, 2008 at 5:55 PM, Felix Kaiser <what...@gmail.com> wrote:
> > On Wednesday 07 May 2008 15:34:36 Ondrej Certik wrote:
> >> Also the test file was refactored a bit.
> >
> > From the patch:
> >>-test_no_trailing_whitespace_and_no_tabs()
> >>+ # go to the root directory (where setup.py is)
> >>+ path = path + sep + pardir + sep + pardir + sep + pardir
> >>+ sympy_root = abspath(path)
> >>+ check_directory_tree(sympy_root)
> >
> > This might be a bad idea: what if you want to run the tests *after*
> > installation?
>
> Thanks for noticing. Well I think the tests are not copied by
> "setup.py install", are they?

Unfortunately, they are.

At least the ones in sympy/, but not the ones in bin/. So tests in bin/ are
only executed before installation, which is exactly what we want.

> So you probably mean just copying the sympy dir by hand, right?
>
> > I think putting the code-quality tests into sympy/utilities/tests was a
> > bad idea. I should have chosen bin/.
>
> Let's move it, no problem. However moving it to bin, it won't be
> executed by py.tests, as they test the sympy/ dir only, so
> I suggest to leave it in utilities, but only test files in the sympy/ dir.
> And create another one (in bin/ dir) that will test examples +
> setup.py and this will be run by hand on each release. What do you
> think?

I tried it: py.test does execute tests in bin/. So there should not be a
problem.

By the way, you are suggesting to have two files for one thing, an idea I do
not like much.

Felix

Ondrej Certik

unread,
May 20, 2008, 6:11:58 PM5/20/08
to sympy-patches


On May 7, 8:22 pm, Felix Kaiser <whatf...@gmail.com> wrote:
> On Wednesday 07 May 2008 18:47:18 Ondrej Certik wrote:
>
>
>
> > On Wed, May 7, 2008 at 5:55 PM, Felix Kaiser <whatf...@gmail.com> wrote:
> > > On Wednesday 07 May 2008 15:34:36 Ondrej Certik wrote:
> > >> Also the test file was refactored a bit.
>
> > > From the patch:
> > >>-test_no_trailing_whitespace_and_no_tabs()
> > >>+ # go to the root directory (where setup.py is)
> > >>+ path = path + sep + pardir + sep + pardir + sep + pardir
> > >>+ sympy_root = abspath(path)
> > >>+ check_directory_tree(sympy_root)
>
> > > This might be a bad idea: what if you want to run the tests *after*
> > > installation?
>
> > Thanks for noticing. Well I think the tests are not copied by
> > "setup.py install", are they?
>
> Unfortunately, they are.
>
> At least the ones in sympy/, but not the ones in bin/. So tests in bin/ are
> only executed before installation, which is exactly what we want.

I created a new issue for this:

http://code.google.com/p/sympy/issues/detail?id=852

>
> > So you probably mean just copying the sympy dir by hand, right?
>
> > > I think putting the code-quality tests into sympy/utilities/tests was a
> > > bad idea. I should have chosen bin/.
>
> > Let's move it, no problem. However moving it to bin, it won't be
> > executed by py.tests, as they test the sympy/ dir only, so
> > I suggest to leave it in utilities, but only test files in the sympy/ dir.
> > And create another one (in bin/ dir) that will test examples +
> > setup.py and this will be run by hand on each release. What do you
> > think?
>
> I tried it: py.test does execute tests in bin/. So there should not be a
> problem.

Yes, but not "setup.py test" and that's imho good, because py.test
executes anything that have some "test" in the name, e.g.:

bin/test_import.py[0]
examples/fem_test.py[0]

Which I am not sure we want. We can rename those two files though.

>
> By the way, you are suggesting to have two files for one thing, an idea I do
> not like much.

That I don't like either. But imho here it is not the same thing ---
all tests in the sympy/ dir should be self contained and only test
things in that dir.
Plus we have some Q&A tests outside of the sympy/ dir, for example bin/
test_import.py, bin/test_pure etc. So imho it's ok to add more tests,
like for the setup.py.

Ondrej

Ondrej Certik

unread,
Jun 9, 2008, 6:56:18 PM6/9/08
to sympy-patches
What is the state of this -- is it ok to commit, or shall the patch be
reworked (in which case, how should we fix the problem?)?

Ondrej

Felix Kaiser

unread,
Jun 12, 2008, 2:52:33 PM6/12/08
to sympy-...@googlegroups.com

I think that is a good idea. From the Zen of Python:

"Special cases aren't special enough to break the rules."

If its not a test module, don't make it look like one. Makes our lives easier.

> >
> > > By the way, you are suggesting to have two files for one thing, an idea
> > > I do not like much.
> >
> > That I don't like either. But imho here it is not the same thing ---
> > all tests in the sympy/ dir should be self contained and only test
> > things in that dir.
> > Plus we have some Q&A tests outside of the sympy/ dir, for example bin/
> > test_import.py, bin/test_pure etc. So imho it's ok to add more tests,
> > like for the setup.py.
>
> What is the state of this -- is it ok to commit, or shall the patch be
> reworked (in which case, how should we fix the problem?)?
>
> Ondrej

I think its best to put quality assurance tests in bin/, so that they won't
get installed. They are not really "features" of sympy.

Also see my comments on #852.

Sorry for delay, by the way.

Felix

Reply all
Reply to author
Forward
0 new messages