Skip to content
This repository has been archived by the owner on Jan 14, 2024. It is now read-only.

Commit

Permalink
#66: Turn off by default should_backup_env in tests in favor of PyT…
Browse files Browse the repository at this point in the history
…est built-in mechanism that is colliding
  • Loading branch information
blackandred committed Aug 19, 2021
1 parent abce032 commit 955c2c9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/core/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
markers =
argparsing: Argument parsing and CLI-related things, usage from commandline
2 changes: 1 addition & 1 deletion src/core/rkd/core/api/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class BasicTestingCase(TestCase):

_envs = None
_cwd = None
should_backup_env = True
should_backup_env = False

def setUp(self) -> None:
os.environ['RKD_PATH'] = ''
Expand Down
2 changes: 2 additions & 0 deletions src/core/tests/test_aliasgroups.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/usr/bin/env python3

import pytest
from rkd.core.api.testing import BasicTestingCase
from rkd.core.aliasgroups import parse_alias_groups_from_env


@pytest.mark.argparsing
class AliasGroupsTest(BasicTestingCase):
def test_parsed_count_matches(self):
self.assertEqual(2, len(parse_alias_groups_from_env(':harbor->:hb,:harbor->')))
Expand Down
4 changes: 3 additions & 1 deletion src/core/tests/test_argparsing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
import os
import pytest
from argparse import ArgumentParser
from unittest import mock

Expand All @@ -10,6 +11,7 @@
from rkd.core.test import get_test_declaration


@pytest.mark.argparsing
class ArgParsingTest(BasicTestingCase):
should_backup_env = False

Expand Down Expand Up @@ -218,7 +220,7 @@ def test_preparse_global_arguments_before_tasks_parses_imports_from_switch(self)
result['imports']
)

@mock.patch.dict(os.environ, {"RKD_IMPORTS": "bakunin:malatesta"}, clear=True)
@mock.patch.dict(os.environ, {"RKD_IMPORTS": "bakunin:malatesta"}, clear=False)
def test_preparse_global_arguments_before_tasks_parses_imports_from_env(self):
result = CommandlineParsingHelper.preparse_global_arguments_before_tasks([])

Expand Down
2 changes: 2 additions & 0 deletions src/core/tests/test_argparsing_blocks.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env python3

import pytest
from rkd.core.api.testing import BasicTestingCase
from rkd.core.argparsing.blocks import parse_block_header, parse_blocks
from rkd.core.argparsing.model import ArgumentBlock
from rkd.core.exception import CommandlineParsingError


@pytest.mark.argparsing
class ArgParsingBlocksTest(BasicTestingCase):
#
# parse_block_header()
Expand Down

0 comments on commit 955c2c9

Please sign in to comment.