Skip to main content
How are we doing? Please help us improve Stack Overflow. Take our short survey

All Questions

0 votes
0 answers
29 views

Django Internationalization test error:Couldn't retrieve redirection page

I wrote a blog project in Django,in some pages i used loginrequierdmixin to make sure user is loged in but in test i got error test: def test_get_profile_unauthenticated(self): response = ...
ParsaM's user avatar
  • 1
0 votes
1 answer
28 views

How to test Amazon Athena queries

I have a rather complicated Athena query, which I would like to test on a local machine without connecting to Athena. I specified some mock data for testing purposes, and I was hoping that I could use ...
Amuoeba's user avatar
  • 714
-1 votes
1 answer
27 views

Flask unit test failing due to FileNotFoundError for private key file [duplicate]

I'm trying to run unit tests on a Flask application that utilizes public and private keys for JWT token generation. However, when running my unit tests, I'm getting a FileNotFoundError indicating that ...
KauaKing's user avatar
0 votes
1 answer
46 views

Mock patching an endpoint unittest that makes several requests to third party

I have a single endpoint written using django ninja. This endpoint executes a crawler that performs several requests. The sequence of requests has 3 different routines depending on whether or not the ...
Gustavo Costa's user avatar
0 votes
0 answers
42 views

Python unittest how to mock function which external function is defined in __init__.py

I would like to test my_func2 that is calling my_func1. I would like to mock my_func1, but I don't know how can I do it when my_func2 is imported in my_package.__init__.py. When I delete that import, ...
sceptre's user avatar
0 votes
1 answer
59 views

pytest fixtures in nested Classes

I have written the following testcase using pytest. import pytest data_arg = ["arg1", "arg2"] class TestParentClass1: @pytest.fixture(scope="class", params=data_arg,...
Shreyansh Jain's user avatar
1 vote
1 answer
49 views

Increasing test coverage for files I didn't write

I have written a python program that calculates various statistical values of a given list of integers and the range of values. Now, I am trying to write a test file for the program that can achieve &...
Austin's user avatar
  • 51
0 votes
3 answers
55 views

Pytest: When writing many assert statements in the same test function, some of it fails, but how to know which assert statement/s is causing failure?

Test file : from RansomNote import Solution def test_canConstruct(): sol = Solution() assert sol.canConstruct('aa', 'aab') == True assert sol.canConstruct('xx','aaabc') == True assert ...
PG23's user avatar
  • 1
1 vote
1 answer
50 views

statically inspect a python test suite

I have a (unittest-based) test suite for my python project. Here I have my test classes, with my test methods, etc... In (some of my) tests I call a function to initialize the scenarios of the tests. ...
Vito De Tullio's user avatar
0 votes
0 answers
21 views

Pass a test file to CherryPy in test

My CherryPy app has an upload endpoint, where a user can complete a form and pass some data along with an uploaded file. I'm interested in testing this endpoint, but I can't figure out how to create ...
lunchbox7804's user avatar
0 votes
2 answers
40 views

Mock from unittest not passed to Django view

def test_student_get(admin_user, some_model_fixture): client = Client() request_with_cookies = set_cookie(client, admin_user[0]) with patch('django.shortcuts.get_object_or_404') as ...
Iliya's user avatar
  • 5
1 vote
0 answers
55 views

Python unittest/pytest tests priority

i have many unittests in my project each independent from another, however i would like to run the tests in parallel on several cores and in order to get the most out of it, it's necessary that the ...
Alberto B's user avatar
  • 483
1 vote
1 answer
36 views

Python ModuleNotFoundError when running tests

I have a Python program that runs correctly as expected, but for some reason I am not able to execute the tests. In the folder hierarchy, tests is a sibling folder of src and the error I got when ...
user840718's user avatar
  • 1,611
0 votes
0 answers
44 views

Using pytest for OOPS where one class calls another and calls another

I am a noob at writing unit testing and I have not been able to find the answer anywhere for the following purpose class xLoader: def __init__(self, config, request_id,logger, mongo_obj,data_in): ...
ProxilityProblemSolver's user avatar
1 vote
0 answers
33 views

Is it problematic to write tests for my lexer and then use that lexer to generate data for tests for my parser?

I'm writing a small transpiler. I've written extensive tests for my lexer. But writing tests for my parser is much more difficult because the parser needs to take in a List[Token] while the lexer ...
8SIXSector's user avatar

15 30 50 per page
1
2 3 4 5
48