Skip to content

Commit 7521ff0

Browse files
committed
fixup! fixup! fixup! Introduce new class: Pipenv
1 parent c604841 commit 7521ff0

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

src/com/ableton/Pipenv.groovy

+6-13
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,23 @@ class Pipenv implements Serializable {
2121
* other words, it runs {@code pipenv install --dev}. Also, it removes the virtualenv
2222
* after the last Python version has been run.
2323
*
24-
* @param args Map of arguments. Valid arguments include:
25-
* <ul>
26-
* <li>
27-
* {@code pythonVersions}: List of Python versions to run the command
28-
* with. This argument is passed to Pipenv via {@code pipenv --python}.
29-
* See {@code pipenv --help} for supported syntax.
30-
* <strong>Required value, may not be null!</strong>
31-
* </li>
32-
* </ul>
24+
* @param pythonVersions List of Python versions to run the command with. This argument
25+
* is passed to Pipenv via {@code pipenv --python}. See
26+
* {@code pipenv --help} for supported syntax.
3327
* @param body Closure body to execute. The closure body is passed the python version
3428
* as an argument.
3529
* @return Map of return values. The keys in the map correspond to the Python versions
3630
* given in {@code args.pythonVersions}, and the values are the result of
3731
* executing the closure body.
3832
*/
39-
Map runWith(Map args, Closure body) {
33+
Map runWith(List pythonVersions, Closure body) {
4034
assert script
41-
assert args
42-
assert args.pythonVersions
35+
assert pythonVersions
4336

4437
Map result = [:]
4538

4639
try {
47-
args.pythonVersions.each { python ->
40+
pythonVersions.each { python ->
4841
script.sh "pipenv install --dev --python ${python}"
4942
result[python] = body(python)
5043
}

test/com/ableton/PipenvTest.groovy

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class PipenvTest extends BasePipelineTest {
4040
}
4141

4242
int numCalls = 0
43-
Map result = new Pipenv(script: script).runWith(pythonVersions: pythonVersions) { p ->
43+
Map result = new Pipenv(script: script).runWith(pythonVersions) { p ->
4444
numCalls++
4545
return p
4646
}
@@ -71,11 +71,11 @@ class PipenvTest extends BasePipelineTest {
7171

7272
@Test(expected = AssertionError)
7373
void runWithNoScript() throws Exception {
74-
new Pipenv().runWith(pythonVersions: ['2.7']) {}
74+
new Pipenv().runWith(['2.7']) {}
7575
}
7676

7777
@Test(expected = AssertionError)
7878
void runWithEmptyPythonVersions() throws Exception {
79-
new Pipenv(script: script).runWith(pythonVersions: []) {}
79+
new Pipenv(script: script).runWith([]) {}
8080
}
8181
}

0 commit comments

Comments
 (0)