Skip to content

Commit

Permalink
add default configuration to ivy file of wheels which have metadata i…
Browse files Browse the repository at this point in the history
…n json file
  • Loading branch information
qlan committed Aug 1, 2018
1 parent e2a1931 commit 9680489
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class WheelsPackage extends PythonPackage {
}

Map<String, List<String>> runtimeRequiresMap = [:]
runtimeRequiresMap['default'] = []

def runRequires = jsonMetadata["run_requires"]
def metaRequires = jsonMetadata["meta_requires"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,43 @@ import spock.lang.Specification

class WheelsPackageTest extends Specification {
private File testDirectory
private WheelsPackage testWheelsPackage
private WheelsPackage testWheelsPackageDjango
private WheelsPackage testWheelsPackagePywin

def setup() {
testDirectory = new File(getClass().getClassLoader().getResource("deps").getFile())
File testPackageFile = new File(testDirectory, "Django-2.0.6-py3-none-any.whl")
File testPackageFileDjango = new File(testDirectory, "Django-2.0.6-py3-none-any.whl")
File testPackageFilePywin32 = new File(testDirectory, "pywin32-223-cp27-cp27m-win_amd64.whl")
DependencySubstitution testDependencySubstitution = new DependencySubstitution([:], [:])
PypiApiCache testPypiApiCache = new PypiApiCache()

testWheelsPackage = new WheelsPackage("Django", "2.0.6", testPackageFile,
testWheelsPackageDjango = new WheelsPackage("Django", "2.0.6", testPackageFileDjango,
testPypiApiCache, testDependencySubstitution)

testWheelsPackagePywin = new WheelsPackage("pywin32", "223", testPackageFilePywin32, testPypiApiCache, testDependencySubstitution)
}

def "test getting runtime requires from metadata Json file"() {
def "test getting runtime requires from metadata Json file for wheel package which has runtime dependencies"() {
when:
def actualResult = testWheelsPackage.getRuntimeRequiresFromMetadataJson()
String expectedResultString = "[argon2:[argon2-cffi (>=16.1.0)], bcrypt:[bcrypt], default:[pytz]]"
def actualResult = testWheelsPackageDjango.getRuntimeRequiresFromMetadataJson()
String expectedResultString = "[default:[pytz], argon2:[argon2-cffi (>=16.1.0)], bcrypt:[bcrypt]]"
then:
actualResult.toString() == expectedResultString
}

def "test getting metadata text file content"() {
def "test getting metadata text file content for wheel package which has runtime dependencies"() {
when:
String actualResult = testWheelsPackage.getMetadataText()
String actualResult = testWheelsPackageDjango.getMetadataText()
String expectedResult = new File(testDirectory, "Django-2.0.6-py3-none-any-METADATA").getText()
then:
actualResult == expectedResult
}

def "test getting runtime requires from metadata Json file for wheel package which has no runtime dependencies"() {
when:
def actualResult = testWheelsPackagePywin.getRuntimeRequiresFromMetadataJson()
String expectedResultString = "[default:[]]"
then:
actualResult.toString() == expectedResultString
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class IvyFileWriterTest extends Specification {
testDirectory = new File(getClass().getClassLoader().getResource("deps").getFile())
}

def "test writing Ivy file for wheels"() {
def "test writing Ivy file for wheel which has runtime dependencies"() {
given:
VersionEntry testVersionEntry = new VersionEntry("testURI", "wheel", "Django-2.0.6-py3-none-any.whl")
IvyFileWriter testIvyFileWriter = new IvyFileWriter("Django", "2.0.6", "bdist_wheel", [testVersionEntry])
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion version.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=0.8.5
version=0.8.6

0 comments on commit 9680489

Please sign in to comment.