Skip to content

Commit

Permalink
s/duct/con_duct/ for con-duct PyPI release
Browse files Browse the repository at this point in the history
  • Loading branch information
asmacdo committed Jul 9, 2024
1 parent b55aa1c commit 045b4cf
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 90 deletions.
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = duct
version = attr:duct.__version__
name = con-duct
version = attr:con_duct.__version__
description = Runs a not-so-simple command and collects resource usage metrics
long_description = file:README.md
long_description_content_type = text/markdown
Expand Down Expand Up @@ -57,7 +57,7 @@ where = src

[options.entry_points]
console_scripts =
duct = duct.__main__:main
duct = con_duct.__main__:main

[mypy]
allow_incomplete_defs = False
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/test_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path
from unittest import mock
from utils import assert_files
from duct.__main__ import (
from con_duct.__main__ import (
EXECUTION_SUMMARY_FORMAT,
SUFFIXES,
Arguments,
Expand Down
34 changes: 17 additions & 17 deletions test/test_log_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import re
from unittest.mock import MagicMock, call, patch
import pytest
from duct.__main__ import LogPaths, Outputs
from con_duct.__main__ import LogPaths, Outputs


def test_log_paths_filesafe_datetime_prefix() -> None:
Expand All @@ -28,8 +28,8 @@ def test_log_paths_pid_prefix() -> None:
"/abs/path/",
],
)
@patch("duct.__main__.os.makedirs")
@patch("duct.__main__.os.path.exists")
@patch("con_duct.__main__.os.makedirs")
@patch("con_duct.__main__.os.path.exists")
@patch("builtins.open")
def test_prepare_dir_paths_available(
_mock_open: MagicMock, mock_exists: MagicMock, mock_mkdir: MagicMock, path: str
Expand All @@ -48,8 +48,8 @@ def test_prepare_dir_paths_available(
"/abs/path/pre_",
],
)
@patch("duct.__main__.os.path.exists")
@patch("duct.__main__.os.makedirs")
@patch("con_duct.__main__.os.path.exists")
@patch("con_duct.__main__.os.makedirs")
@patch("builtins.open")
def test_prefix_with_filepart_and_directory_part(
mock_open: MagicMock, mock_mkdir: MagicMock, mock_exists: MagicMock, path: str
Expand All @@ -62,8 +62,8 @@ def test_prefix_with_filepart_and_directory_part(
mock_open.assert_has_calls(expected_calls, any_order=True)


@patch("duct.__main__.os.path.exists")
@patch("duct.__main__.os.makedirs")
@patch("con_duct.__main__.os.path.exists")
@patch("con_duct.__main__.os.makedirs")
@patch("builtins.open")
def test_prefix_with_filepart_only(
mock_open: MagicMock, mock_mkdir: MagicMock, mock_exists: MagicMock
Expand All @@ -76,8 +76,8 @@ def test_prefix_with_filepart_only(
mock_open.assert_has_calls(expected_calls, any_order=True)


@patch("duct.__main__.os.path.exists")
@patch("duct.__main__.os.makedirs")
@patch("con_duct.__main__.os.path.exists")
@patch("con_duct.__main__.os.makedirs")
@patch("builtins.open")
def test_prepare_file_paths_available_all(
mock_open: MagicMock, _mock_mkdir: MagicMock, mock_exists: MagicMock
Expand All @@ -90,8 +90,8 @@ def test_prepare_file_paths_available_all(
mock_open.assert_has_calls(expected_calls, any_order=True)


@patch("duct.__main__.os.path.exists")
@patch("duct.__main__.os.makedirs")
@patch("con_duct.__main__.os.path.exists")
@patch("con_duct.__main__.os.makedirs")
@patch("builtins.open")
def test_prepare_file_paths_available_stdout(
mock_open: MagicMock, _mock_mkdir: MagicMock, mock_exists: MagicMock
Expand All @@ -106,8 +106,8 @@ def test_prepare_file_paths_available_stdout(
mock_open.assert_has_calls(expected_calls, any_order=True)


@patch("duct.__main__.os.path.exists")
@patch("duct.__main__.os.makedirs")
@patch("con_duct.__main__.os.path.exists")
@patch("con_duct.__main__.os.makedirs")
@patch("builtins.open")
def test_prepare_file_paths_available_stderr(
mock_open: MagicMock, _mock_mkdir: MagicMock, mock_exists: MagicMock
Expand All @@ -122,8 +122,8 @@ def test_prepare_file_paths_available_stderr(
mock_open.assert_has_calls(expected_calls, any_order=True)


@patch("duct.__main__.os.path.exists")
@patch("duct.__main__.os.makedirs")
@patch("con_duct.__main__.os.path.exists")
@patch("con_duct.__main__.os.makedirs")
@patch("builtins.open")
def test_prepare_file_paths_available_no_streams(
mock_open: MagicMock, _mock_mkdir: MagicMock, mock_exists: MagicMock
Expand All @@ -139,8 +139,8 @@ def test_prepare_file_paths_available_no_streams(
mock_open.assert_has_calls(expected_calls, any_order=True)


@patch("duct.__main__.os.makedirs")
@patch("duct.__main__.os.path.exists")
@patch("con_duct.__main__.os.makedirs")
@patch("con_duct.__main__.os.path.exists")
@patch("builtins.open")
def test_prepare_paths_not_available_no_clobber(
mock_open: MagicMock, mock_exists: MagicMock, mock_mkdir: MagicMock
Expand Down
130 changes: 65 additions & 65 deletions test/test_prepare_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import subprocess
from unittest.mock import MagicMock, call, patch
from utils import MockStream
from duct.__main__ import LogPaths, Outputs, prepare_outputs
from con_duct.__main__ import LogPaths, Outputs, prepare_outputs


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_none_output_none(
_mock_stdout: MockStream,
_mock_stderr: MockStream,
Expand All @@ -27,10 +27,10 @@ def test_prepare_outputs_capture_none_output_none(


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_none_output_stdout(
_mock_stdout: MockStream,
_mock_stderr: MockStream,
Expand All @@ -48,10 +48,10 @@ def test_prepare_outputs_capture_none_output_stdout(


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_none_output_stderr(
_mock_stdout: MockStream,
_mock_stderr: MockStream,
Expand All @@ -69,10 +69,10 @@ def test_prepare_outputs_capture_none_output_stderr(


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_none_output_all(
_mock_stdout: MockStream,
_mock_stderr: MockStream,
Expand All @@ -90,10 +90,10 @@ def test_prepare_outputs_capture_none_output_all(


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_stdout_output_none(
_mock_stdout: MockStream,
_mock_stderr: MockStream,
Expand All @@ -111,10 +111,10 @@ def test_prepare_outputs_capture_stdout_output_none(


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_stdout_output_stdout(
mock_stdout: MockStream,
_mock_stderr: MockStream,
Expand All @@ -134,10 +134,10 @@ def test_prepare_outputs_capture_stdout_output_stdout(


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_stdout_output_stderr(
_mock_stdout: MockStream,
_mock_stderr: MockStream,
Expand All @@ -155,10 +155,10 @@ def test_prepare_outputs_capture_stdout_output_stderr(


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_stdout_output_all(
mock_stdout: MockStream,
_mock_stderr: MockStream,
Expand All @@ -178,10 +178,10 @@ def test_prepare_outputs_capture_stdout_output_all(


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_stderr_output_none(
_mock_stdout: MockStream,
_mock_stderr: MockStream,
Expand All @@ -199,10 +199,10 @@ def test_prepare_outputs_capture_stderr_output_none(


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_stderr_output_stdout(
_mock_stdout: MockStream,
_mock_stderr: MockStream,
Expand All @@ -220,10 +220,10 @@ def test_prepare_outputs_capture_stderr_output_stdout(


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_stderr_output_stderr(
_mock_stdout: MockStream,
mock_stderr: MockStream,
Expand All @@ -243,10 +243,10 @@ def test_prepare_outputs_capture_stderr_output_stderr(


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_stderr_output_all(
_mock_stdout: MockStream,
mock_stderr: MockStream,
Expand All @@ -266,10 +266,10 @@ def test_prepare_outputs_capture_stderr_output_all(


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_all_output_none(
_mock_stdout: MockStream,
_mock_stderr: MockStream,
Expand All @@ -289,10 +289,10 @@ def test_prepare_outputs_capture_all_output_none(


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_all_output_stdout(
mock_stdout: MockStream,
_mock_stderr: MockStream,
Expand All @@ -310,10 +310,10 @@ def test_prepare_outputs_capture_all_output_stdout(


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_all_output_stderr(
_mock_stdout: MockStream,
mock_stderr: MockStream,
Expand All @@ -333,10 +333,10 @@ def test_prepare_outputs_capture_all_output_stderr(


@patch("builtins.open", new_callable=MagicMock)
@patch("duct.__main__.TailPipe")
@patch("duct.__main__.LogPaths")
@patch("duct.__main__.sys.stderr", new_callable=MockStream)
@patch("duct.__main__.sys.stdout", new_callable=MockStream)
@patch("con_duct.__main__.TailPipe")
@patch("con_duct.__main__.LogPaths")
@patch("con_duct.__main__.sys.stderr", new_callable=MockStream)
@patch("con_duct.__main__.sys.stdout", new_callable=MockStream)
def test_prepare_outputs_capture_all_output_all(
mock_stdout: MockStream,
mock_stderr: MockStream,
Expand Down
2 changes: 1 addition & 1 deletion test/test_report.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import annotations
from duct.__main__ import Averages, ProcessStats, Sample
from con_duct.__main__ import Averages, ProcessStats, Sample

stat0 = ProcessStats(
pcpu=0.0, pmem=0, rss=0, vsz=0, timestamp="2024-06-11T10:09:37-04:00"
Expand Down
2 changes: 1 addition & 1 deletion test/test_tailpipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from unittest.mock import patch
import pytest
from utils import MockStream
from duct.__main__ import TailPipe
from con_duct.__main__ import TailPipe

# 10^7 line fixture is about 70MB
FIXTURE_LIST = [f"ten_{i}" for i in range(1, 8)]
Expand Down
2 changes: 1 addition & 1 deletion test/test_validation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import argparse
import pytest
from duct.__main__ import Arguments, Outputs, RecordTypes
from con_duct.__main__ import Arguments, Outputs, RecordTypes


def test_sample_less_than_report_interval() -> None:
Expand Down
Loading

0 comments on commit 045b4cf

Please sign in to comment.