Skip to content

Commit

Permalink
Add test for dparse function #253
Browse files Browse the repository at this point in the history
Signed-off-by: Li <[email protected]>
  • Loading branch information
Li committed Jun 11, 2019
1 parent c64548e commit 0c579ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions tests/packagedcode/data/pypi/dparse/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lxml==3.4.4
requests==2.7.0
13 changes: 10 additions & 3 deletions tests/packagedcode/test_pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@
import json
import os

from unittest.case import expectedFailure

from packagedcode import pypi
from packagedcode.models import DependentPackage

from packages_test_utils import PackageTester
from unittest.case import expectedFailure



class TestPyPi(PackageTester):
Expand Down Expand Up @@ -279,4 +280,10 @@ def test_pkginfo_parse_with_wheelfile_with_parse_function(self):
test_file = self.get_test_loc('pypi/wheel/atomicwrites-1.2.1-py2.py3-none-any.whl')
package = pypi.parse2(test_file)
expected_loc = self.get_test_loc('pypi/wheel/parse-wheel-expected.json')
self.check_package(package, expected_loc, regen=False)
self.check_package(package, expected_loc, regen=False)

def test_parse_with_dparse(self):
test_file = self.get_test_loc('pypi/dparse/requirements.txt')
dependencies = pypi.parse_with_dparse(test_file)
assert [DependentPackage(purl=u'pkg:pypi/lxml', requirement=None, scope='dependencies'),
DependentPackage(purl=u'pkg:pypi/requests', requirement=None, scope='dependencies')] == dependencies

0 comments on commit 0c579ad

Please sign in to comment.