Skip to content

Commit

Permalink
more QuiltPathFactory.parse
Browse files Browse the repository at this point in the history
  • Loading branch information
drernie committed Sep 3, 2024
1 parent aa2ac3e commit 2fcf6f4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class QuiltSpecification extends Specification {

Path makeObject(String url, String text) {
assert url
Path path = Paths.get(new URI(url))
Path path = QuiltPathFactory.parse(url)
return makeObject(path, text)
}

Expand Down
10 changes: 3 additions & 7 deletions plugins/nf-quilt/src/test/nextflow/quilt/nio/QuiltNioTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ class QuiltNioTest extends QuiltSpecification {
readObject(path).trim() == TEXT
}

@IgnoreIf({ System.getProperty('os.name').contains('indows') })
void 'should read from a path'() {
given:
QuiltPath path = Paths.get(new URI(READ_URL)) as QuiltPath
QuiltPath path = QuiltPathFactory.parse(READ_URL)
path.pkg().install()

when:
Expand All @@ -80,15 +79,13 @@ class QuiltNioTest extends QuiltSpecification {
text.startsWith('id')
}

@IgnoreIf({ System.getProperty('os.name').contains('ux') })
@IgnoreIf({ System.getProperty('os.name').contains('indows') })
void 'should read file attributes'() {
given:
final start = System.currentTimeMillis()
final root = 'folder'
final start_path = "${root}/${start}.txt"
final start_url = packagePath(start_path)
Path path = Paths.get(new URI(start_url))
Path path = QuiltPathFactory.parse(start_url)

when:
makeObject(path, TEXT)
Expand Down Expand Up @@ -513,7 +510,6 @@ class QuiltNioTest extends QuiltSpecification {
list == [ 'file4.txt' ]
}

@IgnoreIf({ System.getProperty('os.name').contains('indows') })
void 'should check walkTree'() {
given:
makeObject(null_path('foo/file1.txt'), 'A')
Expand All @@ -526,7 +522,7 @@ class QuiltNioTest extends QuiltSpecification {
when:
List<String> dirs = []
Map<String,BasicFileAttributes> files = [:]
Path base = Paths.get(new URI(NULL_URL))
Path base = QuiltPathFactory.parse(NULL_URL)
Files.walkFileTree(base, new SimpleFileVisitor<Path>() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import nextflow.quilt.jep.QuiltParser
import nextflow.quilt.jep.QuiltPackage

import java.nio.file.Path
import java.nio.file.Paths
import groovy.util.logging.Slf4j
import groovy.transform.CompileDynamic

import spock.lang.Unroll
import spock.lang.Ignore
import spock.lang.IgnoreIf

/**
*
Expand All @@ -28,13 +26,12 @@ class QuiltPathTest extends QuiltSpecification {

QuiltPath pathify(String path) {
if (!path.contains(BKT)) {
URI uri = new URI(PKG_URL)
QuiltPath pkgPath = Paths.get(uri)
QuiltPath pkgPath = QuiltPathFactory.parse(PKG_URL)
QuiltFileSystem qfs = pkgPath.getFileSystem()
return qfs.getPath(path)
}
String url = QuiltParser.PREFIX + path
return Paths.get(new URI(url))
return QuiltPathFactory.parse(url)
}

@Unroll
Expand Down Expand Up @@ -240,7 +237,6 @@ class QuiltPathTest extends QuiltSpecification {
}

@Unroll
@IgnoreIf({ System.getProperty('os.name').contains('indows') })
void 'should validate relativize'() {
expect:
pathify(path).relativize(pathify(other)).toString() == pathify(expected).toString()
Expand Down

0 comments on commit 2fcf6f4

Please sign in to comment.