Skip to content

Commit

Permalink
Switch to pydantic2-argparse
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldcampbelljr committed Mar 1, 2024
1 parent e924682 commit 066e661
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 8 deletions.
6 changes: 3 additions & 3 deletions looper/cli_pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import sys

import logmuse
import pydantic_argparse
import pydantic2_argparse
import yaml
from pephubclient import PEPHubClient
from pydantic_argparse.argparse.parser import ArgumentParser
from pydantic2_argparse.argparse.parser import ArgumentParser

from divvy import select_divvy_config

Expand Down Expand Up @@ -241,7 +241,7 @@ def run_looper(args: TopLevelParser, parser: ArgumentParser, test_args=None):


def main(test_args=None) -> None:
parser = pydantic_argparse.ArgumentParser(
parser = pydantic2_argparse.ArgumentParser(
model=TopLevelParser,
prog="looper",
description="Looper Pydantic Argument Parser",
Expand Down
2 changes: 1 addition & 1 deletion looper/command_models/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from copy import copy
from typing import Any, List

import pydantic
import pydantic.v1 as pydantic


class Argument(pydantic.fields.FieldInfo):
Expand Down
2 changes: 1 addition & 1 deletion looper/command_models/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from dataclasses import dataclass
from typing import List, Optional, Type

import pydantic
import pydantic.v1 as pydantic

from ..const import MESSAGE_BY_SUBCOMMAND
from .arguments import Argument, ArgumentEnum
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ pyyaml>=3.12
rich>=9.10.0
ubiquerg>=0.5.2
yacman==0.9.3
pydantic-argparse>=0.8.0
pydantic2-argparse>=0.9.2
4 changes: 2 additions & 2 deletions tests/smoketests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class TestLooperPipestat:
@pytest.mark.parametrize("cmd", ["report", "table", "check"])
def test_fail_no_pipestat_config(self, prep_temp_pep, cmd):
"report, table, and check should fail if pipestat is NOT configured."
#tp = prep_temp_pep
# tp = prep_temp_pep
dot_file_path = os.path.abspath(prepare_pep_with_dot_file)
#x = test_args_expansion(tp, cmd, dry=False)
# x = test_args_expansion(tp, cmd, dry=False)
x = ["--looper-config", dot_file_path, cmd]
with pytest.raises(PipestatConfigurationException):
main(test_args=x)
Expand Down
6 changes: 6 additions & 0 deletions tests/smoketests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

CMD_STRS = ["string", " --string", " --sjhsjd 212", "7867#$@#$cc@@"]


@pytest.mark.skip(reason="prep_temp_pep needs to be rewritten")
def test_cli(prep_temp_pep):
tp = prep_temp_pep
Expand Down Expand Up @@ -98,6 +99,7 @@ def test_unrecognized_args_not_passing(self, prep_temp_pep, cmd):
except Exception:
raise pytest.fail("DID RAISE {0}".format(Exception))


@pytest.mark.skip(reason="prep_temp_pep needs to be rewritten")
class TestLooperRunBehavior:
def test_looper_run_basic(self, prep_temp_pep):
Expand Down Expand Up @@ -315,6 +317,7 @@ def test_cmd_extra_override_sample(self, prep_temp_pep, arg):
subs_list = [os.path.join(sd, f) for f in os.listdir(sd) if f.endswith(".sub")]
assert_content_not_in_any_files(subs_list, arg)


@pytest.mark.skip(reason="prep_temp_pep needs to be rewritten")
class TestLooperRunpBehavior:
def test_looper_runp_basic(self, prep_temp_pep):
Expand Down Expand Up @@ -364,6 +367,7 @@ def test_cmd_extra_project(self, prep_temp_pep, arg):
subs_list = [os.path.join(sd, f) for f in os.listdir(sd) if f.endswith(".sub")]
assert_content_in_all_files(subs_list, arg)


@pytest.mark.skip(reason="prep_temp_pep needs to be rewritten")
class TestLooperRunPreSubmissionHooks:
def test_looper_basic_plugin(self, prep_temp_pep):
Expand Down Expand Up @@ -423,6 +427,7 @@ def test_looper_command_templates_hooks(self, prep_temp_pep, cmd):
sd = os.path.join(get_outdir(tp), "submission")
verify_filecount_in_dir(sd, "test.txt", 3)


@pytest.mark.skip(reason="prep_temp_pep needs to be rewritten")
class TestLooperRunSubmissionScript:
def test_looper_run_produces_submission_scripts(self, prep_temp_pep):
Expand Down Expand Up @@ -475,6 +480,7 @@ def test_looper_limiting(self, prep_temp_pep):
sd = os.path.join(get_outdir(tp), "submission")
verify_filecount_in_dir(sd, ".sub", 4)


@pytest.mark.skip(reason="prep_temp_pep needs to be rewritten")
class TestLooperCompute:
@pytest.mark.parametrize("cmd", ["run", "runp"])
Expand Down
1 change: 1 addition & 0 deletions tests/test_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def build_namespace(**kwargs):
]
]


@pytest.mark.skip(reason="Test needs to be rewritten")
@pytest.mark.parametrize(["args", "preview"], DRYRUN_OR_NOT_PREVIEW)
def test_cleaner_does_not_crash(args, preview, prep_temp_pep):
Expand Down

0 comments on commit 066e661

Please sign in to comment.