diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b895ec8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build + +on: push + +jobs: + pytest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8.6 + uses: actions/setup-python@v2 + with: + python-version: 3.8.6 + - name: Install poetry + run: python -m pip install --upgrade pip poetry + - name: Install dependencies + run: poetry install + - name: Run pytest + run: poetry run pytest --cov --cov-report xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + black: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8.6 + uses: actions/setup-python@v2 + with: + python-version: 3.8.6 + - name: Install black + run: python -m pip install --upgrade pip black + - name: Check formatting + run: black --check . diff --git a/HISTORY.rst b/HISTORY.rst index bb717ec..d522991 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,3 +1,9 @@ +3.0 (2020-10-07) +++++++++++++++++ + +* Drop support for Django<3. + + 2.1 (2019-12-05) ++++++++++++++++ diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 8a5a8b8..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,39 +0,0 @@ -jobs: - -- job: 'Test' - pool: - vmImage: 'Ubuntu 16.04' - - strategy: - matrix: - Python37: - python.version: '3.7' - - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - architecture: 'x64' - - - script: python -m pip install --upgrade pip && pip install poetry - displayName: 'Install poetry' - - - script: poetry install && poetry develop - displayName: 'Install dependencies' - - - script: poetry run black --check . - displayName: 'Check formatting' - - - script: poetry run pytest --cov --junitxml=junit/test-results.xml - displayName: 'Run pytest' - - - script: poetry run codecov - displayName: 'Upload to codecov' - env: - CODECOV_TOKEN: $(codecov.token) - - - task: PublishTestResults@2 - inputs: - testResultsFiles: '**/test-results.xml' - testRunTitle: 'Python $(python.version)' - condition: succeededOrFailed() diff --git a/pyproject.toml b/pyproject.toml index 51f0f34..b1b28a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.masonry.api" [tool.poetry] name = "django-safemigrate" -version = "2.1" +version = "3.0" description = "Safely run migrations before deployment" authors = ["Ryan Hiebert "] license = "MIT" @@ -12,13 +12,13 @@ readme = "README.rst" [tool.poetry.dependencies] python = "^3.6" -django = ">=2.1,<4.0" +django = "^3.0" [tool.poetry.dev-dependencies] -pytest = "^5.1" -black = "^19.3b0" +pytest = "^6.1" +black = "^20.8b1" codecov = "^2.0" pytest-cov = "^2.6" pytest-django = "^3.4" pytest-pythonpath = "^0.7.3" -pytest-mock = "^1.10" +pytest-mock = "^3.3" diff --git a/src/django_safemigrate/apps.py b/src/django_safemigrate/apps.py index d003957..09e6267 100644 --- a/src/django_safemigrate/apps.py +++ b/src/django_safemigrate/apps.py @@ -1,6 +1,6 @@ """Add a safemigrate command.""" from django.apps import AppConfig -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class SafeMigrateConfig(AppConfig): diff --git a/src/django_safemigrate/management/commands/safemigrate.py b/src/django_safemigrate/management/commands/safemigrate.py index 6694a8c..8ca530d 100644 --- a/src/django_safemigrate/management/commands/safemigrate.py +++ b/src/django_safemigrate/management/commands/safemigrate.py @@ -48,7 +48,9 @@ def pre_migrate_receiver(self, *, plan, **_): # Check for invalid safe properties invalid = [ - migration for migration in migrations if safety(migration) not in Safe + migration + for migration in migrations + if not isinstance(safety(migration), Safe) or safety(migration) not in Safe ] if invalid: self.stdout.write(self.style.MIGRATE_HEADING("Invalid migrations:"))