Skip to content

Commit

Permalink
Merge pull request #260 from zvezdan/simplify-wheel-cache-test-setup
Browse files Browse the repository at this point in the history
Simplify test setup for wheel cache.
  • Loading branch information
zvezdan committed Nov 9, 2018
2 parents c69713d + 210f721 commit be77e80
Showing 1 changed file with 12 additions and 15 deletions.
Expand Up @@ -25,13 +25,20 @@ class FileBackedWheelCacheTest extends Specification {
@Rule
TemporaryFolder temporaryFolder

def "can find Sphinx-1.6.3"() {
setup:
def wheelCache = temporaryFolder.newFolder('wheel-cache')
def pythonExec = temporaryFolder.newFile('python')
private File wheelCache
private File pythonExec
private FileBackedWheelCache cache

void setup() {
wheelCache = temporaryFolder.newFolder('wheel-cache')
pythonExec = temporaryFolder.newFile('python')
def formats = new DefaultPythonAbiContainer()
formats.addSupportedAbi(new AbiDetails(pythonExec, 'py2', 'none', 'any'))
FileBackedWheelCache cache = new FileBackedWheelCache(wheelCache, formats)
cache = new FileBackedWheelCache(wheelCache, formats)
}

def "can find Sphinx-1.6.3"() {
setup:
new File(wheelCache, 'Sphinx-1.6.3-py2.py3-none-any.whl').createNewFile()

expect:
Expand All @@ -40,11 +47,6 @@ class FileBackedWheelCacheTest extends Specification {

def "does not accept partially matching version"() {
setup: "we have a package with the same version prefix but not matching exactly"
def wheelCache = temporaryFolder.newFolder('wheel-cache')
def pythonExec = temporaryFolder.newFile('python')
def formats = new DefaultPythonAbiContainer()
formats.addSupportedAbi(new AbiDetails(pythonExec, 'py2', 'none', 'any'))
FileBackedWheelCache cache = new FileBackedWheelCache(wheelCache, formats)
new File(wheelCache, 'my_special_package-0.0.20-py2.py3-none-any.whl').createNewFile()

expect: "the partial match between 0.0.2 and 0.0.20 does not find the wheel"
Expand All @@ -53,11 +55,6 @@ class FileBackedWheelCacheTest extends Specification {

def "finds the exact matching version"() {
setup: "we have an exact and partial match"
def wheelCache = temporaryFolder.newFolder('wheel-cache')
def pythonExec = temporaryFolder.newFile('python')
def formats = new DefaultPythonAbiContainer()
formats.addSupportedAbi(new AbiDetails(pythonExec, 'py2', 'none', 'any'))
FileBackedWheelCache cache = new FileBackedWheelCache(wheelCache, formats)
new File(wheelCache, 'my_special_package-0.0.30-py2.py3-none-any.whl').createNewFile()
new File(wheelCache, 'my_special_package-0.0.3-py2.py3-none-any.whl').createNewFile()

Expand Down

0 comments on commit be77e80

Please sign in to comment.