Revert "tests: first attempt to mock shell() call"

This reverts commit a0c632a7006a83c8b39cff86228296c32c5c5b9e.
This commit is contained in:
missytake
2025-10-14 19:31:31 +02:00
parent 248b225665
commit 8256080ad1
3 changed files with 2 additions and 31 deletions

View File

@@ -11,15 +11,13 @@ All functions of this module
"""
import re
from pprint import pprint
from .rshell import CalledProcessError, shell, log_progress
def perform_initial_checks(mail_domain, pre_command=""):
"""Collecting initial DNS settings."""
assert mail_domain
pprint("rdns.perform_initial_checks: " + shell.__module__)
if not shell("dig", fail_ok=True, print=log_progress):
shell("apt-get update && apt-get install -y dnsutils", print=log_progress)
A = query_dns("A", mail_domain)

View File

@@ -1,5 +1,5 @@
import sys
from pprint import pprint
from subprocess import DEVNULL, CalledProcessError, check_output
@@ -9,7 +9,6 @@ def log_progress(data):
def shell(command, fail_ok=False, print=print):
pprint("test_cmdeploy: " + shell.__module__)
print(f"$ {command}")
args = dict(shell=True)
if fail_ok:

View File

@@ -5,8 +5,6 @@ import pytest
from cmdeploy.cmdeploy import get_parser, main
from cmdeploy.www import get_paths
import cmdeploy.remote.rshell
import cmdeploy.dns
@pytest.fixture(autouse=True)
@@ -61,27 +59,3 @@ def test_www_folder(example_config, tmp_path):
assert www_path == tmp_path
assert src_dir == src_path
assert build_dir == tmp_path.joinpath("build")
def test_dns_when_ssh_docker(monkeypatch):
commands = []
def shell(command, fail_ok=None, print=None):
assert command == False
commands.append(command)
# mock shell function to add called commands to a global list
monkeypatch.setattr(
cmdeploy.remote.rshell, shell.__name__, shell
) # still doesn't get called in get_initial_remote_data :(
print("test_cmdeploy: " + shell.__module__)
# run cmdeploy dns with --ssh-host
# @docker
cmdeploy.dns.get_initial_remote_data("@docker", "chatmail.example.org")
for cmd in commands:
print(cmd)
# localhost
# @local
# without --ssh-host
# check which commands were called
assert False