SShortSingh.
Back to feed

Characterization Tests Must Freeze Subprocess Results Before Any Code Extraction

0
·2 views

Developers refactoring subprocess wrappers risk breaking callers if they extract helper functions without first recording a stable snapshot of process results. Characterization tests must capture returncode, stdout and stderr types, exception class names, and timeout values for every fixture command before any code change is made. A wrapper that mixes shell, check, and text flags can silently change exception types from TimeoutExpired to CalledProcessError after an unguarded extract. The recommended approach involves running a recorder script against the live wrapper to generate JSON fixture files, which then serve as the source of truth for pytest-based characterization tests. Only once all tests remain green against those committed JSON records should any refactoring of the subprocess wrapper proceed.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Developer launches Ticketpane, a persistent Jira client for VS Code with one-time $19 Pro tier

A developer has released Ticketpane, a Jira Cloud extension for VS Code, Cursor, and Windsurf that addresses persistent authentication failures found in Atlassian's official extension, which holds a 2.55-star rating despite over 3.3 million installs. The tool stores an Atlassian API token in the editor's encrypted secret storage, eliminating repeated sign-in prompts across new folders and windows. Core features such as viewing assigned issues, reading descriptions and comments, and opening tickets in a browser are available for free on a single Jira site. A one-time $19 Pro licence per developer unlocks status changes, commenting, issue creation, branch generation from tickets, saved JQL filters, and support for multiple Jira sites, with a 14-day free trial and refund policy. The extension currently supports Jira Cloud only, with no plans to add Jira Server or Data Center support.

0
ProgrammingDEV Community ·

Why PyInstaller misses dynamic imports and how hidden imports fix the gap

PyInstaller bundles Python apps into standalone executables by statically scanning source files for import statements, without executing any code. This means modules imported dynamically at runtime — such as those loaded via importlib.import_module() with variable names, or discovered through plugin-scanning utilities — never appear in the dependency graph and are silently omitted. The resulting frozen executable can run fine initially but crash deep in specific code paths with a ModuleNotFoundError, making the bug hard to catch post-build. Developers can address this by explicitly listing suspected dynamic imports in a 'hidden imports' configuration, a feature PyInstaller provides for exactly this scenario. A practical rule of thumb is to declare any module referenced only inside function bodies or through runtime logic, since static analysis cannot reliably detect these dependencies.

0
ProgrammingDEV Community ·

Developer's CLAUDE.md Behavioral Rules for AI Coding Agents Hits 91,000 GitHub Stars

A simple markdown file created by developer Forrest Chang surged to 91,000 stars on GitHub without any formal launch campaign or marketing push. The file, named CLAUDE.md, is automatically read by the AI coding tool Claude Code at the start of each session to guide its behavior. It encodes four principles drawn from AI researcher Andrej Karpathy's observations about how large language models commonly fail at coding tasks, including thinking before acting, prioritizing simplicity, limiting scope to only what was asked, and converting vague instructions into verifiable goals. The rules are not exclusive to Claude and have been adapted for other AI coding tools such as Cursor. The viral response is seen as reflecting broader developer frustration with undisciplined AI output rather than enthusiasm for any single tool or file format.