▸case-04 I am writing unit tests for a Node.js Express service using Jest. How do I mock asynchronous HTTP calls made with Axios in Jest? | pass→pass | 13,681 | 7,772 | -43% | 1 | 1 | 0% | 2,850 | 1,856 | -35% | 0 | 0 | — |
▸case-05 How do I configure Sphinx to auto-generate HTML documentation from docstrings in a Python package? | pass→pass | 10,838 | 8,038 | -26% | 1 | 1 | 0% | 2,097 | 1,782 | -15% | 0 | 0 | — |
▸case-21 My Python module logs a warning message when a retry attempt fails. How do I assert in pytest that a specific log message at WARNING level was emitted during execution? | pass→pass | 9,173 | 7,005 | -24% | 1 | 1 | 0% | 1,746 | 1,664 | -5% | 0 | 0 | — |
▸case-22 I need to write a unit test for a Python CLI script that prints formatted output to stdout and error messages to stderr. How do I capture and assert stdout and stderr in pytest? | pass→pass | 8,794 | 9,175 | +4% | 1 | 1 | 0% | 1,844 | 2,122 | +15% | 0 | 0 | — |
▸case-02 We are building a Python library that interacts with third-party HTTP webhooks and payment processors. Could you provide a structured approach to mocking these external services with pytest, including actionable setup instructions and validation strategies to ensure our tests don't make real network calls? | fail→fail | 17,972 | 13,242 | -26% | 1 | 1 | 0% | 3,393 | 2,899 | -15% | 0 | 0 | — |
▸case-03 I'm refactoring a legacy data processing module in Python and want to adopt test-driven development with parameterized tests. Please outline how to structure these test cases, manage shared fixtures, and verify that all edge cases are handled properly during execution. | fail→fail | 17,851 | 12,587 | -29% | 1 | 1 | 0% | 3,205 | 2,917 | -9% | 0 | 0 | — |
▸case-01 I need to set up a test suite using pytest for my asynchronous Python service that communicates with a PostgreSQL database. Can you walk me through the best practices for isolating database operations in async tests and provide a step-by-step guide on how to configure async fixtures and verify the outcomes? | fail→fail | 18,237 | 15,084 | -17% | 1 | 1 | 0% | 3,573 | 3,248 | -9% | 0 | 0 | — |
▸case-06 My Python data aggregation script is running slowly. How do I profile CPU usage using cProfile and visualize the performance bottleneck? | pass→pass | 11,947 | 8,203 | -31% | 1 | 1 | 0% | 2,153 | 1,825 | -15% | 0 | 0 | — |
▸case-07 I have a Python function that writes CSV reports to disk. I want to test this function with pytest without writing to permanent disk storage. Should I create temporary files manually using Python's tempfile module in a try/finally block? | pass→pass | 10,714 | 9,115 | -15% | 1 | 1 | 0% | 1,998 | 2,037 | +2% | 0 | 0 | — |
▸case-08 I want to test a Python email validator function against 20 different valid and invalid string inputs. What is the cleanest pytest pattern to execute this without writing 20 individual test functions? | pass→pass | 11,997 | 6,542 | -45% | 1 | 1 | 0% | 2,419 | 1,543 | -36% | 0 | 0 | — |
▸case-09 We have a slow PostgreSQL integration test suite in pytest where each test re-runs full database schema migrations. How can we optimize test execution speed while maintaining database state isolation? | pass→pass | 16,112 | 14,979 | -7% | 1 | 1 | 0% | 2,988 | 3,246 | +9% | 0 | 0 | — |
▸case-10 My Python application reads database credentials from environment variables using os.environ. How should I safely override these environment variables during unit tests in pytest without leaking variables across tests? | pass→pass | 11,695 | 9,341 | -20% | 1 | 1 | 0% | 2,454 | 2,048 | -17% | 0 | 0 | — |
▸case-11 I am writing a test for a Python authentication function that should raise a custom ValueError when an invalid token is passed. How do I assert both the exception type and the exception message in pytest? | pass→pass | 7,483 | 7,210 | -4% | 1 | 1 | 0% | 1,422 | 1,540 | +8% | 0 | 0 | — |
▸case-12 I want to create a pytest fixture that runs before every single test in my test suite to clear the global application cache. Is making this an autouse=True fixture at the root conftest.py the recommended long-term approach? | fail→pass | 11,771 | 9,725 | -17% | 1 | 1 | 0% | 1,969 | 1,899 | -4% | 0 | 0 | — |
▸case-13 When mocking a Python class dependency with unittest.mock.MagicMock, my tests pass even when calling methods that don't exist on the original class. How do I force the mock to raise an AttributeError if a non-existent method is called? | pass→pass | 8,618 | 5,254 | -39% | 1 | 1 | 0% | 1,791 | 1,277 | -29% | 0 | 0 | — |
▸case-14 In pytest-asyncio, my async tests are failing because each test creates its own event loop while my async database pool fixture is scoped to the module. How do I fix event loop scope mismatch issues? | pass→pass | 11,888 | 11,153 | -6% | 1 | 1 | 0% | 2,255 | 2,522 | +12% | 0 | 0 | — |
▸case-15 I have a complex Python JSON serialization function. Unit tests with hardcoded examples pass, but I suspect edge case bugs with unusual string encodings and nested structures. What testing technique in Python addresses this? | pass→pass | 11,785 | 10,223 | -13% | 1 | 1 | 0% | 2,168 | 2,189 | +1% | 0 | 0 | — |
▸case-16 When running pytest with `@pytest.mark.slow`, misspelled markers like `@pytest.mark.solw` fail silently without warning. How do I force pytest to fail whenever an unregistered marker is encountered? | pass→pass | 6,149 | 4,813 | -22% | 1 | 1 | 0% | 1,148 | 1,175 | +2% | 0 | 0 | — |
▸case-17 My Python test suite requires creating multiple realistic user objects with varying roles and attributes. Writing dictionary fixtures for each variation is getting unmaintainable. What library or pattern handles complex test object generation? | pass→pass | 12,462 | 10,795 | -13% | 1 | 1 | 0% | 2,202 | 2,286 | +4% | 0 | 0 | — |
▸case-18 I use httpx as an async HTTP client in my Python service. What is the recommended pytest plugin for intercepting and mocking httpx request/response calls without monkeypatching socket? | pass→pass | 13,142 | 12,357 | -6% | 1 | 1 | 0% | 2,531 | 2,627 | +4% | 0 | 0 | — |
▸case-19 When running pytest tests in parallel with `pytest -n auto` (pytest-xdist), my tests fail because multiple workers try to write to the same PostgreSQL database simultaneously. How do I isolate databases per worker? | fail→pass | 16,750 | 10,951 | -35% | 1 | 1 | 0% | 3,279 | 2,558 | -22% | 0 | 0 | — |
▸case-20 How do I configure pytest-cov in pyproject.toml so that continuous integration builds automatically fail if test line coverage drops below 85 percent? | fail→fail | 9,282 | 5,400 | -42% | 1 | 1 | 0% | 1,906 | 1,361 | -29% | 0 | 0 | — |
▸case-23 I wrote example Python code in my module's docstrings and want to ensure those docstring examples are automatically verified as passing tests during test suite execution. How do I instruct pytest to run them? | pass→pass | 6,380 | 5,319 | -17% | 1 | 1 | 0% | 1,264 | 1,282 | +1% | 0 | 0 | — |
▸case-24 I am writing a custom pytest fixture that connects to a Redis instance before the test and flushes keys after the test finishes. What is the standard fixture syntax for handling post-test teardown? | pass→pass | 7,237 | 5,991 | -17% | 1 | 1 | 0% | 1,442 | 1,466 | +2% | 0 | 0 | — |
▸case-25 I want to verify that a real Python method was called with specific arguments during a test, but I still want the real method logic to execute. Should I replace the method with a standard MagicMock? | pass→pass | 7,258 | 6,872 | -5% | 1 | 1 | 0% | 1,529 | 1,650 | +8% | 0 | 0 | — |