Skip to content

Commit

Permalink
[cleanup] Code cleanup
Browse files Browse the repository at this point in the history
- Fix tox
- Fix flake8 line length
- Remove six
- Remove python 2.x support
  • Loading branch information
Bastien Vallet committed Jul 7, 2020
1 parent afddc75 commit 66b578e
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 30 deletions.
17 changes: 6 additions & 11 deletions .travis.yml
Expand Up @@ -14,11 +14,8 @@ python:
- "3.6"

env:
matrix:
- TOXENV=dj22
- TOXENV=dj30

- TOXENV=flake8
- TOXENV=dj22
- TOXENV=dj30

cache:
directories:
Expand All @@ -27,14 +24,12 @@ cache:
install:
- pip install flake8 tox 'coverage<5' coveralls

jobs:
include:
- name: flake8
python: "3.6"
script: flake8 djclick

script:
- tox -e $TOXENV
- coverage report
- coverage html
- coveralls

jobs:
include:
- script: tox -e flake8
4 changes: 1 addition & 3 deletions djclick/adapter.py
Expand Up @@ -2,8 +2,6 @@
import sys
from functools import update_wrapper

import six

import click

from django import get_version, VERSION as DJANGO_VERSION
Expand Down Expand Up @@ -110,7 +108,7 @@ def execute(self, *args, **kwargs):
# Rename kwargs to to the appropriate destination argument name
opt_mapping = dict(self.map_names())
arg_options = {
opt_mapping.get(key, key): value for key, value in six.iteritems(kwargs)
opt_mapping.get(key, key): value for key, value in kwargs.items()
}

# Update the context with the passed (renamed) kwargs
Expand Down
6 changes: 0 additions & 6 deletions djclick/test/test_adapter.py
Expand Up @@ -3,8 +3,6 @@
import codecs
import subprocess

import six

import pytest

import click
Expand All @@ -16,10 +14,6 @@
import djclick


todo = pytest.mark.xfail(reason="TODO")


@pytest.mark.skipif(not six.PY3, reason="Only necessary on Python3")
def test_not_ascii(): # NOCOV
"""
Make sure that the systems preferred encoding is not `ascii`.
Expand Down
4 changes: 0 additions & 4 deletions djclick/test/testprj/testapp/models.py
@@ -1,10 +1,6 @@
from __future__ import unicode_literals

from django.db import models
from six import python_2_unicode_compatible


@python_2_unicode_compatible
class DummyModel(models.Model):
slug = models.CharField(max_length=50)

Expand Down
1 change: 0 additions & 1 deletion requirements-dev.txt
Expand Up @@ -12,7 +12,6 @@ check-manifest
flake8
mccabe
pep8
flake8-todo
pep8-naming
pyflakes

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
@@ -1,2 +1 @@
six>=1.9.0
click>=7.1,<7.2
6 changes: 3 additions & 3 deletions setup.py
Expand Up @@ -18,10 +18,10 @@
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
]


Expand Down
10 changes: 9 additions & 1 deletion tox.ini
Expand Up @@ -4,7 +4,7 @@
# By moving it out of the way (~500MB), we trim test execution time by > 80%.
toxworkdir = {homedir}/.toxenvs/django-click
envlist =
dj{22,30}
dj{22,30},flake8

[testenv]
usedevelop = true
Expand All @@ -17,3 +17,11 @@ deps =
dj22: django>=2.2,<2.3
dj30: django>=3.0,<3.1
commands = py.test -rxs --cov-report= --cov-append --cov djclick {posargs:djclick}


[testenv:flake8]
commands = flake8 djclick


[flake8]
max-line-length = 100

0 comments on commit 66b578e

Please sign in to comment.