kopia lustrzana https://github.com/longclawshop/longclaw
Initial testing fixes (#485)
* Test py 37,38,39 (#1) dj 22 wt 211,212,213 * Fixes the template include issue with the lock/unlock menu item * Pin the upper bound of the supported Wagtail version to 2.13 and Django to 2.2 * Add some initial documentation for development setuppull/488/head
rodzic
d4e1257033
commit
33f02445ef
|
@ -0,0 +1,56 @@
|
||||||
|
name: Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read # to fetch code (actions/checkout)
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
test-python:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python: ["3.7", "3.8", "3.9"]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install NPM and dependencies
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: '12.x'
|
||||||
|
- name: Build client
|
||||||
|
run: |
|
||||||
|
npm install --prefix ./longclaw/client
|
||||||
|
npm run build --prefix ./longclaw/client
|
||||||
|
- name: Upload client
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: client
|
||||||
|
path: ./longclaw/core/static/core/js
|
||||||
|
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Setup Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install tox tox-gh-actions
|
||||||
|
- name: Download client
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: client
|
||||||
|
path: ./longclaw/core/static/core/js
|
||||||
|
- name: Test with tox
|
||||||
|
run: tox
|
|
@ -54,3 +54,6 @@ docs/_build
|
||||||
webpack-stats.json
|
webpack-stats.json
|
||||||
*bundle.js*
|
*bundle.js*
|
||||||
.eggs/
|
.eggs/
|
||||||
|
|
||||||
|
# local virtual environment
|
||||||
|
/venv
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
3.7
|
4
Makefile
4
Makefile
|
@ -31,13 +31,13 @@ lint: ## check style with flake8
|
||||||
flake8 longclaw tests
|
flake8 longclaw tests
|
||||||
|
|
||||||
test: ## run tests quickly with the default Python
|
test: ## run tests quickly with the default Python
|
||||||
python runtests.py tests
|
python runtests.py
|
||||||
|
|
||||||
test-all: ## run tests on every Python version with tox
|
test-all: ## run tests on every Python version with tox
|
||||||
tox
|
tox
|
||||||
|
|
||||||
coverage: ## check code coverage quickly with the default Python
|
coverage: ## check code coverage quickly with the default Python
|
||||||
coverage run --source longclaw runtests.py tests
|
coverage run --source longclaw runtests.py
|
||||||
coverage report -m
|
coverage report -m
|
||||||
coverage html
|
coverage html
|
||||||
open htmlcov/index.html
|
open htmlcov/index.html
|
||||||
|
|
41
README.md
41
README.md
|
@ -1,7 +1,7 @@
|
||||||
# Longclaw
|
# Longclaw
|
||||||
|
|
||||||
|
|
||||||
## Call For Maintainers
|
## Call For Maintainers
|
||||||
|
|
||||||
If you are interested in developing this project, please get in touch
|
If you are interested in developing this project, please get in touch
|
||||||
https://github.com/JamesRamm/longclaw/issues/375
|
https://github.com/JamesRamm/longclaw/issues/375
|
||||||
|
|
||||||
|
@ -12,8 +12,6 @@ https://github.com/JamesRamm/longclaw/issues/375
|
||||||
|
|
||||||
An e-commerce extension for [Wagtail CMS](https://github.com/wagtail/wagtail)
|
An e-commerce extension for [Wagtail CMS](https://github.com/wagtail/wagtail)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Checkout the [documentation](https://longclawshop.github.io/longclaw/)
|
Checkout the [documentation](https://longclawshop.github.io/longclaw/)
|
||||||
|
|
||||||
![Image of the dashboard](docs/assets/dashboard.png)
|
![Image of the dashboard](docs/assets/dashboard.png)
|
||||||
|
@ -23,28 +21,28 @@ Checkout the [documentation](https://longclawshop.github.io/longclaw/)
|
||||||
Install Longclaw:
|
Install Longclaw:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ pip install longclaw
|
pip install longclaw
|
||||||
```
|
```
|
||||||
|
|
||||||
Setup a Longclaw project
|
Setup a Longclaw project
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ longclaw start my_project
|
longclaw start my_project
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to project directory and create missing migrations
|
Go to project directory and create missing migrations
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ python manage.py makemigrations home catalog
|
python manage.py makemigrations home catalog
|
||||||
```
|
```
|
||||||
|
|
||||||
Do migrations for whole project and run
|
Do migrations for whole project and run
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ python manage.py migrate
|
python manage.py migrate
|
||||||
$ python manage.py loadcountries
|
python manage.py loadcountries
|
||||||
$ python manage.py createsuperuser
|
python manage.py createsuperuser
|
||||||
$ python manage.py runserver
|
python manage.py runserver
|
||||||
```
|
```
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
@ -61,5 +59,28 @@ Do migrations for whole project and run
|
||||||
|
|
||||||
![Order Detail](docs/assets/order_detail.png)
|
![Order Detail](docs/assets/order_detail.png)
|
||||||
|
|
||||||
|
## Development setup
|
||||||
|
|
||||||
|
Work in progress!
|
||||||
|
|
||||||
|
This is a brief guide to setting up a development environment for Longclaw.
|
||||||
|
|
||||||
|
Create a virtualenv and install the requirements
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 -m venv venv
|
||||||
|
source venv/bin/activate
|
||||||
|
pip install -e ".[testing]"
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the tests
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make test
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the tests with TOX
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make test-all
|
||||||
|
```
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from django.utils.module_loading import import_string
|
from django.utils.module_loading import import_string
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from ipware.ip import get_client_ip
|
from ipware import get_client_ip
|
||||||
|
|
||||||
from longclaw.basket.utils import get_basket_items, destroy_basket
|
from longclaw.basket.utils import get_basket_items, destroy_basket
|
||||||
from longclaw.shipping.utils import get_shipping_cost
|
from longclaw.shipping.utils import get_shipping_cost
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
{% include "wagtailadmin/shared/page_status_tag.html" with page=page %}
|
{% include "wagtailadmin/shared/page_status_tag.html" with page=page %}
|
||||||
|
|
||||||
{% include "wagtailadmin/pages/_privacy_switch.html" with page=page page_perms=page_perms only %}
|
{% include "wagtailadmin/pages/_privacy_switch.html" with page=page page_perms=page_perms only %}
|
||||||
{% include "wagtailadmin/pages/_lock_switch.html" %}
|
{% include "wagtailadmin/pages/action_menu/lock_unlock_menu_item.html" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
|
@ -64,7 +64,7 @@ MIDDLEWARE = [
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
|
||||||
'wagtail.core.middleware.SiteMiddleware',
|
'wagtail.contrib.legacy.sitemiddleware.SiteMiddleware',
|
||||||
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
|
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ MIDDLEWARE = [
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'wagtail.core.middleware.SiteMiddleware',
|
'wagtail.contrib.legacy.sitemiddleware.SiteMiddleware',
|
||||||
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
|
'wagtail.contrib.redirects.middleware.RedirectMiddleware',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
--index-url https://pypi.python.org/simple/
|
|
||||||
-e .
|
|
|
@ -1,13 +0,0 @@
|
||||||
-r requirements.txt
|
|
||||||
bumpversion==0.6.0
|
|
||||||
wheel==0.38.1
|
|
||||||
setuptools==65.5.1
|
|
||||||
coverage>=4.5.2
|
|
||||||
mock>=2.0.0
|
|
||||||
flake8>=3.6.0
|
|
||||||
tox>=3.5.3
|
|
||||||
codecov>=2.0.15
|
|
||||||
|
|
||||||
# Additional test requirements go here
|
|
||||||
factory_boy>=2.11.1
|
|
||||||
wagtail-factories>=1.1.0
|
|
29
setup.py
29
setup.py
|
@ -87,14 +87,30 @@ setup(
|
||||||
],
|
],
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'django==2.2.28',
|
'django>=2.2,<3.0',
|
||||||
'wagtail==2.11.8',
|
'wagtail>=2.11,<2.14',
|
||||||
'django-countries==5.5',
|
'django-countries==5.5',
|
||||||
'django-extensions==2.2.1',
|
'django-extensions==2.2.1',
|
||||||
'djangorestframework==3.11.2',
|
'djangorestframework==3.11.2',
|
||||||
'django-ipware==2.1.0',
|
'django-ipware==2.1.0',
|
||||||
'django-polymorphic==2.0.3',
|
'django-polymorphic==2.0.3',
|
||||||
],
|
],
|
||||||
|
extras_require={
|
||||||
|
"testing": [
|
||||||
|
"bumpversion==0.6.0",
|
||||||
|
"wheel==0.38.1",
|
||||||
|
"setuptools==65.5.1",
|
||||||
|
"coverage>=4.5.2",
|
||||||
|
"mock==2.0.0",
|
||||||
|
"flake8>=3.6.0",
|
||||||
|
"tox>=3.5.3",
|
||||||
|
"codecov>=2.0.15",
|
||||||
|
|
||||||
|
"# Additional test requirements go here",
|
||||||
|
"factory_boy>=2.11.1",
|
||||||
|
"wagtail-factories>=1.1.0",
|
||||||
|
],
|
||||||
|
},
|
||||||
license="MIT",
|
license="MIT",
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
keywords='longclaw',
|
keywords='longclaw',
|
||||||
|
@ -102,13 +118,16 @@ setup(
|
||||||
'Development Status :: 3 - Alpha',
|
'Development Status :: 3 - Alpha',
|
||||||
'Framework :: Django',
|
'Framework :: Django',
|
||||||
'Framework :: Django :: 2.0',
|
'Framework :: Django :: 2.0',
|
||||||
|
'Framework :: Wagtail',
|
||||||
|
'Framework :: Wagtail :: 2',
|
||||||
'Intended Audience :: Developers',
|
'Intended Audience :: Developers',
|
||||||
'License :: OSI Approved :: BSD License',
|
'License :: OSI Approved :: BSD License',
|
||||||
'Natural Language :: English',
|
'Natural Language :: English',
|
||||||
'Programming Language :: Python :: 3',
|
'Programming Language :: Python :: 3',
|
||||||
'Programming Language :: Python :: 3.3',
|
'Programming Language :: Python :: 3.7'
|
||||||
'Programming Language :: Python :: 3.4',
|
'Programming Language :: Python :: 3.8'
|
||||||
'Programming Language :: Python :: 3.5',
|
'Programming Language :: Python :: 3.9'
|
||||||
|
'Programming Language :: Python :: 3.10'
|
||||||
],
|
],
|
||||||
entry_points="""
|
entry_points="""
|
||||||
[console_scripts]
|
[console_scripts]
|
||||||
|
|
39
tox.ini
39
tox.ini
|
@ -1,15 +1,40 @@
|
||||||
[tox]
|
[tox]
|
||||||
|
skipsdist = True
|
||||||
|
usedevelop = True
|
||||||
|
skip_missing_interpreters = True
|
||||||
|
|
||||||
envlist =
|
envlist =
|
||||||
{py35,py36,py37}-django-225
|
py{37,38,39}-dj{22}-wt{211,212,213}
|
||||||
|
|
||||||
|
[gh-actions]
|
||||||
|
python =
|
||||||
|
3.7: py37
|
||||||
|
3.8: py38
|
||||||
|
3.9: py39
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
setenv =
|
setenv =
|
||||||
PYTHONPATH = {toxinidir}:{toxinidir}/longclaw
|
PYTHONPATH = {toxinidir}:{toxinidir}/longclaw
|
||||||
commands = coverage run --source longclaw runtests.py
|
|
||||||
coverage xml --omit=*/apps.py,*/migrations/*,*/__init__.py,*/gateways/braintree.py,*/gateways/stripe.py,*/bin/longclaw.py
|
|
||||||
deps =
|
deps =
|
||||||
django-225: Django==2.2.5
|
coverage
|
||||||
-r{toxinidir}/requirements_dev.txt
|
django-extensions
|
||||||
|
django-polymorphic
|
||||||
|
django-ipware
|
||||||
|
mock
|
||||||
|
wagtail-factories
|
||||||
|
|
||||||
|
dj22: Django>=2.2,<3.0
|
||||||
|
dj30: Django>=3.0,<3.1
|
||||||
|
wt211: wagtail>=2.11,<2.12
|
||||||
|
wt212: wagtail>=2.12,<2.13
|
||||||
|
wt213: wagtail>=2.13,<2.14
|
||||||
|
|
||||||
|
install_command = pip install -U {opts} {packages}
|
||||||
|
|
||||||
|
commands =
|
||||||
|
coverage run --source longclaw runtests.py
|
||||||
|
coverage xml --omit=*/apps.py,*/migrations/*,*/__init__.py,*/gateways/braintree.py,*/gateways/stripe.py,*/bin/longclaw.py
|
||||||
|
|
||||||
basepython =
|
basepython =
|
||||||
py37: python3.7
|
py37: python3.7
|
||||||
py36: python3.6
|
|
||||||
py35: python3.5
|
|
||||||
|
|
Ładowanie…
Reference in New Issue