opensuse / pytest-xmlcomp Goto Github PK
View Code? Open in Web Editor NEWA pytest plugin for testing XPath expression on modified XML files
License: GNU General Public License v3.0
A pytest plugin for testing XPath expression on modified XML files
License: GNU General Public License v3.0
The url
keyword points to the wrong GitHub project in the setup.py
file.
Use https://github.com/openSUSE/pytest-xmlcomp in setup.py
Missing quotes in https://github.com/openSUSE/pytest-xmlcomp/blob/master/setup.py#L42
Put quotes around it.
In the README.rst
file, the Travis link goes to the master branch. It should go to the develop branch
master -> develop
(quite easy
The JSON file contains an XPath expression and a list of possible results, for example:
["/d:doc", ["<doc>"]]
However, namespaced result are currently undefined, for example, an element which belongs to a namespace.
The following solutions assume, we have an element doc
in the namespace urn:x-example:ns
with the prefix d
.
Use the Clark notation in the result
<{urn:x-example:ns}doc>
Pros: It's obvious
Cons: Long, incorrect XML notation
Use a prefix
<d:doc>
Pro: Easy to read, correct XML syntax
Cons: Maybe not always obvious which namespace it belongs to.
Possible file: pytest_xmlcomp/plugin.py
, function stringifylist
.
when using a wrongly XML or JSON file for this plugin, the plugin fails.
The plugin should either
Maybe you can use:
pytest.fail()
pytest.skip()
When issue #2 is done, initialize repo to work with GitFlow.
Run git flow init -d
inside master
branch and push to develop
.
The documentation needs some updates.
Correct the following in the README.rst
file:
The other sections ("Features", "Usage") are fixed in other pull requests once we know better what we want.
In order to test stuff, we need to add a .travis.yml
file.
A simple .travis.yml
file could look like this (see Travis documentation for more information):
language: python
sudo: false
env:
global:
- LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
- SEGFAULT_SIGNALS=all
matrix:
include:
- env: TOXENV=flake8
- env: TOXENV=3.4
python: 3.4
- env: TOXENV=3.5
python: 3.5
- env: TOXENV=3.6
python: 3.6
before_install:
- python3 --version
- uname -a
- lsb_release -a
- virtualenv --version
- easy_install --version
- pip --version
- tox --version
install:
# - pip install -U pip setuptools
- pip install -r dev-requirements.pip
script:
- tox -v
before_cache:
- rm -rf $HOME/.cache/pip/log
cache:
directories:
- $HOME/.cache/pip
notifications:
email:
on_success: never
on_failure: always
The MANIFEST.in
file manages what files or directories are added to the distribution file (when you run setup.py sdist
you get a tarball dists/pytest-xmlcomp-VERSION.tar.gz
).
Currently, some files and directories are missing which should be clearly added.
Make the following additions:
*.rst
files*.pip
filestox.ini
docs/
tests/
check-manifest
For details, see https://docs.python.org/2/distutils/sourcedist.html#the-manifest-in-template
Currently, there is no documentation
Add the following topics into the documentation
pytest-xmlcomp
pluginhttp://json.org
python3 -m json.tool foo.json
The plugin comes with options (currently one) which is not documented in the README.rst
file.
Add an additional section about options
The bumpversion
tool needs a configuration file.
See https://pypi.org/project/bumpversion/#configuration
pytest_xmlcomp.py
, for example __version__ = "0.1.0"
docs/index.rst
README.rst
.bumpversion.cfg
and add pointers to all files with version informationAccording to the link above, the content can also be integrated into a setup.cfg
, so a dedicated file is not really necessary. It's a matter of taste.
See issue #19.
Currently, the tox.ini
configuration file requires pytest>=3.0
. However, we need to use our requirement file.
index 07d5d28..5f34e04 100644
--- i/tox.ini
+++ w/tox.ini
@@ -3,7 +3,7 @@
envlist = py34,py35,py36,pypy,flake8
[testenv]
-deps = pytest>=3.0
+deps = -r requirements.pip
commands = pytest {posargs:tests}
the current design in our JSON file doesn't include any namespace definitions.
Maybe add another section which contains the namespaces and the prefixes. These prefixes can be used in the consecutive XPath expression.
One solution could be:
[
[["d", "http://docbook.org/ns/docbook"],
["xi", "http://www.w3.org/2001/XInclude"],
["xlink", "http://www.w3.org/1999/xlink"]
],
["/d:doc", ["<doc>"]],
["/d:doc/foo", ["<foo>"]]
]
The documentation needs Sphinx to build. As such, we should provide a requirement file for documentation too.
Add a requirements.pip
file inside the docs
folder with the following content:
Sphinx
We should also decide on a theme of the documentation, maybe provided as a different module (which has to be inserted as well).
The hook should clearly define its purpose:
pytest_transform_xml
to pytest_xmlcomp_transform_xml
?Our project needs to create a setup.cfg
to collect all helpful configuration options.
The setup.cfg
is an INI file and collects several options for different tools into sections.
[bdist_wheel]
# This flag says to generate wheels that support both Python 2 and Python
# 3. If your code will not run unchanged on both Python 2 and 3, you will
# need to generate separate wheels for each Python version that you
# support.
universal=1
[tool:pytest]
# add special options for pytest
[flake8]
# add special options for flake8
exclude =.env/*,.tmp/*
[pycodestyle]
# maybe we should add this section as well (not sure)
The directory .pytest_cache/
needs to be ignored.
Add .pytest_cache/
in .gitignore
To have a good overview and to help with releases, the project needs a Changelog.
Create a file CHANGELOG.rst
. The content could look like this:
Changelog
=========
0.2.0 (2018-04-24)
---------------------------------
# Add here your list of bugfixes
0.1.0 (2018-04-23)
---------------------------------
* Create initial project
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.