File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import argparse
55import copy
66import logging
7+ import os
8+ import os .path
79import stat
810import sys
911from collections .abc import MutableSequence , Sequence
@@ -62,6 +64,8 @@ def main(args: Optional[List[str]] = None) -> int:
6264def run (args : argparse .Namespace ) -> int :
6365 """Main function."""
6466 imports : Set [str ] = set ()
67+ if args .dir and not os .path .exists (args .dir ):
68+ os .makedirs (args .dir )
6569 for path in args .inputs :
6670 _logger .info ("Processing %s" , path )
6771 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 11import os
22
3- from pkg_resources import (
4- Requirement ,
5- ResolutionError ,
6- resource_filename ,
7- )
3+ from pkg_resources import Requirement , ResolutionError , resource_filename
84
95
106def get_data (filename : str ) -> str :
You can’t perform that action at this time.
0 commit comments