Skip to content

Commit

Permalink
fix: add testcase for script directive to work with Python 3.7 and co…
Browse files Browse the repository at this point in the history
…rresponding fix.
  • Loading branch information
johanneskoester committed Dec 19, 2023
1 parent fe188b3 commit 0b4ae2e
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 3 deletions.
File renamed without changes.
4 changes: 1 addition & 3 deletions snakemake/settings.py
@@ -1,10 +1,8 @@
from abc import ABC
from dataclasses import dataclass, field
from enum import Enum
import importlib
from pathlib import Path
from typing import Optional
from collections.abc import Mapping, Sequence, Set
from typing import Mapping, Sequence, Set

import immutables

Expand Down
7 changes: 7 additions & 0 deletions tests/test_script_pre_py39/Snakefile
@@ -0,0 +1,7 @@
rule a:
output:
"test.out"
conda:
"env.yaml"
script:
"script.py"
5 changes: 5 additions & 0 deletions tests/test_script_pre_py39/env.yaml
@@ -0,0 +1,5 @@
channels:
- conda-forge
- nodefaults
dependencies:
- python =3.7
1 change: 1 addition & 0 deletions tests/test_script_pre_py39/expected-results/test.out
@@ -0,0 +1 @@
test
3 changes: 3 additions & 0 deletions tests/test_script_pre_py39/script.py
@@ -0,0 +1,3 @@
from snakemake.shell import shell
print("test", file=open(snakemake.output[0], "w"))
shell("echo test")
4 changes: 4 additions & 0 deletions tests/tests.py
Expand Up @@ -1921,3 +1921,7 @@ def test_conda_global():

def test_missing_file_dryrun():
run(dpath("test_missing_file_dryrun"), executor="dryrun", shouldfail=True)


def test_script_pre_py39():
run(dpath("test_script_pre_py39"), deployment_method={DeploymentMethod.CONDA})

0 comments on commit 0b4ae2e

Please sign in to comment.