fixtures Questions

3

Solved

In the Indirect parametrization example I want to type hint request.param indicating a specific type, a str for example. The problem is since the argument to fixt must be the request fixture there ...
Salon asked 17/12, 2020 at 3:13

6

I'm new to testing and I've stumbled across pytest fixtures, but I'm not entirely sure when to use them and why they're useful. For example, see the below code: import pytest @pytest.fixture def i...
Triacid asked 14/6, 2020 at 17:55

14

Solved

I am using py.test to test some DLL code wrapped in a python class MyTester. For validating purpose I need to log some test data during the tests and do more processing afterwards. As I have many t...
Gluey asked 2/8, 2013 at 8:11

18

I am having trouble loading Django fixtures into my MySQL database because of contenttypes conflicts. First I tried dumping the data from only my app like this: ./manage.py dumpdata escola > fi...
Narthex asked 12/5, 2009 at 17:2

4

Solved

I generated a fixture: python manage.py dumpdata --all > ./mydump.json I emptied all my databases using: python manage.py sqlflush | psql mydatabase -U mydbuser But when i try to use loadd...
Benbena asked 9/2, 2014 at 2:41

4

Solved

I'm running Django 1.7. My file tree for the project is as such: /project/app/fixtures/initial_data.json /project/app/settings.py I know I can run the python manage.py loaddata app/fixtures/init...
Cosh asked 6/1, 2015 at 22:39

13

Solved

Since I've started using rspec, I've had a problem with the notion of fixtures. My primary concerns are this: I use testing to reveal surprising behavior. I'm not always clever enough to en...
Salvia asked 11/3, 2009 at 21:2

4

The --no-interaction flag on the doctrine:fixtures:load command is not working running within a Symfony command. It is working however via the terminal. I'm I calling it correctly? When I run this...
Obediah asked 30/5, 2014 at 14:1

4

I have a fixture that is returning an object of certain type and I have another fixture defined in another file that basically uses the object to do other things. But I am not able to return the ob...
Bernstein asked 31/5, 2019 at 23:9

5

The baseline of all my tests is that there will always be a taxi with at least one passenger in it. I can easily achieve this setup with some basic fixtures: from blah import Passenger, Taxi @pyt...
Butte asked 21/6, 2017 at 13:22

3

Solved

My parameters determine the name of my parameterized pytest. I will be using a some randomized params for these tests. In order for my reporting names in junit to not get messed up, I'd like to cre...
Acetone asked 1/6, 2016 at 17:56

6

Solved

I'm trying to understand what conftest.py files are meant to be used for. In my (currently small) test suite I have one conftest.py file at the project root. I use it to define the fixtures that I ...
Literator asked 25/12, 2015 at 20:8

2

Solved

I am writing some tests using pytest many of which have similar fixtures. I want to put these "global" fixtures in a single file so that they can be reused across multiple test files. My first thou...
Galle asked 1/9, 2017 at 18:6

5

I am attempting to build a little pytest test to ensure all expected keys exist in redis. I have a list of expected keys, that I am storing as a YML file. The test itself will query against redis t...
Visitation asked 19/6, 2019 at 16:28

11

I am using Symfony 3.4.0, I try to load fixtures with: php bin/console doctrine:fixtures:load An error occurred while creating the data, what's wrong?
Magnesite asked 3/12, 2017 at 0:17

6

Solved

For my web server, I have a login fixture that create a user and returns the headers needed to send requests. For a certain test, I need two users. How can I use the same fixture twice in one funct...
Vigil asked 19/3, 2016 at 10:38

2

Solved

How do I regenerate all the YML fixture files? I accidentally deleted them.
Cates asked 28/3, 2012 at 21:12

1

Is there a way I can access test fixtures from within my factories? I'm trying to do something like: Factory.define do factory :foo do user { users(:active) } end end
Ingraham asked 2/10, 2015 at 23:5

2

Solved

My use case is to call fixture only if a certain condition is met. But since we need to call the pytest fixture as an argument to a test function it gets called every time I run the test. I want to...
Cubiculum asked 23/9, 2021 at 11:38

2

Solved

First of all, the relevant portion of my project directory looks like: └── my_package ├── my_subpackage │ ├── my_module.py | └── other_module.py └── tests └── my_subpackage └── unit_test.py ...
Prophets asked 28/12, 2018 at 20:12

1

Solved

Given the following code and tests: # some module from other.module import a_func # returns False by default def do_stuff(): return "banana" if a_func() else "pear" #######...
Motorboat asked 10/11, 2022 at 20:18

7

Solved

I have encountered something mysterious, when using patch decorator from mock package integrated with pytest fixture. I have two modules: -----test folder -------func.py -------test_test.py in ...
Watercolor asked 31/7, 2014 at 11:8

0

Consider the following code: fixtures.py @pytest.fixture def hello_world(): return "Hello world!" And then... basic_tests.py def test_says_hello(hello_world): assert hello_world == &qu...
Repro asked 26/9, 2022 at 15:8

1

I have a large set of Django test cases, all of which subclass either TestCase or TransactionTestCase. I need to add a fixture to all test cases (to handle a new way of handling settings in the dat...
Sliding asked 1/4, 2015 at 1:41

3

Solved

I have updated pytest to 4.3.0 and now I need to rework test code since calling fixtures directly is deprecated. I have an issue with fixtures used in an unittest.TestCase, how do I get the value...
Alainaalaine asked 26/2, 2019 at 13:33

© 2022 - 2025 — McMap. All rights reserved.