Commit Graph
61 Commits
Author SHA1 Message Date
David Wobrock 2ee7dac3b3 Add internal classes and add type hints + mypy. 2022-12-26 16:26:24 +01:00
Sondre Lillebø Gundersen bd4eb89b8c chore: Upgrade Python syntax with pyupgrade
Run with the following pre-commit configuration:

```
repos:
  - repo: https://github.com/asottile/pyupgrade
    rev: v3.1.0
    hooks:
      - id: pyupgrade
        args: [ "--py3-plus", "--py36-plus", "--py37-plus" ]
```

The rationale for every change can be found at https://github.com/asottile/pyupgrade
2022-11-03 22:00:00 +01:00
David Wobrock bef47906d1 Fix #209 - Raise when getting SQL statements fail. 2022-07-28 23:45:14 +02:00
David Wobrock f67f27354d Fix #218 - Handle model 'objects' call with other parts in the name. 2022-07-09 15:37:57 +02:00
David Wobrock c7d9129db9 Adapt 'warnings-as-errors' option to allow taking migration test codes as input 2022-03-13 17:26:40 +01:00
David Wobrock 4fa6a33153 Fix #198 -- Allow using Django settings for linter configuration 2022-02-15 19:21:58 +01:00
David Wobrock 71ddadda05 Add funtional tests for lintmigrations command 2022-01-28 21:48:05 +01:00
David Wobrock 085048d22b Drop Py2.7, 3.5 and Django 1.11, 2.0, 2.1, 3.0 2021-11-12 17:26:38 +01:00
David Wobrock 6d595f1555 Add support for positional app_label and migration_name arguments 2021-05-26 18:53:19 +02:00
David-Wobrock 6ab1d58c47 Apply isort to the project 2020-11-30 21:46:40 +01:00
David-Wobrock 4b15e11faa Rename data migration lint checks 2020-11-30 21:40:57 +01:00
David-Wobrock f795fa07d2 Add tests for RunSQL tests 2020-11-26 19:02:57 +01:00
David-Wobrock 780630131f Add warning if RunPython model variable name not the same as model class 2020-11-26 19:02:57 +01:00
David-Wobrock 601e02e024 Rename method name and add comments 2020-11-26 19:02:57 +01:00
David-Wobrock a68ff7c306 Make data migration model import check a bit less strict
It now allows:
* get_model(...) calls with one parameter only
* allows the variable name to be not the same as the model name itself (this will become a warning)
2020-11-26 19:02:57 +01:00
David-Wobrock 50294a213b Add Dj3.1 support and update flake8 and black versions 2020-10-10 18:14:56 +02:00
David Wobrock ae84a5ffad Fix most tests for previous Django and Python versions 2020-07-02 19:15:30 +02:00
David Wobrock c2c26ae106 Add tests for the makemigrations override 2020-07-02 19:15:30 +02:00
David Wobrock f21ff2c278 Add (failing) tests cases for makeing a column not null with a Django default value 2020-06-20 18:08:16 +02:00
David-Wobrock a5e17d0df1 Bump to 2.2.1 and black some files 2020-05-16 21:16:36 +02:00
David Wobrock cb6961539c Handle for forward and backward data migration imports 2020-02-08 22:38:05 +01:00
David Wobrock e49f6dea9c Document, add to changelog the data migrations and rename to 'warnings-as-errors' (plural) 2020-02-07 23:29:15 +01:00
David Wobrock 71614bd377 Handle warning as error and exclude warning tests 2020-02-07 23:29:15 +01:00
David Wobrock d01875b3be add warnings and RunPython basic linting 2020-02-07 23:29:15 +01:00
David Wobrock 813c5c8690 Remove apache license headers in each file. The one full copy of the license at the root of the repo shall define the license for all source files. 2020-01-11 22:08:33 +01:00
David Wobrock 537542b30d Add manytomany app to test project and integration tests 2019-10-21 22:25:01 +02:00
David Wobrock 652031ce8d Add failing tests for unique_together condition 2019-07-30 10:47:20 +02:00
Viktor Danyliuk b79f9794ec add testcase: drop table 2019-07-29 23:14:30 +02:00
David Wobrock ef2052a7b0 Work on SQL Analyser module
* With database specific functions
* Functions that analyse the entire transaction
* Unit tests that only test this module
2019-07-29 21:05:12 +02:00
Viktor Danyliuk 5e2c7bbfaf add testcase for DROP NOT NULL 2019-07-29 21:05:12 +02:00
David Wobrock e7b3361984 Nitpick: rename function back to easier understandable name 2019-05-19 22:30:51 +02:00
Tobias Kroenke 758468cbb8 hopefully correctly test new ignoring mechanism 2019-05-19 22:29:02 +02:00
David Wobrock 0f1030d43a Add non-regression test:
Tests that running the linter a second time by ignoring an erroneous migration
will not hit the cache for the said migration.
Instead, it is correctly ignored.
2019-05-12 15:32:57 +02:00
David Wobrock 5390fd507f Update Tests:
* don't use the project fixtures anymore but the one Django project
* update and refactor cache tests to be less brittle
* explicitly test mysql, postgresql and sqlite3 databases
* remove 'multiple_call' tests since it is not possible anymore
(with the Django singleton)
* update Travis and tox (dropping Python 3.4)
2019-05-12 15:32:57 +02:00
David-Wobrock 5c7dab8db2 Update linter tests for multiple backends
Create a base test class and have 3 different backends for now:
* mysql
* sqlite3
* postgresql
2019-02-24 15:55:05 +01:00
David-Wobrock ba83526339 Fix caching tests issues on Windows 2019-02-24 15:55:05 +01:00
David Wobrock d22401f101 Add tests for version option
From Python 3.4 on, version is printed on stdout instead
of stderr.
2019-02-03 19:38:38 +01:00
David Wobrock 1a9024e799 add test for git on non root location 2019-01-20 12:17:11 +01:00
David Wobrock 009153fbf4 handle linting a project in pwd
When calling "django-migration-linter ."
be able to handle it (especially with cache)
2019-01-20 12:17:11 +01:00
David-Wobrock 7a34ac9010 Fix tests and git migration gathering 2019-01-05 17:39:09 +01:00
David-Wobrock 952e596d92 Bump copyright version to 2019 in files 2019-01-03 22:05:00 +01:00
Felix 5be5e3f769 Use call_count instead of assert_called()
because later was introduced in python 3.6.
2018-12-23 23:46:33 +01:00
Felix 1c28412ebd Improve the cache
React to Comments and add a Test
2018-12-23 23:28:45 +01:00
Felix d3805d5210 Integrate IGNORE into cache 2018-12-23 22:49:36 +01:00
Felix 4bcb67c9f2 Merge branch 'master' into cache 2018-12-23 22:40:29 +01:00
Felix 9e3dbf7778 Mark migrations as ignored 2018-12-23 17:46:57 +01:00
Felix 357f0aebf4 Adapt tests so that not relying on undefined
behaviour.
The app directories can appear in any order, we need to allow that
in tests.
2018-12-23 12:25:41 +01:00
Felix b68c0183bb Finish up cache and fix tests.
Still TODO: Merge with ignore functionality.
2018-12-20 14:45:35 +01:00
Felix b3815b6b98 #23 Add tests for caching 2018-12-18 15:33:26 +01:00
David-Wobrock 698e658faa Fix test : do not consider deleted migrations
* Change way to detect deleted migrations (diff-filter of 'git diff' command)
2018-01-20 15:50:45 +01:00