Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit-test for this edge-case #73

Closed
hvwaldow opened this issue Feb 11, 2025 · 1 comment
Closed

Unit-test for this edge-case #73

hvwaldow opened this issue Feb 11, 2025 · 1 comment
Assignees
Labels

Comments

@hvwaldow
Copy link
Collaborator

No description provided.

@JensKrumsieck
Copy link
Collaborator

When i understood right the "edge case" was the usage of $(runtime.outdir)? This definitivly would not be something the user needs to type and basically is just an alias for "give me the full working dir as output" or the glob of ..
Added postprocessing to convert "." to the desired magic string.
s4n tool create -o . python create_dir.py creates the following cwl now:

#!/usr/bin/env cwl-runner

cwlVersion: v1.2
class: CommandLineTool

requirements:
- class: InitialWorkDirRequirement
  listing:
  - entryname: create_dir.py
    entry:
      $include: ../../create_dir.py

inputs: []
outputs:
- id: output_directory
  type: Directory
  outputBinding:
    glob: $(runtime.outdir)

baseCommand:
- python
- create_dir.py

integration test:

pub fn test_tool_output_complete_dir() {
let dir = tempdir().unwrap();
copy_file("tests/test_data/create_dir.py", dir.path().join("create_dir.py").to_str().unwrap()).unwrap();
let current = env::current_dir().unwrap();
env::set_current_dir(dir.path()).unwrap();
init_s4n(None, false).expect("Could not init s4n");
let name = "create_dir";
let command = &["python", "create_dir.py"];
let args = CreateToolArgs {
name: None,
container_image: None,
container_tag: None,
is_raw: false,
no_commit: false,
no_run: false,
is_clean: false,
inputs: None,
outputs: Some(vec![".".into()]), //
command: command.iter().map(|s| s.to_string()).collect::<Vec<_>>(),
};
assert!(create_tool(&args).is_ok());
let tool = load_tool(format!("workflows/{name}/{name}.cwl")).unwrap();
assert_eq!(tool.inputs.len(), 0);
assert_eq!(tool.outputs.len(), 1); //only root folder
println!("{:#?}", tool.outputs);
env::set_current_dir(current).unwrap();
}

This should be a good test to mimic the creation of a cwl file such as https://github.com/fairagro/M4.4_UC6_ARC/blob/main/workflows/simulation/simulation.cwl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants