Comments (7)
Ah of course 🤦
from django-test-migrations.
Is this the case? https://github.com/wemake-services/django-test-migrations/blob/master/django_test_migrations/contrib/pytest_plugin.py#L62
from django-test-migrations.
Is this the case? https://github.com/wemake-services/django-test-migrations/blob/master/django_test_migrations/contrib/pytest_plugin.py#L62
Thanks! Removing "--nomigrations" from setup.cfg -> [tool:pytest] -> addopts helped me. @SaturnFromTitan check your pytest config for default addopts.
from django-test-migrations.
Can you please show your outout for running only this test?
from django-test-migrations.
I added it to the issue description in the top @sobolevn
When I remove the migrator
fixture, the test isn't skipped btw
from django-test-migrations.
Or it might the custom marker
we add to all tests: https://github.com/wemake-services/django-test-migrations/blob/master/django_test_migrations/contrib/pytest_plugin.py#L28 Might be that it is ignored.
from django-test-migrations.
When running pytest xyz/tests/test_migration.py::test_datamig -vv -m migration_test
the test is deselected instead:
Test session starts (platform: linux, Python 3.8.4, pytest 5.4.3, pytest-sugar 0.9.4)
cachedir: .pytest_cache
django: settings: xyz.settings (from option)
rootdir: /code, inifile: setup.cfg
plugins: django-test-migrations-1.0.0, xdist-1.34.0, celery-4.4.7, sugar-0.9.4, django-3.9.0, mock-3.3.0, Faker-4.1.2, socket-0.3.5, cov-2.10.1, forked-1.3.0
collecting ...
Results (0.13s):
1 deselected
I think the marker was only introduced after the 1.0.0 release and isn't public yet (I installed via pip, not the current master).
Your first guess seems to be right though. When using the -rs
flag it says SKIPPED [1] /usr/local/lib/python3.8/site-packages/django_test_migrations/contrib/pytest_plugin.py:39: --nomigrations was specified
However, the test above was just a minimal example. My actual test looks more like this:
@pytest.mark.django_db
def test_datamig(migrator):
old_state = migrator.apply_initial_migration(('campaigns', '0011_adjust_campaign_headerdiscountpercent'))
CampaignLine = old_state.apps.get_model('campaigns', 'CampaignLine')
cl = CampaignLine.objects.create(netClientBudget=1000)
new_state = migrator.apply_tested_migration(('campaigns', '0012_fix_campaignline_netclientbudget'))
CampaignLine = new_state.apps.get_model('campaigns', 'CampaignLine')
cl = CampaignLine.objects.get(pk=cl.id)
assert cl.netClientBudget == 1200
migrator.reset()
The test is still skipped with the same skip message though:
Test session starts (platform: linux, Python 3.8.4, pytest 5.4.3, pytest-sugar 0.9.4)
cachedir: .pytest_cache
django: settings: xyz.settings (from option)
rootdir: /code, inifile: setup.cfg
plugins: django-test-migrations-1.0.0, xdist-1.34.0, celery-4.4.7, sugar-0.9.4, django-3.9.0, mock-3.3.0, Faker-4.1.2, socket-0.3.5, cov-2.10.1, forked-1.3.0
collecting ...
xyz/campaigns/tests/test_migrations.py::test_datamig s 100% ██████████
========================================================================================== short test summary info ==========================================================================================
SKIPPED [1] /usr/local/lib/python3.8/site-packages/django_test_migrations/contrib/pytest_plugin.py:39: --nomigrations was specified
Results (4.70s):
1 skipped
from django-test-migrations.
Related Issues (20)
- Add `[email protected]` to the test matrix
- Python3.10 support
- Support `[email protected]`
- Can't handle squashed migrations HOT 1
- typing_extensions is still required in newer Python versions HOT 5
- Models from app state aren't compatible (Cannot assign "<A: A object (1)>": "B.a_fk" must be a "A" instance) HOT 5
- Migrations unrelated to the migration I want to test force the migration I want to test to run before I can test state differences HOT 1
- Migrations unrelated to the migration I want to test force the migration I want to test to run before I can test state differences HOT 2
- Checks failing on MariaDB HOT 1
- Inconsistent behaviour with data migration HOT 8
- Error when testing multiple schemas in django+postgres HOT 1
- Allow using shorthand names & __latest__ for MigrationTargets
- Deadlock when using pants, pytest and django-test-migrations HOT 1
- Cannot test migrations if there is a collation in the migrations HOT 8
- "Relation {table} does not exist" when creating using prototype model HOT 2
- django.db.utils.OperationalError: (1050, "Table 'bar' already exists") HOT 6
- truncate_plan should truncate each app separately HOT 3
- `through_fields` not reflected in test models
- Apply only specific app migrations HOT 2
- Keep initial data in database after migration test
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-test-migrations.