Skip to content

Add a 'test' command to setup.py - #30

Merged
eteq merged 4 commits into
astropy:masterfrom
embray:setup-test
Oct 26, 2011
Merged

eteq merged 4 commits into
astropy:masterfrom
embray:setup-test

Conversation

@embray

@embray embray commented Oct 21, 2011

Copy link
Copy Markdown
Member

Adds a 'test' command to the setup.py (distribute comes with a test command but it doesn't work with py.test, so this replaces it outright). This also supports all the existing options to astropy.test() such as module and verbose.

With this it's possible to run all the tests with just setup.py test even if astropy hasn't been installed or built yet. If necessary it will first build extension modules and make them importable.

Comment thread astropy/tests/helper.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought instances of AstroPy were recently changed to Astropy? @eteq will know better than me.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All I'm aware of is that the name was changed from AstroPy to astropy in the package metadata. Other than that I thought it was still AstroPy...?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed all the documentation references to "Astropy", on the theory that the proper name should be the package name (so the first letter is capitalized just because its a name). No one else voiced an opinion on the mailing list, so the path-of-least-resistance is probably to stick with "Astropy" unless someone has a strong opinion on the capitalization.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember your e-mail but I don't remember that part of it--I thought it was just about changing the distribution name. In any case, I'm fine with that, and I'll put it back.

@astrofrog

Copy link
Copy Markdown
Member

Works for me! Just made a couple of small comments in the source code, but once those are fixed it seems ready to me.

Comment thread astropy/tests/helper.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to write this myself, and noticed that in the distribute test command, they have a separate block of code to deal with use_2to3 option. Is this of concern to us?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to take a look at that--does distribute's test command try to run the tests on 2to3'd code? If so, we'll want to support that functionality as well, at least eventually.

@phn

phn commented Oct 22, 2011

Copy link
Copy Markdown
Contributor

Using Python 3.2, I get the following error:

Traceback (most recent call last):
  File "setup.py", line 71, in <module>
    extensions.extend(package.get_extensions(BUILD))
  File "/home/phn/code/astropy-forks/iguananaut/astropy/wcs/setup_package.py", line 169, in get_extensions
    generate_c_docstrings()
  File "/home/phn/code/astropy-forks/iguananaut/astropy/wcs/setup_package.py", line 96, in generate_c_docstrings
    docstrings[key] = docstrings[key].encode('utf8').lstrip() + '\0'
TypeError: can't concat bytes to str

@mdboom

mdboom commented Oct 23, 2011

Copy link
Copy Markdown
Contributor

@phn: I think I introduced this bug. I'll fix it in master (since it really exists there) and maybe @iguananaut can rebase this branch of it?

@embray

embray commented Oct 24, 2011

Copy link
Copy Markdown
Member Author

This leads me to another question, and I forget whether or not this has been decided and documented anywhere: Are we officially supporting Python 3 currently? My thinking was that we were coding with Python 3 in mind (requiring Python 2.6 and using as many Py3-isms as possible) but not necessarily officially supporting Python 3 yet.

If we are dedicating ourselves to Python 3 support now that's fine too. But I'll want to get astropy up and running with tox (with documentation on how to set that up) in order to facilitate cross-version testing. The only thing that makes this tricky is that tox uses pip to install dependencies when setting up its virtual environments. And numpy currently does not play well with pip (I've submitted patches to both numpy and pip to fix this issue since both are partially to blame, but those patches aren't available in any current release of those projects).

@astrofrog

Copy link
Copy Markdown
Member

I think we are going with Python 3.x compatibility now as much as possible (see http://astropy.org/development/codeguide.html#interface-and-dependencies).

@embray

embray commented Oct 24, 2011

Copy link
Copy Markdown
Member Author

In that case I'll make sure this works on Python 3 before suggesting that it be pulled.

@embray

embray commented Oct 25, 2011

Copy link
Copy Markdown
Member Author

After giving it a try, this is working fine currently on 3.2 (haven't tried 3.1). That is in part, of course, since none of the current code needs to be 2to3'd. I don't think that will be the case forever (vo.table, pyfits) so there still needs to be a solution for when we get to that point. But at least it works for now.

@eteq

eteq commented Oct 26, 2011

Copy link
Copy Markdown
Member

This pull request now conflicts quite a bit from some of the recently merged changes... perhaps you should merge with the new master and then rebase? It's not obvious to me what the best solution for the merge conflicts is...

@embray

embray commented Oct 26, 2011

Copy link
Copy Markdown
Member Author

Hrm, I haven't pulled from master in a while. I'll give it a look tomorrow.

…ommand but it doesn't work with py.test, so this replaces it outright). This also supports all the existing options to astropy.test() such as module and verbose.
@embray

embray commented Oct 26, 2011

Copy link
Copy Markdown
Member Author

Okay, I rebased this on master--seems good now. Sorry for all the whitespace changes--my editor is configured to strip extra whitespace from blank lines.

@astrofrog

Copy link
Copy Markdown
Member

Looks good to me! By the way, you can add ?w=0 to a github URL to hide whitespace diffs:

https://github.com/astropy/astropy/pull/30/files?w=0

Useful!

eteq added a commit that referenced this pull request Oct 26, 2011
Add a 'test' command to setup.py
@eteq
eteq merged commit 49a052e into astropy:master Oct 26, 2011
mhvk referenced this pull request in mhvk/astropy Jul 14, 2013
keflavich pushed a commit to keflavich/astropy that referenced this pull request Oct 9, 2013
embray pushed a commit to embray/astropy that referenced this pull request Jan 23, 2015
Fix smart resolver for descriptor classes
Cadair pushed a commit to Cadair/astropy that referenced this pull request Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants