Code Monkey home page Code Monkey logo

Comments (7)

SaturnFromTitan avatar SaturnFromTitan commented on May 24, 2024 3

Ah of course 🤦

from django-test-migrations.

sobolevn avatar sobolevn commented on May 24, 2024 1

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.

stefanitsky avatar stefanitsky commented on May 24, 2024 1

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.

sobolevn avatar sobolevn commented on May 24, 2024

Can you please show your outout for running only this test?

from django-test-migrations.

SaturnFromTitan avatar SaturnFromTitan commented on May 24, 2024

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.

sobolevn avatar sobolevn commented on May 24, 2024

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.

SaturnFromTitan avatar SaturnFromTitan commented on May 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.