pytest-dev / cookiecutter-pytest-plugin Goto Github PK
View Code? Open in Web Editor NEWA Cookiecutter template for pytest plugins 💻
License: MIT License
A Cookiecutter template for pytest plugins 💻
License: MIT License
Having travis (or appveyor) be able to lint my code and any pull requests as part of a contribution is important, and the current templates do not accounts for a flake8 test env.
This should be a choice in cookiecutter.json.
For example like here https://github.com/hackebrot/pytest-emoji
Howdy!
Just passing by to leave this feature suggestion: optionally use flit instead of the classic setup.py
for package publishing.
I plan to try out flit
some time soon, and realized this was a valid enhancement request for cookiecutter-pytest-plugin
. 😉
After installing and creating the plugin structure, I try to run original tests, that ship with plugin template. But that does not work.
For example, one of the tests cannot find default bar
fixture, and I have this error:
Also, testdir.makeini
does not create any params.
I have pytest version 5.3.4 and python 3.8.0.
I think we should include a basic .travis.yml which basically invokes tox. A lot of plugins use Travis: https://travis-ci.org/pytest-dev/
Thank you for the very handy template! Just a curiosity I guess, I created my package, pytest-blah, and there's a source file in the root (pytest_blah.py) along with setup.py etc. When I run python setup.py develop the root containing these files is added to my path, so I can do things like import setup or import pytest_blah directly (I've tried this from outside the root so it's not just a current directory thing).
Have I done something wrong or is that how it's supposed to be? Seems weird to have things like setup.py importable when the package is installed. I ended up making a pytest_blah directory, moving everything from pytest_blah.py into pytest_blah/init.py and putting all the other source files in there and it works as I expect.
EDIT: short example of what I mean: https://gist.github.com/danmur/0489969229281165424b0044f4236b92
I think it makes sense to introduce a src
directory like here https://github.com/hackebrot/pytest-emoji/tree/master/src/pytest_emoji to allow for plugins that use multiple files and help with package discovery and automated testing.
Due to cookiecutter/cookiecutter#458 repeatedly running the same cookiecutter with -f
leads to this behaviour:
(tox) 13:55:53 ob@h2g2 [1] < ~/do/tox-dev > 914 %
rm -rf pytest-foobaz
(tox) 13:56:05 ob@h2g2 [0] < ~/do/tox-dev > 915 %
cookiecutter -f --replay cookiecutter-pytest-plugin
INFO:post_gen_project:Moving files for mkdocs.
INFO:post_gen_project:Removing all temporary license files
INFO:post_gen_project:Removing jinja2 macros
(tox) 13:56:07 ob@h2g2 [0] < ~/do/tox-dev > 916 %
cookiecutter -f --replay cookiecutter-pytest-plugin
INFO:post_gen_project:Moving files for mkdocs.
INFO:post_gen_project:Removing all temporary license files
INFO:post_gen_project:Removing jinja2 macros
(tox) 13:56:09 ob@h2g2 [0] < ~/do/tox-dev > 917 %
cookiecutter -f --replay cookiecutter-pytest-plugin
INFO:post_gen_project:Moving files for mkdocs.
Traceback (most recent call last):
File "/tmp/tmp1np2t72r.py", line 16, in <module>
shutil.move('mkdocs', 'docs')
File "/usr/lib/python3.6/shutil.py", line 542, in move
raise Error("Destination path '%s' already exists" % real_dst)
shutil.Error: Destination path 'docs/mkdocs' already exists
ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)
The first time the project is created and all is fine. The second time around the mkdocs folder is copied into the already existing docs folder therefore doing something wrong but not complaining yet. the third time around it crashes because it tries to write again into the wrong subfolder.
Right now there is only three options of license, there should be a new named "other", so the user could type the license that he/she wants
According to the API docs, as of pytest 6.2, the use of testdir
is discouraged in favor of the new pytester
instance ("New code should avoid using testdir in favor of pytester"). This project should consider updating to comply with the new recommendation.
I grepped my local copy of this repo, and I believe it only references the old 'testdir
instance in the file "test_{{cookiecutter.module_name}}.py".
I may be able to make this change myself and issue a PR at some point in the near future, when my knowledge of Pytest is a bit more complete. :-)
Currently the contributing documentation does not include how to run the tests associated with this cookiecutter. I propose:
Apparently there are problems with the virtualenvs that tox creates for the template. 😕 It is trying to import ConfigParser from Python 2 in a Python 3 environment…that’s messed up.
Add a template for an appveyor.yml
file similar to .travis.yml
.
Note: A lot of projects out there copy/paste a install.ps1
script and use that within the appveyor.yml
file, but if you don't need py26 support this is not necessary because AppVeyor VMs come with py27, py32, py33, py34 and py35 pre-installed so it is just a matter of calling tox
from one of those python versions.
For example:
install:
- set PATH=C:\Python35;C:\Python35\Scripts;%PATH%
- python -m pip install tox
build: false # Not a C# project
test_script:
- tox -e py27,py32,py33,py34,py35
Something minor: The README contains all license links, no matter what license actually was selected.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.