Skip to content

Commit c090af6

Browse files
committed
Revert "tests: first attempt to mock shell() call"
This reverts commit a0c632a.
1 parent a0c632a commit c090af6

File tree

3 files changed

+2
-31
lines changed

3 files changed

+2
-31
lines changed

cmdeploy/src/cmdeploy/remote/rdns.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@
1111
"""
1212

1313
import re
14-
from pprint import pprint
14+
1515
from .rshell import CalledProcessError, shell, log_progress
1616

1717

1818
def perform_initial_checks(mail_domain, pre_command=""):
1919
"""Collecting initial DNS settings."""
2020
assert mail_domain
21-
pprint("rdns.perform_initial_checks: " + shell.__module__)
22-
2321
if not shell("dig", fail_ok=True, print=log_progress):
2422
shell("apt-get update && apt-get install -y dnsutils", print=log_progress)
2523
A = query_dns("A", mail_domain)

cmdeploy/src/cmdeploy/remote/rshell.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from pprint import pprint
2+
33
from subprocess import DEVNULL, CalledProcessError, check_output
44

55

@@ -9,7 +9,6 @@ def log_progress(data):
99

1010

1111
def shell(command, fail_ok=False, print=print):
12-
pprint("test_cmdeploy: " + shell.__module__)
1312
print(f"$ {command}")
1413
args = dict(shell=True)
1514
if fail_ok:

cmdeploy/src/cmdeploy/tests/test_cmdeploy.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
from cmdeploy.cmdeploy import get_parser, main
77
from cmdeploy.www import get_paths
8-
import cmdeploy.remote.rshell
9-
import cmdeploy.dns
108

119

1210
@pytest.fixture(autouse=True)
@@ -61,27 +59,3 @@ def test_www_folder(example_config, tmp_path):
6159
assert www_path == tmp_path
6260
assert src_dir == src_path
6361
assert build_dir == tmp_path.joinpath("build")
64-
65-
66-
def test_dns_when_ssh_docker(monkeypatch):
67-
commands = []
68-
69-
def shell(command, fail_ok=None, print=None):
70-
assert command == False
71-
commands.append(command)
72-
73-
# mock shell function to add called commands to a global list
74-
monkeypatch.setattr(
75-
cmdeploy.remote.rshell, shell.__name__, shell
76-
) # still doesn't get called in get_initial_remote_data :(
77-
print("test_cmdeploy: " + shell.__module__)
78-
# run cmdeploy dns with --ssh-host
79-
# @docker
80-
cmdeploy.dns.get_initial_remote_data("@docker", "chatmail.example.org")
81-
for cmd in commands:
82-
print(cmd)
83-
# localhost
84-
# @local
85-
# without --ssh-host
86-
# check which commands were called
87-
assert False

0 commit comments

Comments
 (0)