Skip to content

Commit a99b671

Browse files
add new tests for pypi setup.py
Signed-off-by: Siddhant Khare <siddhantkhare2694@gmail.com>
1 parent 96c73a2 commit a99b671

4 files changed

Lines changed: 82 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"type": "pypi",
3+
"namespace": null,
4+
"name": "arpy",
5+
"version": "0.1.1",
6+
"qualifiers": {},
7+
"subpath": null,
8+
"primary_language": "Python",
9+
"description": "Library for accessing \"ar\" files",
10+
"release_date": null,
11+
"parties": [
12+
{
13+
"type": "person",
14+
"role": "author",
15+
"name": "Stanis\u0142aw Pitucha",
16+
"email": "viraptor@gmail.com",
17+
"url": "http://bitbucket.org/viraptor/arpy"
18+
}
19+
],
20+
"keywords": [],
21+
"homepage_url": "http://bitbucket.org/viraptor/arpy",
22+
"download_url": null,
23+
"size": null,
24+
"sha1": null,
25+
"md5": null,
26+
"sha256": null,
27+
"sha512": null,
28+
"bug_tracking_url": null,
29+
"code_view_url": null,
30+
"vcs_url": null,
31+
"copyright": null,
32+
"license_expression": "bsd-simplified",
33+
"declared_license": {
34+
"license": "Simplified BSD",
35+
"classifiers": []
36+
},
37+
"notice_text": null,
38+
"root_path": null,
39+
"dependencies": [],
40+
"contains_source_code": null,
41+
"source_packages": [],
42+
"purl": "pkg:pypi/arpy@0.1.1",
43+
"repository_homepage_url": "https://pypi.org/project/arpy",
44+
"repository_download_url": "https://pypi.io/packages/source/a/arpy/arpy-0.1.1.tar.gz",
45+
"api_data_url": "http://pypi.python.org/pypi/arpy/0.1.1/json"
46+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
from distutils.core import setup
5+
6+
setup(name='arpy',
7+
version='0.1.1',
8+
description='Library for accessing "ar" files',
9+
author=u'Stanisław Pitucha',
10+
author_email='viraptor@gmail.com',
11+
url='http://bitbucket.org/viraptor/arpy',
12+
py_modules=['arpy'],
13+
license="Simplified BSD",
14+
)
15+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from setuptools import setup
2+
3+
setup(
4+
version="1.0.0",
5+
description="A sample package",
6+
author="Test",
7+
author_email="test@gmail.com",
8+
package_requires=[])

tests/packagedcode/test_pypi.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,19 @@ def test_parse_setup_py_xmltodict(self):
224224
expected_loc = self.get_test_loc('pypi/setup.py/xmltodict_setup.py-expected.json')
225225
self.check_package(package, expected_loc, regen=False)
226226

227+
def test_parse_setup_py_with_name(self):
228+
test_file = self.get_test_loc('pypi/setup.py/with_name.py')
229+
packages = pypi.parse_setup_py(test_file)
230+
expected_loc = self.get_test_loc('pypi/setup.py/with_name.py.expected')
231+
self.check_packages(packages, expected_loc, regen=False)
232+
233+
def test_parse_setup_py_without_name(self):
234+
test_file = self.get_test_loc('pypi/setup.py/without_name.py')
235+
try:
236+
pypi.parse_setup_py(test_file)
237+
except AttributeError as e:
238+
assert "'NoneType' object has no attribute 'to_dict'" in str(e)
239+
227240
def test_pkginfo_parse_with_unpackaged_source(self):
228241
test_file = self.get_test_loc('pypi')
229242
package = pypi.parse_unpackaged_source(test_file)

0 commit comments

Comments
 (0)