New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

valid8

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

valid8 - pypi Package Compare versions

Comparing version
5.1.1
to
5.1.2
+17
valid8/tests/issues/test_issue_58.py
import pytest
from valid8 import ValidationError, validate
def test_err_msg_formatting():
"""Test for https://github.com/smarie/python-valid8/issues/58"""
class CustomError(ValidationError):
help_msg = "{a}='{b}': hello"
with pytest.raises(CustomError) as err:
validate('dummy', False, equals=True, error_type=CustomError, a=0, b=1)
assert str(err.value) == "0='1': hello. Error validating [dummy=False]. " \
"NotEqual: x == True does not hold for x=False. " \
"Wrong value: False."
+29
-17

@@ -8,8 +8,17 @@ language: python

include:
- python: 2.7
- python: 3.5
- python: 3.6
- python: 3.7
- name: "Python 2.7"
python: 2.7
- name: "Python 3.5"
python: 3.5
- name: "Python 3.6"
python: 3.6
- name: "Python 3.7 - DEPLOY WebSite+Coverage+PyPi"
python: 3.7
env: DEPLOY_ENV="true"
dist: xenial
sudo: true
# - name: "Python 3.8" need autoclass issue solved https://github.com/smarie/python-autoclass/issues/43
# python: 3.8
# dist: xenial
# sudo: true

@@ -27,6 +36,7 @@ env:

- pip list
- pip install six setuptools_scm # apparently python 2 requires this
# Install all requirements using pip
- pip install six setuptools_scm # apparently python 2 requires this done beforehand
- python ci_tools/py_install.py pip ci_tools/requirements-pip.txt
# this does not work anymore on python 2 so lets only do it when needed
- if [ "${TRAVIS_PYTHON_VERSION}" = "3.5" ]; then pip install mkdocs-material mkdocs; fi;
- if [ "${DEPLOY_ENV}" = "true" ]; then pip install mkdocs-material mkdocs pymdown-extensions pygments; fi;
- |

@@ -49,16 +59,15 @@ if [ "${TRAVIS_PYTHON_VERSION}" = "2.7" ]; then

script:
# - coverage run tests.py
# Local installation test
- pip install .
- python -c "import os; os.chdir('..'); import valid8"
# ***tests***
# - coverage run tests.py
# - pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html --cov-report term-missing --cov=./valid8 -v valid8/tests/
# now done in a dedicated script to capture exit code 1 and transform it to 0
- pip uninstall -y valid8 # so that the setuptools_scm test can be executed
# ***tests+coverage*** done in a dedicated script to capture exit code 1 and transform it to 0
- chmod a+x ./ci_tools/run_tests.sh
- sh ./ci_tools/run_tests.sh
- python ci_tools/generate-junit-badge.py 100 # generates the badge for the test results and fail build if less than x%
# generate the badge for the test results and fail build if less than x%
- python ci_tools/generate-junit-badge.py 100
after_success:
# ***reporting***
# - junit2html junit.xml testrun.html output is really not nice
# ***reporting***
# - junit2html junit.xml testrun.html output is really not nice
- ant -f ci_tools/generate-junit-html.xml # generates the html for the test results. Actually we dont use it anymore

@@ -84,3 +93,4 @@ - codecov

# push but only if this is not a build triggered by a pull request
if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_PYTHON_VERSION}" = "3.5" ]; then echo "Pushing to github"; PYTHONPATH=valid8/ mkdocs gh-deploy -v -f docs/mkdocs.yml --remote-name gh-remote; git push gh-remote gh-pages; fi;
# note: do not use the --dirty flag as it breaks client-side search
if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${DEPLOY_ENV}" = "true" ]; then echo "Pushing to github"; PYTHONPATH=valid8/ mkdocs gh-deploy -v -f docs/mkdocs.yml --remote-name gh-remote; git push gh-remote gh-pages; fi;
else

@@ -100,3 +110,4 @@ echo "File 'ci_tools/github_travis_rsa' has not been created, please check your encrypted repo token in .travis.yml, on the line starting with 'openssl aes-256-cbc...'"

tags: true
python: 3.5 #only one of the builds have to be deployed
# python: 3.5 #only one of the builds have to be deployed
condition: $DEPLOY_ENV = "true"
# server: https://test.pypi.org/legacy/

