File tree Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change 4
4
import argparse
5
5
import copy
6
6
import logging
7
+ import os
8
+ import os .path
7
9
import stat
8
10
import sys
9
11
from collections .abc import MutableSequence , Sequence
@@ -62,6 +64,8 @@ def main(args: Optional[List[str]] = None) -> int:
62
64
def run (args : argparse .Namespace ) -> int :
63
65
"""Main function."""
64
66
imports : Set [str ] = set ()
67
+ if args .dir and not os .path .exists (args .dir ):
68
+ os .makedirs (args .dir )
65
69
for path in args .inputs :
66
70
_logger .info ("Processing %s" , path )
67
71
document = load_cwl_document (path )
Original file line number Diff line number Diff line change
1
+ """Tests related to the --dir command line option."""
2
+ import filecmp
3
+ from pathlib import Path
4
+
5
+ from cwlupgrader .main import main
6
+
7
+ from .util import get_data
8
+
9
+
10
+ def test_draft3_workflow (tmp_path : Path ) -> None :
11
+ """Confirm that --dir works when the directory doesn't exist yet."""
12
+ out_dir = tmp_path / "new"
13
+ main ([f"--dir={ out_dir } " , "--v1-only" , get_data ("testdata/draft-3/wf.cwl" )])
14
+ result = filecmp .cmp (
15
+ get_data ("testdata/v1.0/wf.cwl" ),
16
+ out_dir / "wf.cwl" ,
17
+ shallow = False ,
18
+ )
19
+ assert result
Original file line number Diff line number Diff line change 1
1
import os
2
2
3
- from pkg_resources import (
4
- Requirement ,
5
- ResolutionError ,
6
- resource_filename ,
7
- )
3
+ from pkg_resources import Requirement , ResolutionError , resource_filename
8
4
9
5
10
6
def get_data (filename : str ) -> str :
You can’t perform that action at this time.
0 commit comments