Python Package: Difference between revisions
From charlesreid1
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
<pre> | <pre> | ||
myproject/ | myproject/ | ||
setup.py | setup.py | ||
myproject/ | myproject/ | ||
__init__.py | __init__.py | ||
| Line 8: | Line 10: | ||
somecode.py | somecode.py | ||
morecode.py | morecode.py | ||
tests/ | |||
test_code.py | |||
test_somecode.py | |||
test_morecode.py | |||
</pre> | </pre> | ||
==Setup.py== | ==Setup.py== | ||
<pre> | <pre> | ||
try: | try: | ||
| Line 32: | Line 40: | ||
setup(**config) | setup(**config) | ||
</pre> | |||
==Test_code.py== | |||
<pre> | |||
from nose.tools import * | |||
import NAME | |||
def setup(): | |||
print "setup" | |||
def teardown(): | |||
print "tear down" | |||
def test_basic(): | |||
print "i run good" | |||
</pre> | </pre> | ||
Revision as of 00:46, 19 March 2015
myproject/
setup.py
myproject/
__init__.py
code.py
submodule/
somecode.py
morecode.py
tests/
test_code.py
test_somecode.py
test_morecode.py
Setup.py
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'My Project',
'author': 'My Name',
'url': 'URL to get it at.',
'download_url': 'Where to download it.',
'author_email': 'My email.',
'version': '0.1',
'install_requires': ['nose'],
'packages': ['NAME'],
'scripts': [],
'name': 'projectname'
}
setup(**config)
Test_code.py
from nose.tools import *
import NAME
def setup():
print "setup"
def teardown():
print "tear down"
def test_basic():
print "i run good"