@@ -111,3 +122,4 @@ distributions: "sdist bdist_wheel"

tags: true
python: 3.5 #only one of the builds have to be deployed
# only one of the builds have to be deployed
condition: $DEPLOY_ENV = "true"

@@ -114,0 +126,0 @@ notifications:

@@ -15,20 +15,13 @@ #!/usr/bin/env bash

#if hash pytest 2>/dev/null; then
# echo "pytest found"
#else
# echo "pytest not found. Trying py.test"
#fi
# First the raw for coverage
echo -e "\n\n****** Running tests ******\n\n"
if [ "${TRAVIS_PYTHON_VERSION}" = "3.5" ]; then
# copy the conftest.py file before executing.
# cp ci_tools/conftest.py valid8/
# Note: an alternative could be to add ci_tools/ at the end of the below command but not sure it will be applied on all tests.
coverage run --source valid8 -m pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html -v valid8/
# python -m pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html --cov-report term-missing --cov=./valid8 -v valid8/
if [ "${DEPLOY_ENV}" = "true" ]; then
# full
# Run tests with "python -m pytest" to use the correct version of pytest
echo -e "\n\n****** Running tests with coverage ******\n\n"
coverage run --source valid8 -m pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html -v valid8/tests/
# buggy
# python -m pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html --cov-report term-missing --cov=./valid8 -v valid8/tests/
else
# faster - skip coverage and html report
python -m pytest --junitxml=reports/junit/junit.xml -v valid8/
# faster - skip coverage and html report but keep junit (because used in validity threshold)
echo -e "\n\n****** Running tests******\n\n"
python -m pytest --junitxml=reports/junit/junit.xml -v valid8/tests/
fi
# Changelog
### 5.1.2 - Bugfix with custom error formatting
Fixed issue: custom help messages in `ValidationError` using several variables were not rendering to string correctly and instead were displaying `Error while formatting the help message`. Fixes [#58](https://github.com/smarie/python-valid8/issues/58)
### 5.1.1 - packaging improvements

@@ -4,0 +8,0 @@

# python-validate (valid8)
[![Python versions](https://img.shields.io/pypi/pyversions/valid8.svg)](https://pypi.python.org/pypi/valid8/) [![Build Status](https://travis-ci.org/smarie/python-valid8.svg?branch=master)](https://travis-ci.org/smarie/python-valid8) [![Tests Status](https://smarie.github.io/python-valid8/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-valid8/junit/report.html) [![codecov](https://codecov.io/gh/smarie/python-valid8/branch/master/graph/badge.svg)](https://codecov.io/gh/smarie/python-valid8)
[![Python versions](https://img.shields.io/pypi/pyversions/valid8.svg)](https://pypi.python.org/pypi/valid8/) [![Build Status](https://travis-ci.com/smarie/python-valid8.svg?branch=master)](https://travis-ci.com/smarie/python-valid8) [![Tests Status](https://smarie.github.io/python-valid8/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-valid8/junit/report.html) [![codecov](https://codecov.io/gh/smarie/python-valid8/branch/master/graph/badge.svg)](https://codecov.io/gh/smarie/python-valid8)

@@ -5,0 +5,0 @@ [![Documentation](https://img.shields.io/badge/doc-latest-blue.svg)](https://smarie.github.io/python-valid8/) [![PyPI](https://img.shields.io/pypi/v/valid8.svg)](https://pypi.python.org/pypi/valid8/) [![Downloads](https://pepy.tech/badge/valid8)](https://pepy.tech/project/valid8) [![Downloads per week](https://pepy.tech/badge/valid8/week)](https://pepy.tech/project/valid8) [![GitHub stars](https://img.shields.io/github/stars/smarie/python-valid8.svg)](https://github.com/smarie/python-valid8/stargazers)

# python-validate (valid8)
[![Python versions](https://img.shields.io/pypi/pyversions/valid8.svg)](https://pypi.python.org/pypi/valid8/) [![Build Status](https://travis-ci.org/smarie/python-valid8.svg?branch=master)](https://travis-ci.org/smarie/python-valid8) [![Tests Status](https://smarie.github.io/python-valid8/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-valid8/junit/report.html) [![codecov](https://codecov.io/gh/smarie/python-valid8/branch/master/graph/badge.svg)](https://codecov.io/gh/smarie/python-valid8)
[![Python versions](https://img.shields.io/pypi/pyversions/valid8.svg)](https://pypi.python.org/pypi/valid8/) [![Build Status](https://travis-ci.com/smarie/python-valid8.svg?branch=master)](https://travis-ci.com/smarie/python-valid8) [![Tests Status](https://smarie.github.io/python-valid8/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-valid8/junit/report.html) [![codecov](https://codecov.io/gh/smarie/python-valid8/branch/master/graph/badge.svg)](https://codecov.io/gh/smarie/python-valid8)

@@ -5,0 +5,0 @@ [![Documentation](https://img.shields.io/badge/doc-latest-blue.svg)](https://smarie.github.io/python-valid8/) [![PyPI](https://img.shields.io/pypi/v/valid8.svg)](https://pypi.python.org/pypi/valid8/) [![Downloads](https://pepy.tech/badge/valid8)](https://pepy.tech/project/valid8) [![Downloads per week](https://pepy.tech/badge/valid8/week)](https://pepy.tech/project/valid8) [![GitHub stars](https://img.shields.io/github/stars/smarie/python-valid8.svg)](https://github.com/smarie/python-valid8/stargazers)

Metadata-Version: 2.1
Name: valid8
Version: 5.1.1
Version: 5.1.2
Summary: Yet another validation lib ;). Provides tools for general-purpose variable validation, function inputs/outputs validation as well as class fields validation. All entry points raise consistent ValidationError including all contextual details, with dynamic inheritance of ValueError/TypeError as appropriate.

@@ -9,6 +9,6 @@ Home-page: https://github.com/smarie/python-valid8

License: BSD 3-Clause
Download-URL: https://github.com/smarie/python-valid8/tarball/5.1.1
Download-URL: https://github.com/smarie/python-valid8/tarball/5.1.2
Description: # python-validate (valid8)
[![Python versions](https://img.shields.io/pypi/pyversions/valid8.svg)](https://pypi.python.org/pypi/valid8/) [![Build Status](https://travis-ci.org/smarie/python-valid8.svg?branch=master)](https://travis-ci.org/smarie/python-valid8) [![Tests Status](https://smarie.github.io/python-valid8/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-valid8/junit/report.html) [![codecov](https://codecov.io/gh/smarie/python-valid8/branch/master/graph/badge.svg)](https://codecov.io/gh/smarie/python-valid8)
[![Python versions](https://img.shields.io/pypi/pyversions/valid8.svg)](https://pypi.python.org/pypi/valid8/) [![Build Status](https://travis-ci.com/smarie/python-valid8.svg?branch=master)](https://travis-ci.com/smarie/python-valid8) [![Tests Status](https://smarie.github.io/python-valid8/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-valid8/junit/report.html) [![codecov](https://codecov.io/gh/smarie/python-valid8/branch/master/graph/badge.svg)](https://codecov.io/gh/smarie/python-valid8)

@@ -15,0 +15,0 @@ [![Documentation](https://img.shields.io/badge/doc-latest-blue.svg)](https://smarie.github.io/python-valid8/) [![PyPI](https://img.shields.io/pypi/v/valid8.svg)](https://pypi.python.org/pypi/valid8/) [![Downloads](https://pepy.tech/badge/valid8)](https://pepy.tech/project/valid8) [![Downloads per week](https://pepy.tech/badge/valid8/week)](https://pepy.tech/project/valid8) [![GitHub stars](https://img.shields.io/github/stars/smarie/python-valid8.svg)](https://github.com/smarie/python-valid8/stargazers)

@@ -5,3 +5,3 @@ # python-validate (valid8)

[![Python versions](https://img.shields.io/pypi/pyversions/valid8.svg)](https://pypi.python.org/pypi/valid8/) [![Build Status](https://travis-ci.org/smarie/python-valid8.svg?branch=master)](https://travis-ci.org/smarie/python-valid8) [![Tests Status](https://smarie.github.io/python-valid8/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-valid8/junit/report.html) [![codecov](https://codecov.io/gh/smarie/python-valid8/branch/master/graph/badge.svg)](https://codecov.io/gh/smarie/python-valid8)
[![Python versions](https://img.shields.io/pypi/pyversions/valid8.svg)](https://pypi.python.org/pypi/valid8/) [![Build Status](https://travis-ci.com/smarie/python-valid8.svg?branch=master)](https://travis-ci.com/smarie/python-valid8) [![Tests Status](https://smarie.github.io/python-valid8/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-valid8/junit/report.html) [![codecov](https://codecov.io/gh/smarie/python-valid8/branch/master/graph/badge.svg)](https://codecov.io/gh/smarie/python-valid8)

@@ -8,0 +8,0 @@ [![Documentation](https://img.shields.io/badge/doc-latest-blue.svg)](https://smarie.github.io/python-valid8/) [![PyPI](https://img.shields.io/pypi/v/valid8.svg)](https://pypi.python.org/pypi/valid8/) [![Downloads](https://pepy.tech/badge/valid8)](https://pepy.tech/project/valid8) [![Downloads per week](https://pepy.tech/badge/valid8/week)](https://pepy.tech/project/valid8) [![GitHub stars](https://img.shields.io/github/stars/smarie/python-valid8.svg)](https://github.com/smarie/python-valid8/stargazers)

Metadata-Version: 2.1
Name: valid8
Version: 5.1.1
Version: 5.1.2
Summary: Yet another validation lib ;). Provides tools for general-purpose variable validation, function inputs/outputs validation as well as class fields validation. All entry points raise consistent ValidationError including all contextual details, with dynamic inheritance of ValueError/TypeError as appropriate.

@@ -9,6 +9,6 @@ Home-page: https://github.com/smarie/python-valid8

License: BSD 3-Clause
Download-URL: https://github.com/smarie/python-valid8/tarball/5.1.1
Download-URL: https://github.com/smarie/python-valid8/tarball/5.1.2
Description: # python-validate (valid8)
[![Python versions](https://img.shields.io/pypi/pyversions/valid8.svg)](https://pypi.python.org/pypi/valid8/) [![Build Status](https://travis-ci.org/smarie/python-valid8.svg?branch=master)](https://travis-ci.org/smarie/python-valid8) [![Tests Status](https://smarie.github.io/python-valid8/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-valid8/junit/report.html) [![codecov](https://codecov.io/gh/smarie/python-valid8/branch/master/graph/badge.svg)](https://codecov.io/gh/smarie/python-valid8)
[![Python versions](https://img.shields.io/pypi/pyversions/valid8.svg)](https://pypi.python.org/pypi/valid8/) [![Build Status](https://travis-ci.com/smarie/python-valid8.svg?branch=master)](https://travis-ci.com/smarie/python-valid8) [![Tests Status](https://smarie.github.io/python-valid8/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-valid8/junit/report.html) [![codecov](https://codecov.io/gh/smarie/python-valid8/branch/master/graph/badge.svg)](https://codecov.io/gh/smarie/python-valid8)

@@ -15,0 +15,0 @@ [![Documentation](https://img.shields.io/badge/doc-latest-blue.svg)](https://smarie.github.io/python-valid8/) [![PyPI](https://img.shields.io/pypi/v/valid8.svg)](https://pypi.python.org/pypi/valid8/) [![Downloads](https://pepy.tech/badge/valid8)](https://pepy.tech/project/valid8) [![Downloads per week](https://pepy.tech/badge/valid8/week)](https://pepy.tech/project/valid8) [![GitHub stars](https://img.shields.io/github/stars/smarie/python-valid8.svg)](https://github.com/smarie/python-valid8/stargazers)

@@ -74,2 +74,3 @@ .gitignore

valid8/tests/issues/test_issue_53.py
valid8/tests/issues/test_issue_58.py
valid8/tests/pkging/__init__.py

@@ -76,0 +77,0 @@ valid8/tests/pkging/test_packaging.py

# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
version = '5.1.1'
version = '5.1.2'
version_tuple = (5, 1, 2)

@@ -226,3 +226,4 @@ import sys

is_context_a_copy = False
variables = re.findall("{\\S+}", help_msg)
# note: use question mark so as to be non-greedy
variables = re.findall("{\\S+?}", help_msg)
for var_name_ in set(variables):

@@ -229,0 +230,0 @@ # extract the variable name