All Questions
3,552 questions
-7
votes
0
answers
78
views
Why is my create_spend_chart output not matching the required format?
I’m trying to solve a project where I build a Category class and a create_spend_chart function to create a text-based spend chart.
My Category class methods (deposit, withdraw, transfer) seem to work ...
-1
votes
0
answers
23
views
What is the most reasonable way to automate Python dependency upgrade tests with `uv`? [closed]
If I do something like:
mkdir /tmp/asdf
cd /tmp/asdf
uv init --package
uv add 'django<5'
Then my project will require Django <5. I can remove the version pin from my dependencies and run uv ...
1
vote
1
answer
35
views
How to find all references of a pytest fixture in vscode?
I'm refactoring a suite of tests and pytest fixtures, and need to locate all usages of a fixture within the test suite.
The 'Find all references' function of VSCode is what I'd normally use when ...
0
votes
0
answers
27
views
Can't edit cwd in VS Code Python Debug
I was trying for long time, read a lot of forums but I couldn't find the solution.
I want to debug a function inside an Python file, the function refers to some local files with specific path, and I ...
0
votes
0
answers
118
views
In a uv-created venv, the VS Code Integrated Debugger is not activating when clicking "Debug Test" from VS Code Integrated Testing
I am migrating a Django project from Pipenv to uv.
My development environment is a VS Code Dev Container. Everything worked as expected when using Pipenv.
I have a problem where the integrated ...
0
votes
0
answers
106
views
Why does my Python test run fail when invoked via Tox, despite running just fine when invoked manually?
When I invoke my Python package testing in the usual way, via Tox, it's failing:
$ python -I -m tox run -e py310-lin
py310-lin: install_deps> python -I -m pip install pytest pytest-cov pytest-xdist ...
0
votes
0
answers
18
views
Using alembic cli to build test database
I'm attempting to build a pytest fixture that drops my test database, recreates it, and then runs my alembic migrations. When I run it, I get errors that my relationships don't exist, which seems to ...
-1
votes
1
answer
2k
views
How to Run uv Pytest Tool with Proper Dependencies and Module Paths?
Directory Structure
project-root/
├── src/
│ ├── file1.py
│ ├── file2.py
└── tests/
│ ├── test_file1.py
│ ├── test_file2.py
├── requirements.txt
├── pyproject.toml
So basically, under the ...
0
votes
1
answer
20
views
How to write an integration test on an urwid tui?
While trying to test a urwid-based question with input validation and autocomplete suggestions, I am experiencing some difficulties. The code that I am trying to test using pytest is given in the two ...
0
votes
0
answers
82
views
How to properly test NiceGUI applications with pytest - Multiple context/slot errors
I'm trying to write pytest tests for a NiceGUI application. I've been encountering various context-related errors and tried multiple approaches to fix them.
Initial setup:
@pytest.fixture
async def ...
0
votes
0
answers
95
views
TypeError: Failed to fetch when uploading CSV file using Playwright and Python
Environment:
Python with Playwright
Running on localhost:8000
Chrome browser in headed mode
Problem:
I'm trying to upload a CSV file using Playwright with Python, but I'm getting the following errors ...
0
votes
1
answer
37
views
How to create correct mock method
I'm trying to write a unit test for my post api method.
test:
@pytest.mark.asyncio
async def test_animals_create(async_animals_client: AsyncClient, mocker):
path = 'create'
animal_data = {
...
-2
votes
1
answer
70
views
How should I implement Fuzzing techniques presented in "The Fuzzing Book"? [closed]
I am currently reading "The Fuzzing Book" and I am trying to determine how I should apply or implement the fuzzing techniques that I have learned from the book. For instance, in the book, ...
1
vote
4
answers
94
views
How can I override settings for code ran in urls.py while unit testing django
my django app has a env var DEMO which, among other thing, dictate what endpoints are declared in my urls.py file.
I want to unit tests these endpoints, I've tried django.test.override_settings but I'...
0
votes
1
answer
26
views
Inconsistent behavior between Flask real session storage and test_request_context during tests
I’m using Flask’s session storage to temporarily save a list of dataclass objects. Here’s an example of the Transaction class and my TransactionMemoryRepository:
@dataclass
class Transaction:
...