10. 开发说明

在执行以下任何任务之前运行以下命令:

set VIRTUALENV=C:\VirtualEnvs\mappyfile
echo set VIRTUALENV=C:\VirtualEnvs\mappyfile3

%VIRTUALENV%\Scripts\activate
echo set MAPPYFILE_PATH=C:\Code\mappyfile
set MAPPYFILE_PATH=D:\GitHub\mappyfile
cd /D %MAPPYFILE_PATH%

10.1. 构建开发人员虚拟环境

从mappyfile项目文件夹的根目录运行:

set MAPPYFILE_PATH=D:\GitHub\mappyfile
set VIRTUALENV=C:\VirtualEnvs\mappyfile3
cd /D "C:\Python37\Scripts"
REM cd /D "C:\Python27\Scripts"
pip install virtualenv
virtualenv %VIRTUALENV%
%VIRTUALENV%\Scripts\activate
cd /D %MAPPYFILE_PATH%
pip install -r requirements-dev.txt

10.2. 局部测试

另请参见 https://tox.readthedocs.io/en/latest/(运行时 tox

首先将开发代码安装到虚拟环境中:

pip install -e .

从mappyfile项目文件夹的根目录运行:

pytest

要查看将运行哪些测试:

pytest --collect-only

对于单个测试文件:

pytest 测试/test_snippets.py

10.3. 百灵更新

从主控形状更新。https://github.com/erezsh/lark/

pip install git+git://github.com/lark-parser/lark@master -U

10.4. 掉毛

flake8 --ignore=E501,E121,E122,E123,E126,E127,E128 tests --exclude=*/basemaps/*,*/ms-ogc-workshop/*
flake8 mappyfile --max-line-length=120

或导出到文件:

flake8 --ignore=E501,E121,E122,E123,E126,E127,E128 tests > D:\Temp\lint.txt
flake8 mappyfile --max-line-length=120 > D:\Temp\lint.txt

10.5. 勘探者

prospector > prospector.log

10.6. 文档

要构建 Sphinx 文档:

cd /D %MAPPYFILE_PATH%\docs
make.bat html
"_build/html/index.html"