Skip to content

Commit 34ddd53

Browse files
committed
Remove CallableBool and Tests have been update to reflect code changes
1 parent 935b577 commit 34ddd53

File tree

5 files changed

+52
-125
lines changed

5 files changed

+52
-125
lines changed

Makefile

Lines changed: 48 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,68 @@
1-
.PHONY: clean clean-test clean-pyc clean-build docs help
2-
.DEFAULT_GOAL := help
1+
.PHONY: clean
2+
clean: clean-build clean-pyc
33

4-
define BROWSER_PYSCRIPT
5-
import os, webbrowser, sys
6-
7-
from urllib.request import pathname2url
8-
9-
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
10-
endef
11-
export BROWSER_PYSCRIPT
12-
13-
define PRINT_HELP_PYSCRIPT
14-
import re, sys
15-
16-
for line in sys.stdin:
17-
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
18-
if match:
19-
target, help = match.groups()
20-
print("%-20s %s" % (target, help))
21-
endef
22-
export PRINT_HELP_PYSCRIPT
23-
24-
BROWSER := python -c "$$BROWSER_PYSCRIPT"
25-
26-
help:
27-
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
28-
29-
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
30-
31-
clean-build: ## remove build artifacts
4+
.PHONY: clean-build
5+
clean-build:
326
rm -fr build/
337
rm -fr dist/
34-
rm -fr .eggs/
35-
find . -name '*.egg-info' -exec rm -fr {} +
36-
find . -name '*.egg' -exec rm -f {} +
8+
rm -fr *.egg-info
379

38-
clean-pyc: ## remove Python file artifacts
10+
.PHONY: clean-pyc
11+
clean-pyc:
3912
find . -name '*.pyc' -exec rm -f {} +
4013
find . -name '*.pyo' -exec rm -f {} +
4114
find . -name '*~' -exec rm -f {} +
42-
find . -name '__pycache__' -exec rm -fr {} +
4315

44-
clean-test: ## remove test and coverage artifacts
45-
rm -fr .tox/
46-
rm -f .coverage
47-
rm -fr htmlcov/
48-
rm -fr .pytest_cache
16+
.PHONY: lint
17+
lint:
18+
tox -e lint
4919

50-
lint: ## check style with flake8
51-
flake8 rest_framework_simplejwt_mongoengine tests
20+
.PHONY: lint-roll
21+
lint-roll:
22+
isort rest_framework_simplejwt_mongoengine tests
23+
$(MAKE) lint
5224

53-
test: ## run tests quickly with the default Python
54-
pytest
25+
.PHONY: tests
26+
test:
27+
pytest tests
5528

56-
test-all: ## run tests on every Python version with tox
29+
.PHONY: test-all
30+
test-all:
5731
tox
5832

59-
coverage: ## check code coverage quickly with the default Python
60-
coverage run --source rest_framework_simplejwt_mongoengine -m pytest
61-
coverage report -m
62-
coverage html
63-
$(BROWSER) htmlcov/index.html
64-
65-
docs: ## generate Sphinx HTML documentation, including API docs
66-
rm -f docs/rest_framework_simplejwt_mongoengine.rst
67-
rm -f docs/modules.rst
68-
sphinx-apidoc -o docs/ rest_framework_simplejwt_mongoengine
33+
.PHONY: build-docs
34+
build-docs:
35+
sphinx-apidoc -o docs/ . \
36+
setup.py \
37+
*confest* \
38+
tests/* \
39+
rest_framework_simplejwt_mongoengine/token_blacklist/* \
40+
rest_framework_simplejwt_mongoengine/backends.py \
41+
rest_framework_simplejwt_mongoengine/exceptions.py \
42+
rest_framework_simplejwt_mongoengine/settings.py \
43+
rest_framework_simplejwt_mongoengine/state.py
6944
$(MAKE) -C docs clean
7045
$(MAKE) -C docs html
71-
$(BROWSER) docs/_build/html/index.html
46+
$(MAKE) -C docs doctest
7247

73-
servedocs: docs ## compile the docs watching for changes
74-
watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D .
48+
.PHONY: docs
49+
docs: build-docs
50+
open docs/_build/html/index.html
7551

76-
release: dist ## package and upload a release
52+
.PHONY: linux-docs
53+
linux-docs: build-docs
54+
xdg-open docs/_build/html/index.html
55+
56+
.PHONY: pushversion
57+
pushversion:
58+
git push upstream && git push upstream --tags
59+
60+
.PHONY: publish
61+
publish:
62+
python setup.py sdist bdist_wheel
7763
twine upload dist/*
7864

79-
dist: clean ## builds source and wheel package
80-
python setup.py sdist
81-
python setup.py bdist_wheel
65+
.PHONY: dist
66+
dist: clean
67+
python setup.py sdist bdist_wheel
8268
ls -l dist
83-
84-
install: clean ## install the package to the active Python's site-packages
85-
python setup.py install

rest_framework_simplejwt_mongoengine/compat.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

rest_framework_simplejwt_mongoengine/models.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from django.utils.functional import cached_property
22

3-
from .compat import CallableFalse, CallableTrue
43
from .settings import api_settings
54

65

@@ -82,11 +81,11 @@ def has_module_perms(self, module):
8281

8382
@property
8483
def is_anonymous(self):
85-
return CallableFalse
84+
return False
8685

8786
@property
8887
def is_authenticated(self):
89-
return CallableTrue
88+
return True
9089

9190
def get_username(self):
9291
return self.username

tests/test_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from datetime import timedelta
22

3+
from django.urls import reverse
34
from django_mongoengine.mongo_auth.managers import get_user_document
45

5-
from rest_framework_simplejwt_mongoengine.compat import reverse
66
from rest_framework_simplejwt_mongoengine.settings import api_settings
77
from rest_framework_simplejwt_mongoengine.tokens import AccessToken
88

tests/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import contextlib
22

33
from django.test import TestCase
4+
from django.urls import reverse
45
from mongoengine.connection import get_db
56
from rest_framework.test import APIClient
67

7-
from rest_framework_simplejwt_mongoengine.compat import reverse
88
from rest_framework_simplejwt_mongoengine.settings import api_settings
99

1010

0 commit comments

Comments
 (0)