Skip to content

Commit

Permalink
Move scripts used by tests to test/data/
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder authored and asmacdo committed Jun 10, 2024
1 parent 7162533 commit 9a4f3ee
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include CHANGELOG.* CONTRIBUTORS.* LICENSE tox.ini
graft src
graft test
include test_script.py
global-exclude *.py[cod]
File renamed without changes.
File renamed without changes.
11 changes: 7 additions & 4 deletions test/test_execution.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import argparse
import os
from pathlib import Path
import shutil
from unittest import mock
import pytest
from utils import assert_files
from duct import execute

TEST_SCRIPT = str(Path(__file__).with_name("data") / "test_script.py")


@pytest.fixture
def temp_output_dir(tmp_path):
Expand Down Expand Up @@ -55,7 +58,7 @@ def test_sanity_red(temp_output_dir):

def test_outputs_full(temp_output_dir):
args = argparse.Namespace(
command="./test_script.py",
command=TEST_SCRIPT,
command_args=["--duration", "1"],
output_prefix=temp_output_dir,
sample_interval=0.01,
Expand All @@ -71,7 +74,7 @@ def test_outputs_full(temp_output_dir):

def test_outputs_passthrough(temp_output_dir):
args = argparse.Namespace(
command="./test_script.py",
command=TEST_SCRIPT,
command_args=["--duration", "1"],
output_prefix=temp_output_dir,
sample_interval=0.01,
Expand All @@ -89,7 +92,7 @@ def test_outputs_passthrough(temp_output_dir):

def test_outputs_capture(temp_output_dir):
args = argparse.Namespace(
command="./test_script.py",
command=TEST_SCRIPT,
command_args=["--duration", "1"],
output_prefix=temp_output_dir,
sample_interval=0.01,
Expand All @@ -107,7 +110,7 @@ def test_outputs_capture(temp_output_dir):

def test_outputs_none(temp_output_dir):
args = argparse.Namespace(
command="./test_script.py",
command=TEST_SCRIPT,
command_args=["--duration", "1"],
output_prefix=temp_output_dir,
sample_interval=0.01,
Expand Down
3 changes: 2 additions & 1 deletion test/test_tailpipe.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from pathlib import Path
import subprocess
import tempfile
from unittest.mock import patch
Expand Down Expand Up @@ -49,7 +50,7 @@ def test_high_throughput_stdout(mock_stdout, fixture_path):
def test_high_throughput_stderr(mock_stderr, fixture_path):
with tempfile.NamedTemporaryFile(mode="wb") as tmpfile:
process = subprocess.Popen(
["./test/cat_to_err.py", fixture_path],
[Path(__file__).with_name("data") / "cat_to_err.py", fixture_path],
stdout=subprocess.DEVNULL,
stderr=tmpfile,
)
Expand Down

0 comments on commit 9a4f3ee

Please sign in to comment.