pytest-helpers-namespace-2021.4.29/0000755000175000017500000000000014042473100017550 5ustar vampasvampas00000000000000pytest-helpers-namespace-2021.4.29/.coveragerc0000644000175000017500000000141714026636637021716 0ustar vampasvampas00000000000000[run] branch = True cover_pylib = False parallel = True concurrency = multiprocessing relative_files = True omit = .nox/* setup.py [report] # Regexes for lines to exclude from consideration exclude_lines = # Have to re-enable the standard pragma pragma: no cover # Don't complain about missing debug-only code: def __repr__ # Don't complain if tests don't hit defensive assertion code: raise AssertionError raise NotImplementedError # Don't complain if non-runnable code isn't run: if 0: if False: if __name__ == .__main__.: omit = .nox/* setup.py src/pytest_helpers_namespace/version.py tests/support/coverage/sitecustomize.py ignore_errors = True [paths] source = src/pytest_helpers_namespace testsuite = tests/ pytest-helpers-namespace-2021.4.29/.github/0000755000175000017500000000000014042473100021110 5ustar vampasvampas00000000000000pytest-helpers-namespace-2021.4.29/.github/workflows/0000755000175000017500000000000014042473100023145 5ustar vampasvampas00000000000000pytest-helpers-namespace-2021.4.29/.github/workflows/testing.yml0000644000175000017500000003022214042473003025346 0ustar vampasvampas00000000000000name: CI on: [push, pull_request] jobs: Pre-Commit: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - name: Set up Python uses: actions/setup-python@v2 with: python-version: 3.7 - id: changed-files name: Get Changed Files uses: dorny/paths-filter@v2 with: token: ${{ github.token }} list-files: shell filters: | repo: - added|modified: - '**' - name: Set Cache Key run: echo "PY=$(python --version --version | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - uses: actions/cache@v2 with: path: ~/.cache/pre-commit key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} - name: Check ALL Files On Branch uses: pre-commit/action@v2.0.0 if: github.event_name != 'pull_request' - name: Check Changed Files On PR uses: pre-commit/action@v2.0.0 if: github.event_name == 'pull_request' with: extra_args: --files ${{ steps.changed-files.outputs.repo_files }} Docs: runs-on: ubuntu-20.04 needs: Pre-Commit timeout-minutes: 10 steps: - uses: actions/checkout@v2 - name: Set up Python 3.7 For Nox uses: actions/setup-python@v2 with: python-version: 3.7 - name: Install Nox run: | python -m pip install --upgrade pip pip install nox - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install Doc Requirements run: | nox --force-color -e docs --install-only - name: Build Docs env: SKIP_REQUIREMENTS_INSTALL: YES run: | nox --force-color -e docs Linux: runs-on: ubuntu-20.04 needs: Pre-Commit timeout-minutes: 20 strategy: fail-fast: false max-parallel: 5 matrix: python-version: - 3.5 - 3.6 - 3.7 - 3.8 - 3.9 pytest-version: - "~=6.0.0" - "~=6.1.0" - "" steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install Nox run: | python -m pip install --upgrade pip pip install nox - name: Install Test Requirements env: PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }} run: | nox --force-color -e tests-${{ matrix.python-version }} --install-only - name: Test id: run-tests env: SKIP_REQUIREMENTS_INSTALL: YES run: | nox --force-color -e tests-${{ matrix.python-version }} -- -vv tests/ - name: Create CodeCov Flags if: always() id: codecov-flags run: | echo ::set-output name=flags::$(python -c "import sys; print('{},{},pytest${{ matrix.pytest-version || 'latest' }}'.format('${{ runner.os }}'.replace('-latest', ''), 'py{}{}'.format(*sys.version_info)))") - name: Upload Helpers Namespace Code Coverage if: always() shell: bash env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},helpers REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-helpers REPORT_PATH: artifacts/coverage-project.xml run: | if [ ! -f codecov.sh ]; then n=0 until [ "$n" -ge 5 ] do if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then break fi n=$((n+1)) sleep 15 done fi if [ -f codecov.sh ]; then n=0 until [ "$n" -ge 5 ] do if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then break fi n=$((n+1)) sleep 15 done fi - name: Upload Helpers Namespace Tests Code Coverage if: always() shell: bash env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},helpers REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-tests REPORT_PATH: artifacts/coverage-tests.xml run: | if [ ! -f codecov.sh ]; then n=0 until [ "$n" -ge 5 ] do if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then break fi n=$((n+1)) sleep 15 done fi if [ -f codecov.sh ]; then n=0 until [ "$n" -ge 5 ] do if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then break fi n=$((n+1)) sleep 15 done fi - name: Upload Logs if: always() uses: actions/upload-artifact@main with: name: runtests-${{ runner.os }}-py${{ matrix.python-version }}.log path: artifacts/runtests-*.log Windows: runs-on: windows-latest needs: Pre-Commit timeout-minutes: 40 strategy: fail-fast: false max-parallel: 5 matrix: python-version: - 3.5 - 3.6 - 3.7 - 3.8 - 3.9 pytest-version: - "~=6.0.0" - "~=6.1.0" - "" steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install Nox run: | python -m pip install --upgrade pip pip install nox - name: Install Test Requirements env: PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }} shell: bash run: | export PATH="/C/Program Files (x86)/Windows Kits/10/bin/10.0.18362.0/x64;$PATH" nox --force-color -e tests-${{ matrix.python-version }} --install-only - name: Test id: run-tests shell: bash env: SKIP_REQUIREMENTS_INSTALL: YES run: | export PATH="/C/Program Files (x86)/Windows Kits/10/bin/10.0.18362.0/x64;$PATH" nox --force-color -e tests-${{ matrix.python-version }} -- -vv tests/ - name: Create CodeCov Flags if: always() id: codecov-flags run: | echo ::set-output name=flags::$(python -c "import sys; print('{},{},pytest${{ matrix.pytest-version || 'latest' }}'.format('${{ runner.os }}'.replace('-latest', ''), 'py{}{}'.format(*sys.version_info)))") - name: Upload Helpers Namespace Code Coverage if: always() shell: bash env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},helpers REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-helpers REPORT_PATH: artifacts/coverage-project.xml run: | if [ ! -f codecov.sh ]; then n=0 until [ "$n" -ge 5 ] do if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then break fi n=$((n+1)) sleep 15 done fi if [ -f codecov.sh ]; then n=0 until [ "$n" -ge 5 ] do if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then break fi n=$((n+1)) sleep 15 done fi - name: Upload Helpers Namespace Tests Code Coverage if: always() shell: bash env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},helpers REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-tests REPORT_PATH: artifacts/coverage-tests.xml run: | if [ ! -f codecov.sh ]; then n=0 until [ "$n" -ge 5 ] do if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then break fi n=$((n+1)) sleep 15 done fi if [ -f codecov.sh ]; then n=0 until [ "$n" -ge 5 ] do if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then break fi n=$((n+1)) sleep 15 done fi - name: Upload Logs if: always() uses: actions/upload-artifact@main with: name: runtests-${{ runner.os }}-py${{ matrix.python-version }}.log path: artifacts/runtests-*.log macOS: runs-on: macOS-latest needs: Pre-Commit timeout-minutes: 60 strategy: fail-fast: false max-parallel: 5 matrix: python-version: - 3.5 - 3.6 - 3.7 - 3.8 - 3.9 pytest-version: - "~=6.0.0" - "~=6.1.0" - "" steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install Nox run: | python -m pip install --upgrade pip pip install nox - name: Install Test Requirements env: PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }} run: | nox --force-color -e tests-${{ matrix.python-version }} --install-only - name: Test id: run-tests env: SKIP_REQUIREMENTS_INSTALL: YES run: | nox --force-color -e tests-${{ matrix.python-version }} -- -vv tests/ - name: Create CodeCov Flags if: always() id: codecov-flags run: | echo ::set-output name=flags::$(python -c "import sys; print('{},{},pytest${{ matrix.pytest-version || 'latest' }}'.format('${{ runner.os }}'.replace('-latest', ''), 'py{}{}'.format(*sys.version_info)))") - name: Upload Helpers Namespace Code Coverage if: always() shell: bash env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},helpers REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-helpers REPORT_PATH: artifacts/coverage-project.xml run: | if [ ! -f codecov.sh ]; then n=0 until [ "$n" -ge 5 ] do if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then break fi n=$((n+1)) sleep 15 done fi if [ -f codecov.sh ]; then n=0 until [ "$n" -ge 5 ] do if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then break fi n=$((n+1)) sleep 15 done fi - name: Upload Helpers Namespace Tests Code Coverage if: always() shell: bash env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},helpers REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-tests REPORT_PATH: artifacts/coverage-tests.xml run: | if [ ! -f codecov.sh ]; then n=0 until [ "$n" -ge 5 ] do if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then break fi n=$((n+1)) sleep 15 done fi if [ -f codecov.sh ]; then n=0 until [ "$n" -ge 5 ] do if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then break fi n=$((n+1)) sleep 15 done fi - name: Upload Logs if: always() uses: actions/upload-artifact@main with: name: runtests-${{ runner.os }}-py${{ matrix.python-version }}.log path: artifacts/runtests-*.log pytest-helpers-namespace-2021.4.29/.gitignore0000644000175000017500000000153714026605535021561 0ustar vampasvampas00000000000000# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python env/ build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ *.egg-info/ .installed.cfg *.egg # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *,cover .hypothesis/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py # Flask instance folder instance/ # Sphinx documentation docs/_build/ # PyBuilder target/ # IPython Notebook .ipynb_checkpoints # pyenv .python-version .lvimrc artifacts/ pytest-helpers-namespace-2021.4.29/.pre-commit-config.yaml0000644000175000017500000000451714042473003024042 0ustar vampasvampas00000000000000--- minimum_pre_commit_version: 1.15.2 repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.1.0 hooks: - id: check-merge-conflict # Check for files that contain merge conflict strings. - id: trailing-whitespace # Trims trailing whitespace. args: [--markdown-linebreak-ext=md] - id: mixed-line-ending # Replaces or checks mixed line ending. args: [--fix=lf] - id: end-of-file-fixer # Makes sure files end in a newline and only a newline. - id: check-merge-conflict # Check for files that contain merge conflict strings. - id: check-ast # Simply check whether files parse as valid python. - repo: local hooks: - id: sort-pylint-spelling-words name: Sort PyLint Spelling Words File entry: python .pre-commit-hooks/sort-pylint-spelling-words.py language: system files: ^\.pylint-spelling-words$ - repo: https://github.com/asottile/pyupgrade rev: v2.10.0 hooks: - id: pyupgrade name: Rewrite Code to be Py3.5+ args: [--py3-plus] - repo: https://github.com/hakancelik96/unimport rev: "31cc123640880e385159c719d2f12b5cf8586495" hooks: - id: unimport name: Remove unused imports args: [--remove] #exclude: ^(docs/.*\.py|src/pytest_helpers_namespace/factories/(cli|daemons)/__init__\.py)$ exclude: ^docs/.*\.py$ - repo: https://github.com/asottile/reorder_python_imports rev: v2.4.0 hooks: - id: reorder-python-imports args: [ --py3-plus, ] exclude: src/pytest_helpers_namespace/version.py - repo: https://github.com/psf/black rev: 21.4b2 hooks: - id: black args: [-l 100] exclude: src/pytest_helpers_namespace/version.py - repo: https://github.com/asottile/blacken-docs rev: v1.7.0 hooks: - id: blacken-docs args: [--skip-errors] files: ^docs/.*\.rst additional_dependencies: [black==21.4b2] - repo: https://github.com/pre-commit/mirrors-pylint rev: v2.4.4 hooks: - id: pylint name: PyLint args: [--output-format=parseable, --rcfile=.pylintrc] exclude: src/pytest_helpers_namespace/version.py additional_dependencies: - saltpylint - pyenchant - salt>=3001 pytest-helpers-namespace-2021.4.29/.pre-commit-hooks/0000755000175000017500000000000014042473100023023 5ustar vampasvampas00000000000000pytest-helpers-namespace-2021.4.29/.pre-commit-hooks/sort-pylint-spelling-words.py0000755000175000017500000000077214026353011030661 0ustar vampasvampas00000000000000#!/usr/bin/env python # pylint: skip-file import pathlib REPO_ROOT = pathlib.Path(__name__).resolve().parent PYLINT_SPELLING_WORDS = REPO_ROOT / ".pylint-spelling-words" def sort(): in_contents = PYLINT_SPELLING_WORDS.read_text() out_contents = "" out_contents += "\n".join(sorted([line.lower() for line in in_contents.splitlines()])) out_contents += "\n" if in_contents != out_contents: PYLINT_SPELLING_WORDS.write_text(out_contents) if __name__ == "__main__": sort() pytest-helpers-namespace-2021.4.29/.pylint-spelling-words0000644000175000017500000000026614026647311024054 0ustar vampasvampas00000000000000abspath autodoc config confvals css favicon favicons ico intersphinx intl minify namespace namespaces nox os png pragma pytest rc repo rst sitecustomize sitevars sys toc virtualenvs pytest-helpers-namespace-2021.4.29/.pylintrc0000644000175000017500000003244214026646440021435 0ustar vampasvampas00000000000000[MASTER] # Specify a configuration file. #rcfile= # Python code to execute, usually for sys.path manipulation such as # pygtk.require(). #init-hook= # Profiled execution. profile=no # Add files or directories to the blacklist. They should be base names, not # paths. ignore=CVS,_version.py # Pickle collected data for later comparisons. persistent=yes # List of plugins (as comma separated values of python modules names) to load, # usually to register additional checkers. load-plugins=saltpylint.pep8, saltpylint.strings, saltpylint.fileperms, saltpylint.smartup, # Use multiple processes to speed up Pylint. jobs=1 # Allow loading of arbitrary C extensions. Extensions are imported into the # active Python interpreter and may run arbitrary code. unsafe-load-any-extension=no # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may # run arbitrary code extension-pkg-whitelist= # Fileperms Lint Plugin Settings fileperms-default=0644 fileperms-ignore-paths=setup.py [MESSAGES CONTROL] # Only show warnings with the listed confidence levels. Leave empty to show # all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED confidence= # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option # multiple time. See also the "--disable" option for examples. #enable= # Disable the message, report, category or checker with the given id(s). You # can either give multiple identifiers separated by comma (,) or put this # option multiple times (only on the command line, not in the configuration # file where it should appear only once).You can also use "--disable=all" to # disable everything first and then reenable specific checks. For example, if # you want to run only the similarities checker, you can use "--disable=all # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" #disable= disable=R, I0011, I0012, I0013, E1101, E1103, C0102, C0103, C0111, C0203, C0204, C0301, C0302, C0330, W0110, W0122, W0142, W0201, W0212, W0404, W0511, W0603, W0612, W0613, W0621, W0622, W0631, W0704, W1202, W1307, F0220, F0401, E8501, E8116, E8121, E8122, E8123, E8124, E8125, E8126, E8127, E8128, E8129, E8131, E8265, E8266, E8402, E8731, locally-disabled, repr-flag-used-in-string, un-indexed-curly-braces-error, un-indexed-curly-braces-warning, import-outside-toplevel, wrong-import-position, wrong-import-order, missing-whitespace-after-comma # Disabled: # R* [refactoring suggestions & reports] # I0011 (locally-disabling) # I0012 (locally-enabling) # I0013 (file-ignored) # E1101 (no-member) [pylint isn't smart enough] # E1103 (maybe-no-member) # C0102 (blacklisted-name) [because it activates C0103 too] # C0103 (invalid-name) # C0111 (missing-docstring) # C0203 (bad-mcs-method-argument) # C0204 (bad-mcs-classmethod-argument) # C0301 (line-too-long) # C0302 (too-many-lines) # C0330 (bad-continuation) # W0110 (deprecated-lambda) # W0122 (exec-statement) # W0142 (star-args) # W0201 (attribute-defined-outside-init) [done in several places in the codebase] # W0212 (protected-access) # W0404 (reimported) [done intentionally for legit reasons] # W0511 (fixme) [several outstanding instances currently in the codebase] # W0603 (global-statement) # W0612 (unused-variable) [unused return values] # W0613 (unused-argument) # W0621 (redefined-outer-name) # W0622 (redefined-builtin) [many parameter names shadow builtins] # W0631 (undefined-loop-variable) [~3 instances, seem to be okay] # W0704 (pointless-except) [misnomer; "ignores the exception" rather than "pointless"] # F0220 (unresolved-interface) # F0401 (import-error) # W1202 (logging-format-interpolation) Use % formatting in logging functions but pass the % parameters as arguments # W1307 (invalid-format-index) Using invalid lookup key '%s' in format specifier "0['%s']" # # E8116 PEP8 E116: unexpected indentation (comment) # E812* All PEP8 E12* # E8265 PEP8 E265 - block comment should start with "# " # E8266 PEP8 E266 - too many leading '#' for block comment # E8501 PEP8 line too long # E8402 module level import not at top of file # E8731 do not assign a lambda expression, use a def # # E1322(repr-flag-used-in-string) [REPORTS] # Set the output format. Available formats are text, parseable, colorized, msvs # (visual studio) and html. You can also give a reporter class, eg # mypackage.mymodule.MyReporterClass. output-format=text # Put messages in a separate file for each module / package specified on the # command line instead of printing them on stdout. Reports (if any) will be # written in a file name "pylint_global.[txt|html]". files-output=no # Tells whether to display a full report or only the messages reports=no # Python expression which should return a note less than 10 (10 is the highest # note). You have access to the variables errors warning, statement which # respectively contain the number of errors / warnings messages and the total # number of statements analyzed. This is used by the global evaluation report # (RP0004). evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) # Add a comment according to your evaluation note. This is used by the global # evaluation report (RP0004). comment=no # Template used to display messages. This is a python new-style format string # used to format the message information. See doc for all details #msg-template= [LOGGING] # Logging modules to check that the string format arguments are in logging # function parameter format logging-modules=logging [SPELLING] # Spelling dictionary name. Available dictionaries: none. To make it working # install python-enchant package. spelling-dict=en_US # List of comma separated words that should not be checked. spelling-ignore-words= # A path to a file that contains private dictionary; one word per line. spelling-private-dict-file=.pylint-spelling-words # Tells whether to store unknown words to indicated private dictionary in # --spelling-private-dict-file option instead of raising a message. spelling-store-unknown-words=no [SIMILARITIES] # Minimum lines number of a similarity. min-similarity-lines=4 # Ignore comments when computing similarities. ignore-comments=yes # Ignore docstrings when computing similarities. ignore-docstrings=yes # Ignore imports when computing similarities. ignore-imports=no [VARIABLES] # Tells whether we should check for unused import in __init__ files. init-import=no # A regular expression matching the name of dummy variables (i.e. expectedly # not used). dummy-variables-rgx=_$|dummy # List of additional names supposed to be defined in builtins. Remember that # you should avoid to define new builtins when possible. additional-builtins=__opts__,__virtual__,__salt_system_encoding__,__context__ # List of strings which can identify a callback function by name. A callback # name must start or end with one of those strings. callbacks=cb_,_cb [MISCELLANEOUS] # List of note tags to take in consideration, separated by a comma. notes=FIXME,XXX,TODO [BASIC] # List of builtins function names that should not be used, separated by a comma bad-functions=map,filter,input # Good variable names which should always be accepted, separated by a comma good-names=i,j,k,ex,Run,_,log,pytest_plugins,__opts__,__context__ # Bad variable names which should always be refused, separated by a comma bad-names=foo,bar,baz,toto,tutu,tata # Colon-delimited sets of names that determine each other's naming style when # the name regexes allow several styles. name-group= # Include a hint for the correct naming format with invalid-name include-naming-hint=no # Regular expression matching correct function names function-rgx=[a-z_][a-z0-9_]{2,60}$ # Naming hint for function names function-name-hint=[a-z_][a-z0-9_]{2,60}$ # Regular expression matching correct variable names variable-rgx=[a-z_][a-z0-9_]{2,60}$ # Naming hint for variable names variable-name-hint=[a-z_][a-z0-9_]{2,60}$ # Regular expression matching correct constant names const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ # Naming hint for constant names const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ # Regular expression matching correct attribute names attr-rgx=[a-z_][a-z0-9_]{2,60}$ # Naming hint for attribute names attr-name-hint=[a-z_][a-z0-9_]{2,60}$ # Regular expression matching correct argument names argument-rgx=[a-z_][a-z0-9_]{2,60}$ # Naming hint for argument names argument-name-hint=[a-z_][a-z0-9_]{2,60}$ # Regular expression matching correct class attribute names class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,60}|(__.*__))$ # Naming hint for class attribute names class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,60}|(__.*__))$ # Regular expression matching correct inline iteration names inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ # Naming hint for inline iteration names inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ # Regular expression matching correct class names class-rgx=[A-Z_][a-zA-Z0-9]+$ # Naming hint for class names class-name-hint=[A-Z_][a-zA-Z0-9]+$ # Regular expression matching correct module names module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ # Naming hint for module names module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ # Regular expression matching correct method names method-rgx=[a-z_][a-z0-9_]{2,60}$ # Naming hint for method names method-name-hint=[a-z_][a-z0-9_]{2,60}$ # Regular expression which should only match function or class names that do # not require a docstring. no-docstring-rgx=__.*__ # Minimum line length for functions/classes that require docstrings, shorter # ones are exempt. docstring-min-length=-1 [FORMAT] # Maximum number of characters on a single line. max-line-length=120 # Regexp for a line that is allowed to be longer than the limit. ignore-long-lines=^\s*(# )??$ # Allow the body of an if to be on the same line as the test if there is no # else. single-line-if-stmt=no # List of optional constructs for which whitespace checking is disabled no-space-check=trailing-comma,dict-separator # Maximum number of lines in a module max-module-lines=1000 # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 # tab). indent-string=' ' # Number of spaces of indent required inside a hanging or continued line. indent-after-paren=4 # Expected format of line ending, e.g. empty (any line ending), LF or CRLF. expected-line-ending-format=LF [TYPECHECK] # Tells whether missing members accessed in mixin class should be ignored. A # mixin class is detected if its name ends with "mixin" (case insensitive). ignore-mixin-members=yes # List of module names for which member attributes should not be checked # (useful for modules/projects where namespaces are manipulated during runtime # and thus existing member attributes cannot be deduced by static analysis ignored-modules= # List of classes names for which member attributes should not be checked # (useful for classes with attributes dynamically set). ignored-classes= # When zope mode is activated, add a predefined set of Zope acquired attributes # to generated-members. zope=no # List of members which are set dynamically and missed by pylint inference # system, and so shouldn't trigger E0201 when accessed. Python regular # expressions are accepted. generated-members= [IMPORTS] # Deprecated modules which should not be used, separated by a comma deprecated-modules=regsub,TERMIOS,Bastion,rexec # Create a graph of every (i.e. internal and external) dependencies in the # given file (report RP0402 must not be disabled) import-graph= # Create a graph of external dependencies in the given file (report RP0402 must # not be disabled) ext-import-graph= # Create a graph of internal dependencies in the given file (report RP0402 must # not be disabled) int-import-graph= [DESIGN] # Maximum number of arguments for function / method max-args=5 # Argument names that match this expression will be ignored. Default to name # with leading underscore ignored-argument-names=_{1,2} # Maximum number of locals for function / method body max-locals=15 # Maximum number of return / yield for function / method body max-returns=6 # Maximum number of branch for function / method body max-branches=12 # Maximum number of statements in function / method body max-statements=50 # Maximum number of parents for a class (see R0901). max-parents=7 # Maximum number of attributes for a class (see R0902). max-attributes=7 # Minimum number of public methods for a class (see R0903). min-public-methods=2 # Maximum number of public methods for a class (see R0904). max-public-methods=20 [CLASSES] # List of method names used to declare (i.e. assign) instance attributes. defining-attr-methods=__init__,__new__,setUp # List of valid names for the first argument in a class method. valid-classmethod-first-arg=cls # List of valid names for the first argument in a metaclass class method. valid-metaclass-classmethod-first-arg=mcs # List of member names, which should be excluded from the protected access # warning. exclude-protected=_asdict,_fields,_replace,_source,_make [EXCEPTIONS] # Exceptions that will emit a warning when being caught. Defaults to # "Exception" overgeneral-exceptions=Exception pytest-helpers-namespace-2021.4.29/AUTHORS.rst0000644000175000017500000000076513201377123021443 0ustar vampasvampas00000000000000Authors ======= Here's a list of everyone who contributed to pytest-helpers-namespace in alphabetical order. ========================== ===================== ============================ Name Nick Email ========================== ===================== ============================ Logan Glickfield lsglick Nikita Sobolev sobolevn mail@sobolevn.me Pedro Algarvio s0undt3ch pedro@algarvio.me pytest-helpers-namespace-2021.4.29/LICENSE0000644000175000017500000002605713201375772020603 0ustar vampasvampas00000000000000Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2017 SaltStack Team Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. pytest-helpers-namespace-2021.4.29/PKG-INFO0000644000175000017500000002053314042473100020650 0ustar vampasvampas00000000000000Metadata-Version: 2.1 Name: pytest-helpers-namespace Version: 2021.4.29 Summary: Pytest Helpers Namespace Plugin Home-page: https://github.com/saltstack/pytest-helpers-namespace Author: Pedro Algarvio Author-email: pedro@algarvio.me License: Apache Software License 2.0 Project-URL: Source, https://github.com/saltstack/pytest-helpers-namespace Project-URL: Tracker, https://github.com/saltstack/pytest-helpers-namespace/issues Project-URL: Documentation, https://pytest-helpers-namespace.readthedocs.io Description: .. image:: https://github.com/saltstack/pytest-helpers-namespace/actions/workflows/testing.yml/badge.svg :target: https://github.com/saltstack/pytest-helpers-namespace/actions/workflows/testing.yml :alt: See Build Status .. image:: https://codecov.io/github/saltstack/pytest-helpers-namespace/coverage.svg?branch=master :target: https://codecov.io/github/saltstack/pytest-helpers-namespace?branch=master :alt: Code Coverage .. image:: https://img.shields.io/pypi/v/pytest-helpers-namespace.svg?style=flat :alt: PyPI Package latest release :target: https://pypi.python.org/pypi/pytest-helpers-namespace .. image:: https://img.shields.io/pypi/dm/pytest-helpers-namespace.svg?style=flat :alt: PyPI Package monthly downloads :target: https://pypi.python.org/pypi/pytest-helpers-namespace .. image:: https://img.shields.io/pypi/wheel/pytest-helpers-namespace.svg?style=flat :alt: PyPI Wheel :target: https://pypi.python.org/pypi/pytest-helpers-namespace .. image:: https://img.shields.io/pypi/pyversions/pytest-helpers-namespace.svg?style=flat :alt: Supported versions :target: https://pypi.python.org/pypi/pytest-helpers-namespace .. image:: https://img.shields.io/pypi/implementation/pytest-helpers-namespace.svg?style=flat :alt: Supported implementations :target: https://pypi.python.org/pypi/pytest-helpers-namespace Pytest Helpers Namespace ======================== This plugin does not provide any helpers to `pytest`_, it does, however, provide a helpers namespace in `pytest`_ which enables you to register helper functions in your ``conftest.py`` to be used within your tests without having to import them. Features -------- * Provides a ``helpers`` `pytest`_ namespace which can be used to register helper functions without requiring you to import them on your actual tests to use them. Requirements ------------ * None! Installation ------------ You can install "pytest-helpers-namespace" via `pip`_ from `PyPI`_:: $ pip install pytest-helpers-namespace Usage ----- Consider the following ``conftest.py`` file: .. code-block:: python import pytest @pytest.helpers.register def foo(bar): ''' this dumb helper function will just return what you pass to it ''' return bar And now consider the following test case: .. code-block:: python def test_helper_namespace(): assert pytest.helpers.foo(True) is True Pretty simple right?! You can even nest namespaces. Consider the following ``conftest.py`` file: .. code-block:: python pytest_plugins = ['helpers_namespace'] import pytest @pytest.helpers.can.haz.register def foo(bar): ''' this dumb helper function will just return what you pass to it ''' return bar And now consider the following test case: .. code-block:: python def test_helper_namespace(): assert pytest.helpers.can.haz.foo(True) is True You can even pass a name to the register function and that will be the helper function name. Contributing ------------ Contributions are very welcome. Tests can be run with `nox`_, please ensure the coverage at least stays the same before you submit a pull request. License ------- Distributed under the terms of the `Apache Software License 2.0`_ license, "pytest-helpers-namespace" is free and open source software. Issues ------ If you encounter any problems, please `file an issue`_ along with a detailed description. Changelog --------- v2021.3.24 ~~~~~~~~~~ * Switched project to a ``src`` layout. * Switched project to a declarative setuptools approach * Added support to check if a helper has been registered * Pytest >= 6.1.1 is now required v2019.1.8 ~~~~~~~~~ * Patch PyTest before any ``conftest.py`` file is processed. v2019.1.7 ~~~~~~~~~ * Support PyTest >= 4.1 v2019.1.6.post1 ~~~~~~~~~~~~~~~ * No changes were made besides locking to PyTest < 4.0 v2019.1.6 ~~~~~~~~~ * No changes were made besides locking to PyTest < 4.1 v2017.11.11 ~~~~~~~~~~~ * Allow passing a string to the register function which will be the helper name v2016.7.10 ~~~~~~~~~~ * Allow a registered function to contibue to behave as a regular function. `#4`_. v2016.4.15 ~~~~~~~~~~ * Hide the ``FuncWrapper`` traceback in pytest failures. `#3`_. Thanks Logan Glickfield(`@lsglick`_) v2016.4.5 ~~~~~~~~~ * Use a wrapper class instead of adding an attribute to a function. v2016.4.3 ~~~~~~~~~ * Provide proper errors when helper functions or namespaces are being overridden. `#1`_ v2016.3.2 ~~~~~~~~~~ * First working release ---- This `Pytest`_ plugin was generated with `Cookiecutter`_ along with `@hackebrot`_'s `Cookiecutter-pytest-plugin`_ template. .. _`Cookiecutter`: https://github.com/audreyr/cookiecutter .. _`@hackebrot`: https://github.com/hackebrot .. _`Apache Software License 2.0`: http://www.apache.org/licenses/LICENSE-2.0 .. _`cookiecutter-pytest-plugin`: https://github.com/pytest-dev/cookiecutter-pytest-plugin .. _`file an issue`: https://github.com/saltstack/pytest-helpers-namespace/issues .. _`pytest`: https://github.com/pytest-dev/pytest .. _`nox`: https://nox.thea.codes/en/stable/ .. _`pip`: https://pypi.python.org/pypi/pip/ .. _`PyPI`: https://pypi.python.org/pypi .. _`#1`: https://github.com/saltstack/pytest-helpers-namespace/issues/1 .. _`#3`: https://github.com/saltstack/pytest-helpers-namespace/pull/3 .. _`#4`: https://github.com/saltstack/pytest-helpers-namespace/issues/4 .. _`@lsglick`: https://github.com/lsglick Platform: unix Platform: linux Platform: osx Platform: cygwin Platform: win32 Classifier: Programming Language :: Python Classifier: Programming Language :: Cython Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License Requires-Python: >=3.5 Provides-Extra: docs Provides-Extra: lint Provides-Extra: tests pytest-helpers-namespace-2021.4.29/README.rst0000644000175000017500000001263514042473003021250 0ustar vampasvampas00000000000000.. image:: https://github.com/saltstack/pytest-helpers-namespace/actions/workflows/testing.yml/badge.svg :target: https://github.com/saltstack/pytest-helpers-namespace/actions/workflows/testing.yml :alt: See Build Status .. image:: https://codecov.io/github/saltstack/pytest-helpers-namespace/coverage.svg?branch=master :target: https://codecov.io/github/saltstack/pytest-helpers-namespace?branch=master :alt: Code Coverage .. image:: https://img.shields.io/pypi/v/pytest-helpers-namespace.svg?style=flat :alt: PyPI Package latest release :target: https://pypi.python.org/pypi/pytest-helpers-namespace .. image:: https://img.shields.io/pypi/dm/pytest-helpers-namespace.svg?style=flat :alt: PyPI Package monthly downloads :target: https://pypi.python.org/pypi/pytest-helpers-namespace .. image:: https://img.shields.io/pypi/wheel/pytest-helpers-namespace.svg?style=flat :alt: PyPI Wheel :target: https://pypi.python.org/pypi/pytest-helpers-namespace .. image:: https://img.shields.io/pypi/pyversions/pytest-helpers-namespace.svg?style=flat :alt: Supported versions :target: https://pypi.python.org/pypi/pytest-helpers-namespace .. image:: https://img.shields.io/pypi/implementation/pytest-helpers-namespace.svg?style=flat :alt: Supported implementations :target: https://pypi.python.org/pypi/pytest-helpers-namespace Pytest Helpers Namespace ======================== This plugin does not provide any helpers to `pytest`_, it does, however, provide a helpers namespace in `pytest`_ which enables you to register helper functions in your ``conftest.py`` to be used within your tests without having to import them. Features -------- * Provides a ``helpers`` `pytest`_ namespace which can be used to register helper functions without requiring you to import them on your actual tests to use them. Requirements ------------ * None! Installation ------------ You can install "pytest-helpers-namespace" via `pip`_ from `PyPI`_:: $ pip install pytest-helpers-namespace Usage ----- Consider the following ``conftest.py`` file: .. code-block:: python import pytest @pytest.helpers.register def foo(bar): ''' this dumb helper function will just return what you pass to it ''' return bar And now consider the following test case: .. code-block:: python def test_helper_namespace(): assert pytest.helpers.foo(True) is True Pretty simple right?! You can even nest namespaces. Consider the following ``conftest.py`` file: .. code-block:: python pytest_plugins = ['helpers_namespace'] import pytest @pytest.helpers.can.haz.register def foo(bar): ''' this dumb helper function will just return what you pass to it ''' return bar And now consider the following test case: .. code-block:: python def test_helper_namespace(): assert pytest.helpers.can.haz.foo(True) is True You can even pass a name to the register function and that will be the helper function name. Contributing ------------ Contributions are very welcome. Tests can be run with `nox`_, please ensure the coverage at least stays the same before you submit a pull request. License ------- Distributed under the terms of the `Apache Software License 2.0`_ license, "pytest-helpers-namespace" is free and open source software. Issues ------ If you encounter any problems, please `file an issue`_ along with a detailed description. Changelog --------- v2021.3.24 ~~~~~~~~~~ * Switched project to a ``src`` layout. * Switched project to a declarative setuptools approach * Added support to check if a helper has been registered * Pytest >= 6.1.1 is now required v2019.1.8 ~~~~~~~~~ * Patch PyTest before any ``conftest.py`` file is processed. v2019.1.7 ~~~~~~~~~ * Support PyTest >= 4.1 v2019.1.6.post1 ~~~~~~~~~~~~~~~ * No changes were made besides locking to PyTest < 4.0 v2019.1.6 ~~~~~~~~~ * No changes were made besides locking to PyTest < 4.1 v2017.11.11 ~~~~~~~~~~~ * Allow passing a string to the register function which will be the helper name v2016.7.10 ~~~~~~~~~~ * Allow a registered function to contibue to behave as a regular function. `#4`_. v2016.4.15 ~~~~~~~~~~ * Hide the ``FuncWrapper`` traceback in pytest failures. `#3`_. Thanks Logan Glickfield(`@lsglick`_) v2016.4.5 ~~~~~~~~~ * Use a wrapper class instead of adding an attribute to a function. v2016.4.3 ~~~~~~~~~ * Provide proper errors when helper functions or namespaces are being overridden. `#1`_ v2016.3.2 ~~~~~~~~~~ * First working release ---- This `Pytest`_ plugin was generated with `Cookiecutter`_ along with `@hackebrot`_'s `Cookiecutter-pytest-plugin`_ template. .. _`Cookiecutter`: https://github.com/audreyr/cookiecutter .. _`@hackebrot`: https://github.com/hackebrot .. _`Apache Software License 2.0`: http://www.apache.org/licenses/LICENSE-2.0 .. _`cookiecutter-pytest-plugin`: https://github.com/pytest-dev/cookiecutter-pytest-plugin .. _`file an issue`: https://github.com/saltstack/pytest-helpers-namespace/issues .. _`pytest`: https://github.com/pytest-dev/pytest .. _`nox`: https://nox.thea.codes/en/stable/ .. _`pip`: https://pypi.python.org/pypi/pip/ .. _`PyPI`: https://pypi.python.org/pypi .. _`#1`: https://github.com/saltstack/pytest-helpers-namespace/issues/1 .. _`#3`: https://github.com/saltstack/pytest-helpers-namespace/pull/3 .. _`#4`: https://github.com/saltstack/pytest-helpers-namespace/issues/4 .. _`@lsglick`: https://github.com/lsglick pytest-helpers-namespace-2021.4.29/appveyor.yml0000644000175000017500000000162713414700503022150 0ustar vampasvampas00000000000000# What Python version is installed where: # http://www.appveyor.com/docs/installed-software#python environment: matrix: - PYTHON: "C:\\Python27" TOX_ENV: "py27" - PYTHON: "C:\\Python35" TOX_ENV: "py35" - PYTHON: "C:\\Python36" TOX_ENV: "py36" - PYTHON: "C:\\Python35" TOX_ENV: "py35" init: - "%PYTHON%/python -V" - "%PYTHON%/python -c \"import struct;print( 8 * struct.calcsize(\'P\'))\"" install: - "%PYTHON%/Scripts/easy_install -U pip" - "%PYTHON%/Scripts/pip install tox" - "%PYTHON%/Scripts/pip install wheel" - "%PYTHON%/Scripts/pip install coverage codecov pytest-cov" build: false # Not a C# project, build stuff at the test step instead. test_script: - "%PYTHON%/Scripts/tox -e %TOX_ENV%" after_test: - "%PYTHON%/python setup.py bdist_wheel" - ps: "ls dist" artifacts: - path: dist\* on_success: - "%PYTHON%/Scripts/coverage report" pytest-helpers-namespace-2021.4.29/docs/0000755000175000017500000000000014042473100020500 5ustar vampasvampas00000000000000pytest-helpers-namespace-2021.4.29/docs/Makefile0000644000175000017500000001652112677457576022204 0ustar vampasvampas00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " applehelp to make an Apple Help Book" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " xml to make Docutils-native XML files" @echo " pseudoxml to make pseudoxml-XML files for display purposes" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" @echo " coverage to run coverage check of the documentation (if enabled)" clean: rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pytest-cookiecutterplugin_name.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pytest-cookiecutterplugin_name.qhc" applehelp: $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp @echo @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." @echo "N.B. You won't be able to view it unless you put it in" \ "~/Library/Documentation/Help or install it in your application" \ "bundle." devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/pytest-cookiecutterplugin_name" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pytest-cookiecutterplugin_name" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." latexpdfja: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through platex and dvipdfmx..." $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." coverage: $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage @echo "Testing of coverage in the sources finished, look at the " \ "results in $(BUILDDIR)/coverage/python.txt." xml: $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml @echo @echo "Build finished. The XML files are in $(BUILDDIR)/xml." pseudoxml: $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml @echo @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." pytest-helpers-namespace-2021.4.29/docs/_static/0000755000175000017500000000000014042473100022126 5ustar vampasvampas00000000000000pytest-helpers-namespace-2021.4.29/docs/_static/.gitkeep0000644000175000017500000000000014026650364023560 0ustar vampasvampas00000000000000pytest-helpers-namespace-2021.4.29/docs/conf.py0000644000175000017500000001401514026650364022013 0ustar vampasvampas00000000000000# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # import datetime import os import pathlib import sys import sphinx_material_saltstack docs_basepath = pathlib.Path(__file__).resolve() additional_paths = (docs_basepath / "_ext", docs_basepath.parent.parent / "src") for path in additional_paths: sys.path.insert(0, str(path)) import pytest_helpers_namespace # -- Project information ----------------------------------------------------- this_year = datetime.datetime.today().year if this_year == 2020: copyright_year = 2020 else: copyright_year = f"2020 - {this_year}" project = "PyTest Helpers Namespace" copyright = f"{copyright_year}, SaltStack, Inc." author = "SaltStack, Inc." # The full version, including alpha/beta/rc tags release = pytest_helpers_namespace.__version__ # Variables to pass into the docs from sitevars.rst for rst substitution with open("sitevars.rst") as site_vars_file: site_vars = site_vars_file.read().splitlines() rst_prolog = """ {} """.format( "\n".join(site_vars[:]) ) # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ "sphinx_material_saltstack", "sphinx.ext.autodoc", "sphinx.ext.autosummary", "sphinx.ext.napoleon", "sphinx.ext.intersphinx", "sphinx.ext.viewcode", "sphinx.ext.todo", "sphinx.ext.coverage", "sphinxcontrib.spelling", ] # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = [ "_build", "Thumbs.db", ".DS_Store", ".vscode", ".venv", ".git", ".gitlab-ci", ".gitignore", "sitevars.rst", ] autosummary_generate = True # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = "sphinx_material_saltstack" html_theme_path = sphinx_material_saltstack.html_theme_path() html_context = sphinx_material_saltstack.get_html_context() html_sidebars = {"**": ["logo-text.html", "globaltoc.html", "localtoc.html", "searchbox.html"]} html_theme_options = { # Set the name of the project to appear in the navigation. "nav_title": "PyTest Helpers Namespace", # Set you GA account ID to enable tracking # "google_analytics_account": "", # Set the repo location to get a badge with stats (only if public repo) "repo_url": "https://github.com/saltstack/pytest-helpers-namespace", "repo_name": "pytest-helpers-namespace", "repo_type": "github", # Visible levels of the global TOC; -1 means unlimited "globaltoc_depth": 1, # If False, expand all TOC entries "globaltoc_collapse": False, # If True, show hidden TOC entries "globaltoc_includehidden": True, # hide tabs? "master_doc": False, # Minify for smaller HTML/CSS assets "html_minify": True, "css_minify": True, } # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] # The name of an image file (relative to this directory) to place at the top # of the sidebar. html_logo = os.path.join( html_theme_path[0], "sphinx_material_saltstack", "static", "images", "saltstack-logo.png", ) # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. Favicons can be up to at least 228x228. PNG # format is supported as well, not just .ico' html_favicon = os.path.join( html_theme_path[0], "sphinx_material_saltstack", "static", "images", "favicon.png", ) # Sphinx Napoleon Config napoleon_google_docstring = True napoleon_numpy_docstring = False napoleon_include_init_with_doc = True napoleon_include_private_with_doc = False napoleon_include_special_with_doc = True napoleon_use_admonition_for_examples = False napoleon_use_admonition_for_notes = False napoleon_use_admonition_for_references = False napoleon_use_ivar = False napoleon_use_param = True napoleon_use_rtype = True # ----- Intersphinx Config ----------------------------------------------------------------------------------------> intersphinx_mapping = { "python": ("https://docs.python.org/3", None), "pytest": ("https://pytest.readthedocs.io/en/stable", None), } # <---- Intersphinx Config ----------------------------------------------------------------------------------------- # ----- Autodoc Config ----------------------------------------------------------------------------------------------> autodoc_default_options = {"member-order": "bysource"} autodoc_mock_imports = [] # <---- Autodoc Config ----------------------------------------------------------------------------------------------- def setup(app): app.add_crossref_type( directivename="fixture", rolename="fixture", indextemplate="pair: %s; fixture", ) # Allow linking to pytest confvals. app.add_object_type( "confval", "pytest-confval", objname="configuration value", indextemplate="pair: %s; configuration value", ) pytest-helpers-namespace-2021.4.29/docs/index.rst0000644000175000017500000000040114026653143022345 0ustar vampasvampas00000000000000Pytest Helpers Namespace ======================== .. include:: ../README.rst :start-after: ======================== Contents: .. toctree:: :maxdepth: 2 Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` pytest-helpers-namespace-2021.4.29/docs/make.bat0000644000175000017500000001556512677457576022160 0ustar vampasvampas00000000000000@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . set I18NSPHINXOPTS=%SPHINXOPTS% . if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. texinfo to make Texinfo files echo. gettext to make PO message catalogs echo. changes to make an overview over all changed/added/deprecated items echo. xml to make Docutils-native XML files echo. pseudoxml to make pseudoxml-XML files for display purposes echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled echo. coverage to run coverage check of the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) REM Check if sphinx-build is available and fallback to Python version if any %SPHINXBUILD% 2> nul if errorlevel 9009 goto sphinx_python goto sphinx_ok :sphinx_python set SPHINXBUILD=python -m sphinx.__init__ %SPHINXBUILD% 2> nul if errorlevel 9009 ( echo. echo.The 'sphinx-build' command was not found. Make sure you have Sphinx echo.installed, then set the SPHINXBUILD environment variable to point echo.to the full path of the 'sphinx-build' executable. Alternatively you echo.may add the Sphinx directory to PATH. echo. echo.If you don't have Sphinx installed, grab it from echo.http://sphinx-doc.org/ exit /b 1 ) :sphinx_ok if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\pytest-cookiecutterplugin_name.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\pytest-cookiecutterplugin_name.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp if errorlevel 1 exit /b 1 echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub if errorlevel 1 exit /b 1 echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex if errorlevel 1 exit /b 1 echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "latexpdf" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf cd %~dp0 echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end ) if "%1" == "latexpdfja" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf-ja cd %~dp0 echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text if errorlevel 1 exit /b 1 echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man if errorlevel 1 exit /b 1 echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "texinfo" ( %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo if errorlevel 1 exit /b 1 echo. echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. goto end ) if "%1" == "gettext" ( %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale if errorlevel 1 exit /b 1 echo. echo.Build finished. The message catalogs are in %BUILDDIR%/locale. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes if errorlevel 1 exit /b 1 echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest if errorlevel 1 exit /b 1 echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) if "%1" == "coverage" ( %SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage if errorlevel 1 exit /b 1 echo. echo.Testing of coverage in the sources finished, look at the ^ results in %BUILDDIR%/coverage/python.txt. goto end ) if "%1" == "xml" ( %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml if errorlevel 1 exit /b 1 echo. echo.Build finished. The XML files are in %BUILDDIR%/xml. goto end ) if "%1" == "pseudoxml" ( %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml if errorlevel 1 exit /b 1 echo. echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. goto end ) :end pytest-helpers-namespace-2021.4.29/docs/sitevars.rst0000644000175000017500000000000014026650364023073 0ustar vampasvampas00000000000000pytest-helpers-namespace-2021.4.29/noxfile.py0000644000175000017500000002551714042473003021602 0ustar vampasvampas00000000000000import datetime import json import os import pathlib import shutil import sys import tempfile import nox from nox.command import CommandFailed COVERAGE_VERSION_REQUIREMENT = "coverage==5.5" IS_WINDOWS = sys.platform.lower().startswith("win") IS_DARWIN = sys.platform.lower().startswith("darwin") if IS_WINDOWS: COVERAGE_FAIL_UNDER_PERCENT = 70 elif IS_DARWIN: COVERAGE_FAIL_UNDER_PERCENT = 75 else: COVERAGE_FAIL_UNDER_PERCENT = 80 # Be verbose when running under a CI context PIP_INSTALL_SILENT = ( os.environ.get("JENKINS_URL") or os.environ.get("CI") or os.environ.get("DRONE") or os.environ.get("GITHUB_ACTIONS") ) is None CI_RUN = PIP_INSTALL_SILENT is False SKIP_REQUIREMENTS_INSTALL = "SKIP_REQUIREMENTS_INSTALL" in os.environ EXTRA_REQUIREMENTS_INSTALL = os.environ.get("EXTRA_REQUIREMENTS_INSTALL") # Paths REPO_ROOT = pathlib.Path(__file__).resolve().parent # Change current directory to REPO_ROOT os.chdir(str(REPO_ROOT)) SITECUSTOMIZE_DIR = str(REPO_ROOT / "tests" / "support" / "coverage") ARTIFACTS_DIR = REPO_ROOT / "artifacts" # Make sure the artifacts directory exists ARTIFACTS_DIR.mkdir(parents=True, exist_ok=True) RUNTESTS_LOGFILE = ARTIFACTS_DIR.relative_to(REPO_ROOT) / "runtests-{}.log".format( datetime.datetime.now().strftime("%Y%m%d%H%M%S.%f") ) COVERAGE_REPORT_DB = REPO_ROOT / ".coverage" COVERAGE_REPORT_PROJECT = ARTIFACTS_DIR.relative_to(REPO_ROOT) / "coverage-project.xml" COVERAGE_REPORT_TESTS = ARTIFACTS_DIR.relative_to(REPO_ROOT) / "coverage-tests.xml" JUNIT_REPORT = ARTIFACTS_DIR.relative_to(REPO_ROOT) / "junit-report.xml" # Nox options # Reuse existing virtualenvs nox.options.reuse_existing_virtualenvs = True # Don't fail on missing interpreters nox.options.error_on_missing_interpreters = False def session_run_always(session, *command, **kwargs): try: # Guess we weren't the only ones wanting this # https://github.com/theacodes/nox/pull/331 return session.run_always(*command, **kwargs) except AttributeError: old_install_only_value = session._runner.global_config.install_only try: # Force install only to be false for the following chunk of code # For additional information as to why see: # https://github.com/theacodes/nox/pull/181 session._runner.global_config.install_only = False return session.run(*command, **kwargs) finally: session._runner.global_config.install_only = old_install_only_value @nox.session(python=("3", "3.5", "3.6", "3.7", "3.8", "3.9")) def tests(session): """ Run tests """ env = {} if SKIP_REQUIREMENTS_INSTALL is False: # Always have the wheel package installed session.install("wheel", silent=PIP_INSTALL_SILENT) session.install(COVERAGE_VERSION_REQUIREMENT, silent=PIP_INSTALL_SILENT) pytest_version_requirement = os.environ.get("PYTEST_VERSION_REQUIREMENT") or None if pytest_version_requirement: if not pytest_version_requirement.startswith("pytest"): pytest_version_requirement = "pytest{}".format(pytest_version_requirement) session.install(pytest_version_requirement, silent=PIP_INSTALL_SILENT) session.install("-e", ".", silent=PIP_INSTALL_SILENT) session.install("-r", os.path.join("requirements", "tests.txt"), silent=PIP_INSTALL_SILENT) if EXTRA_REQUIREMENTS_INSTALL: session.log( "Installing the following extra requirements because the EXTRA_REQUIREMENTS_INSTALL " "environment variable was set: EXTRA_REQUIREMENTS_INSTALL='%s'", EXTRA_REQUIREMENTS_INSTALL, ) install_command = ["--progress-bar=off"] install_command += [req.strip() for req in EXTRA_REQUIREMENTS_INSTALL.split()] session.install(*install_command, silent=PIP_INSTALL_SILENT) session.run("coverage", "erase") python_path_env_var = os.environ.get("PYTHONPATH") or None if python_path_env_var is None: python_path_env_var = SITECUSTOMIZE_DIR else: python_path_entries = python_path_env_var.split(os.pathsep) if SITECUSTOMIZE_DIR in python_path_entries: python_path_entries.remove(SITECUSTOMIZE_DIR) python_path_entries.insert(0, SITECUSTOMIZE_DIR) python_path_env_var = os.pathsep.join(python_path_entries) env = { # The updated python path so that sitecustomize is importable "PYTHONPATH": python_path_env_var, # The full path to the .coverage data file. Makes sure we always write # them to the same directory "COVERAGE_FILE": str(COVERAGE_REPORT_DB), # Instruct sub processes to also run under coverage "COVERAGE_PROCESS_START": str(REPO_ROOT / ".coveragerc"), } args = [ "--rootdir", str(REPO_ROOT), "--log-file={}".format(RUNTESTS_LOGFILE), "--log-file-level=debug", "--show-capture=no", "--junitxml={}".format(JUNIT_REPORT), "--showlocals", "-ra", "-s", ] if session._runner.global_config.forcecolor: args.append("--color=yes") if not session.posargs: args.append("tests/") else: for arg in session.posargs: if arg.startswith("--color") and session._runner.global_config.forcecolor: args.remove("--color=yes") args.append(arg) session.run("coverage", "run", "-m", "pytest", *args, env=env) # Always combine and generate the XML coverage report try: session.run("coverage", "combine") except CommandFailed: # Sometimes some of the coverage files are corrupt which would # trigger a CommandFailed exception pass # Generate report for project code coverage session.run( "coverage", "xml", "-o", str(COVERAGE_REPORT_PROJECT), "--omit=tests/*", "--include=src/pytest_helpers_namespace/*", ) # Generate report for tests code coverage session.run( "coverage", "xml", "-o", str(COVERAGE_REPORT_TESTS), "--omit=src/pytest_helpers_namespace/*", "--include=tests/*", ) try: cmdline = [ "coverage", "report", "--show-missing", "--include=src/pytest_helpers_namespace/*,tests/*", "--fail-under={}".format(COVERAGE_FAIL_UNDER_PERCENT), ] session.run(*cmdline) finally: if COVERAGE_REPORT_DB.exists(): shutil.copyfile(str(COVERAGE_REPORT_DB), str(ARTIFACTS_DIR / ".coverage")) def _lint(session, rcfile, flags, paths): session.install( "--progress-bar=off", "-r", os.path.join("requirements", "lint.txt"), silent=PIP_INSTALL_SILENT, ) session.run("pylint", "--version") pylint_report_path = os.environ.get("PYLINT_REPORT") cmd_args = ["pylint", "--rcfile={}".format(rcfile)] + list(flags) + list(paths) stdout = tempfile.TemporaryFile(mode="w+b") try: session.run(*cmd_args, stdout=stdout) finally: stdout.seek(0) contents = stdout.read() if contents: contents = contents.decode("utf-8") sys.stdout.write(contents) sys.stdout.flush() if pylint_report_path: # Write report with open(pylint_report_path, "w") as wfh: wfh.write(contents) session.log("Report file written to %r", pylint_report_path) stdout.close() @nox.session(python="3") def lint(session): """ Run PyLint against Salt and it's test suite. Set PYLINT_REPORT to a path to capture output. """ session.notify("lint-code-{}".format(session.python)) session.notify("lint-tests-{}".format(session.python)) @nox.session(python="3", name="lint-code") def lint_code(session): """ Run PyLint against the code. Set PYLINT_REPORT to a path to capture output. """ flags = ["--disable=I"] if session.posargs: paths = session.posargs else: paths = ["setup.py", "noxfile.py", "src/pytest_helpers_namespace/"] _lint(session, ".pylintrc", flags, paths) @nox.session(python="3", name="lint-tests") def lint_tests(session): """ Run PyLint against Salt and it's test suite. Set PYLINT_REPORT to a path to capture output. """ flags = ["--disable=I"] if session.posargs: paths = session.posargs else: paths = ["tests/"] _lint(session, ".pylintrc", flags, paths) @nox.session(python="3") def docs(session): """ Build Docs """ session.install( "--progress-bar=off", "-r", os.path.join("requirements", "docs.txt"), silent=PIP_INSTALL_SILENT, ) os.chdir("docs/") session.run("make", "clean", external=True) session.run("make", "linkcheck", "SPHINXOPTS=-W", external=True) session.run("make", "coverage", "SPHINXOPTS=-W", external=True) docs_coverage_file = os.path.join("_build", "html", "python.txt") if os.path.exists(docs_coverage_file): with open(docs_coverage_file) as rfh: contents = rfh.readlines()[2:] if contents: session.error("\n" + "".join(contents)) session.run("make", "html", "SPHINXOPTS=-W", external=True) os.chdir("..") @nox.session(name="docs-crosslink-info", python="3") def docs_crosslink_info(session): """ Report intersphinx cross links information """ session.install( "--progress-bar=off", "-r", os.path.join("requirements", "docs.txt"), silent=PIP_INSTALL_SILENT, ) os.chdir("docs/") intersphinx_mapping = json.loads( session.run( "python", "-c", "import json; import conf; print(json.dumps(conf.intersphinx_mapping))", silent=True, log=False, ) ) try: mapping_entry = intersphinx_mapping[session.posargs[0]] except IndexError: session.error( "You need to pass at least one argument whose value must be one of: {}".format( ", ".join(list(intersphinx_mapping)) ) ) except KeyError: session.error( "Only acceptable values for first argument are: {}".format( ", ".join(list(intersphinx_mapping)) ) ) session.run( "python", "-m", "sphinx.ext.intersphinx", mapping_entry[0].rstrip("/") + "/objects.inv" ) os.chdir("..") @nox.session(name="gen-api-docs", python="3") def gen_api_docs(session): """ Generate API Docs """ session.install( "--progress-bar=off", "-r", os.path.join("requirements", "docs.txt"), silent=PIP_INSTALL_SILENT, ) shutil.rmtree("docs/ref") session.run( "sphinx-apidoc", "--module-first", "-o", "docs/ref/", "src/pytest_helpers_namespace/" ) pytest-helpers-namespace-2021.4.29/pyproject.toml0000644000175000017500000000044414026605365022502 0ustar vampasvampas00000000000000[build-system] requires = ["setuptools>=50.3.2", "wheel", "setuptools-declarative-requirements", "setuptools_scm[toml]>=3.4"] build-backend = "setuptools.build_meta" [tool.setuptools_scm] write_to = "src/pytest_helpers_namespace/version.py" write_to_template = "__version__ = \"{version}\"" pytest-helpers-namespace-2021.4.29/requirements/0000755000175000017500000000000014042473100022273 5ustar vampasvampas00000000000000pytest-helpers-namespace-2021.4.29/requirements/base.txt0000644000175000017500000000001614042473003023745 0ustar vampasvampas00000000000000pytest>=6.0.0 pytest-helpers-namespace-2021.4.29/requirements/docs.txt0000644000175000017500000000013713740246256024003 0ustar vampasvampas00000000000000-r base.txt -r tests.txt sphinx sphinx-material-saltstack sphinx-prompt sphinxcontrib-spelling pytest-helpers-namespace-2021.4.29/requirements/lint.txt0000644000175000017500000000022514026353011024001 0ustar vampasvampas00000000000000-r base.txt -r tests.txt pylint==2.4.4 saltpylint==2019.6.7 pyenchant black; python_version >= '3.7' reorder-python-imports; python_version >= '3.7' pytest-helpers-namespace-2021.4.29/requirements/tests.txt0000644000175000017500000000001414026601426024177 0ustar vampasvampas00000000000000-r base.txt pytest-helpers-namespace-2021.4.29/setup.cfg0000644000175000017500000000313714042473100021375 0ustar vampasvampas00000000000000[metadata] name = pytest-helpers-namespace description = Pytest Helpers Namespace Plugin long_description = file: README.rst author = Pedro Algarvio author_email = pedro@algarvio.me url = https://github.com/saltstack/pytest-helpers-namespace project_urls = Source=https://github.com/saltstack/pytest-helpers-namespace Tracker=https://github.com/saltstack/pytest-helpers-namespace/issues Documentation=https://pytest-helpers-namespace.readthedocs.io license = Apache Software License 2.0 classifiers = Programming Language :: Python Programming Language :: Cython Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Development Status :: 5 - Production/Stable Intended Audience :: Developers License :: OSI Approved :: Apache Software License platforms = unix, linux, osx, cygwin, win32 [options] zip_safe = False include_package_data = True package_dir = =src packages = find: python_requires = >= 3.5 setup_requires = setuptools>=50.3.2 setuptools_scm[toml]>=3.4 setuptools-declarative-requirements [options.packages.find] where = src exclude = tests [requirements-files] install_requires = requirements/base.txt extras_require = docs = requirements/docs.txt lint = requirements/lint.txt tests = requirements/tests.txt [options.entry_points] pytest11 = helpers_namespace = pytest_helpers_namespace.plugin [bdist_wheel] universal = false [egg_info] tag_build = tag_date = 0 pytest-helpers-namespace-2021.4.29/setup.py0000644000175000017500000000015714026601140021264 0ustar vampasvampas00000000000000#!/usr/bin/env python import setuptools if __name__ == "__main__": setuptools.setup(use_scm_version=True) pytest-helpers-namespace-2021.4.29/src/0000755000175000017500000000000014042473100020337 5ustar vampasvampas00000000000000pytest-helpers-namespace-2021.4.29/src/pytest_helpers_namespace/0000755000175000017500000000000014042473100025425 5ustar vampasvampas00000000000000pytest-helpers-namespace-2021.4.29/src/pytest_helpers_namespace/__init__.py0000644000175000017500000000153714026604470027554 0ustar vampasvampas00000000000000# pylint: disable=missing-module-docstring import pathlib PACKAGE_ROOT = pathlib.Path(__file__).resolve().parent try: from .version import __version__ except ImportError: # pragma: no cover __version__ = "0.0.0.not-installed" try: from importlib.metadata import version, PackageNotFoundError try: __version__ = version(__name__) except PackageNotFoundError: # package is not installed pass except ImportError: try: from pkg_resources import get_distribution, DistributionNotFound try: __version__ = get_distribution(__name__).version except DistributionNotFound: # package is not installed pass except ImportError: # pkg resources isn't even available?! pass pytest-helpers-namespace-2021.4.29/src/pytest_helpers_namespace/plugin.py0000644000175000017500000000627414042473003027310 0ustar vampasvampas00000000000000""" pytest_helpers_namespace.plugin ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pytest Helpers Namespace Plugin """ from functools import partial from functools import wraps import pytest try: # pragma: no cover import importlib.metadata PYTEST_61 = importlib.metadata.version("pytest") >= "6.1.0" except ImportError: # pragma: no cover try: import importlib_metadata PYTEST_61 = importlib_metadata.version("pytest") >= "6.1.0" except ImportError: # pragma: no cover import pkg_resources PYTEST_61 = pkg_resources.get_distribution("pytest").version >= "6.1.0" class FuncWrapper: def __init__(self, func): self.func = func @staticmethod def register(func): """ This function will just raise a RuntimeError in case a function registration, which also sets a nested namespace, tries to override a known helper function with that nested namespace. This will just make the raised error make more sense. Instead of "AttributeError: 'function' object has no attribute 'register'", we will raise the exception below. """ raise RuntimeError( "A namespace is already registered under the name: {}".format(func.__name__) ) def __call__(self, *args, **kwargs): """ This wrapper will just call the actual helper function """ __tracebackhide__ = True return self.func(*args, **kwargs) class HelpersRegistry: """ Helper functions registrar which supports namespaces """ __slots__ = ("_registry",) def __init__(self): self._registry = {} def register(self, func, name=None): """ Register's a new function as a helper """ if isinstance(func, str): return partial(self.register, name=func) if name is None: name = func.__name__ if name in self._registry: raise RuntimeError( "A helper function is already registered under the name: {}".format(name) ) self._registry[name] = wraps(func)(FuncWrapper(func)) return func def __getattribute__(self, name): if name in ("__class__", "_registry", "register"): return object.__getattribute__(self, name) return self._registry.setdefault(name, self.__class__()) def __repr__(self): return "{} {!r}>".format(self.__class__.__name__, self._registry) def __call__(self, *_, **__): raise RuntimeError("The helper being called was not registred") def __contains__(self, key): return key in self._registry if PYTEST_61 is False: # pragma: no cover def __fspath__(self): # Compatibility with PyTest 6.0.x return __file__ def pytest_load_initial_conftests(*_): try: pytest.helpers # pragma: no cover except AttributeError: pytest.helpers = HelpersRegistry() @pytest.hookimpl(trylast=True) def pytest_sessionstart(session): session.config.pluginmanager.register(pytest.helpers, "helpers-namespace") def pytest_unconfigure(): # pragma: no cover try: delattr(pytest, "helpers") except AttributeError: pass pytest-helpers-namespace-2021.4.29/src/pytest_helpers_namespace/version.py0000644000175000017500000000003114042473100027456 0ustar vampasvampas00000000000000__version__ = "2021.4.29"pytest-helpers-namespace-2021.4.29/src/pytest_helpers_namespace.egg-info/0000755000175000017500000000000014042473100027117 5ustar vampasvampas00000000000000pytest-helpers-namespace-2021.4.29/src/pytest_helpers_namespace.egg-info/PKG-INFO0000644000175000017500000002053314042473100030217 0ustar vampasvampas00000000000000Metadata-Version: 2.1 Name: pytest-helpers-namespace Version: 2021.4.29 Summary: Pytest Helpers Namespace Plugin Home-page: https://github.com/saltstack/pytest-helpers-namespace Author: Pedro Algarvio Author-email: pedro@algarvio.me License: Apache Software License 2.0 Project-URL: Source, https://github.com/saltstack/pytest-helpers-namespace Project-URL: Tracker, https://github.com/saltstack/pytest-helpers-namespace/issues Project-URL: Documentation, https://pytest-helpers-namespace.readthedocs.io Description: .. image:: https://github.com/saltstack/pytest-helpers-namespace/actions/workflows/testing.yml/badge.svg :target: https://github.com/saltstack/pytest-helpers-namespace/actions/workflows/testing.yml :alt: See Build Status .. image:: https://codecov.io/github/saltstack/pytest-helpers-namespace/coverage.svg?branch=master :target: https://codecov.io/github/saltstack/pytest-helpers-namespace?branch=master :alt: Code Coverage .. image:: https://img.shields.io/pypi/v/pytest-helpers-namespace.svg?style=flat :alt: PyPI Package latest release :target: https://pypi.python.org/pypi/pytest-helpers-namespace .. image:: https://img.shields.io/pypi/dm/pytest-helpers-namespace.svg?style=flat :alt: PyPI Package monthly downloads :target: https://pypi.python.org/pypi/pytest-helpers-namespace .. image:: https://img.shields.io/pypi/wheel/pytest-helpers-namespace.svg?style=flat :alt: PyPI Wheel :target: https://pypi.python.org/pypi/pytest-helpers-namespace .. image:: https://img.shields.io/pypi/pyversions/pytest-helpers-namespace.svg?style=flat :alt: Supported versions :target: https://pypi.python.org/pypi/pytest-helpers-namespace .. image:: https://img.shields.io/pypi/implementation/pytest-helpers-namespace.svg?style=flat :alt: Supported implementations :target: https://pypi.python.org/pypi/pytest-helpers-namespace Pytest Helpers Namespace ======================== This plugin does not provide any helpers to `pytest`_, it does, however, provide a helpers namespace in `pytest`_ which enables you to register helper functions in your ``conftest.py`` to be used within your tests without having to import them. Features -------- * Provides a ``helpers`` `pytest`_ namespace which can be used to register helper functions without requiring you to import them on your actual tests to use them. Requirements ------------ * None! Installation ------------ You can install "pytest-helpers-namespace" via `pip`_ from `PyPI`_:: $ pip install pytest-helpers-namespace Usage ----- Consider the following ``conftest.py`` file: .. code-block:: python import pytest @pytest.helpers.register def foo(bar): ''' this dumb helper function will just return what you pass to it ''' return bar And now consider the following test case: .. code-block:: python def test_helper_namespace(): assert pytest.helpers.foo(True) is True Pretty simple right?! You can even nest namespaces. Consider the following ``conftest.py`` file: .. code-block:: python pytest_plugins = ['helpers_namespace'] import pytest @pytest.helpers.can.haz.register def foo(bar): ''' this dumb helper function will just return what you pass to it ''' return bar And now consider the following test case: .. code-block:: python def test_helper_namespace(): assert pytest.helpers.can.haz.foo(True) is True You can even pass a name to the register function and that will be the helper function name. Contributing ------------ Contributions are very welcome. Tests can be run with `nox`_, please ensure the coverage at least stays the same before you submit a pull request. License ------- Distributed under the terms of the `Apache Software License 2.0`_ license, "pytest-helpers-namespace" is free and open source software. Issues ------ If you encounter any problems, please `file an issue`_ along with a detailed description. Changelog --------- v2021.3.24 ~~~~~~~~~~ * Switched project to a ``src`` layout. * Switched project to a declarative setuptools approach * Added support to check if a helper has been registered * Pytest >= 6.1.1 is now required v2019.1.8 ~~~~~~~~~ * Patch PyTest before any ``conftest.py`` file is processed. v2019.1.7 ~~~~~~~~~ * Support PyTest >= 4.1 v2019.1.6.post1 ~~~~~~~~~~~~~~~ * No changes were made besides locking to PyTest < 4.0 v2019.1.6 ~~~~~~~~~ * No changes were made besides locking to PyTest < 4.1 v2017.11.11 ~~~~~~~~~~~ * Allow passing a string to the register function which will be the helper name v2016.7.10 ~~~~~~~~~~ * Allow a registered function to contibue to behave as a regular function. `#4`_. v2016.4.15 ~~~~~~~~~~ * Hide the ``FuncWrapper`` traceback in pytest failures. `#3`_. Thanks Logan Glickfield(`@lsglick`_) v2016.4.5 ~~~~~~~~~ * Use a wrapper class instead of adding an attribute to a function. v2016.4.3 ~~~~~~~~~ * Provide proper errors when helper functions or namespaces are being overridden. `#1`_ v2016.3.2 ~~~~~~~~~~ * First working release ---- This `Pytest`_ plugin was generated with `Cookiecutter`_ along with `@hackebrot`_'s `Cookiecutter-pytest-plugin`_ template. .. _`Cookiecutter`: https://github.com/audreyr/cookiecutter .. _`@hackebrot`: https://github.com/hackebrot .. _`Apache Software License 2.0`: http://www.apache.org/licenses/LICENSE-2.0 .. _`cookiecutter-pytest-plugin`: https://github.com/pytest-dev/cookiecutter-pytest-plugin .. _`file an issue`: https://github.com/saltstack/pytest-helpers-namespace/issues .. _`pytest`: https://github.com/pytest-dev/pytest .. _`nox`: https://nox.thea.codes/en/stable/ .. _`pip`: https://pypi.python.org/pypi/pip/ .. _`PyPI`: https://pypi.python.org/pypi .. _`#1`: https://github.com/saltstack/pytest-helpers-namespace/issues/1 .. _`#3`: https://github.com/saltstack/pytest-helpers-namespace/pull/3 .. _`#4`: https://github.com/saltstack/pytest-helpers-namespace/issues/4 .. _`@lsglick`: https://github.com/lsglick Platform: unix Platform: linux Platform: osx Platform: cygwin Platform: win32 Classifier: Programming Language :: Python Classifier: Programming Language :: Cython Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License Requires-Python: >=3.5 Provides-Extra: docs Provides-Extra: lint Provides-Extra: tests pytest-helpers-namespace-2021.4.29/src/pytest_helpers_namespace.egg-info/SOURCES.txt0000644000175000017500000000170614042473100031007 0ustar vampasvampas00000000000000.coveragerc .gitignore .pre-commit-config.yaml .pylint-spelling-words .pylintrc AUTHORS.rst LICENSE README.rst appveyor.yml noxfile.py pyproject.toml setup.cfg setup.py .github/workflows/testing.yml .pre-commit-hooks/sort-pylint-spelling-words.py docs/Makefile docs/conf.py docs/index.rst docs/make.bat docs/sitevars.rst docs/_static/.gitkeep requirements/base.txt requirements/docs.txt requirements/lint.txt requirements/tests.txt src/pytest_helpers_namespace/__init__.py src/pytest_helpers_namespace/plugin.py src/pytest_helpers_namespace/version.py src/pytest_helpers_namespace.egg-info/PKG-INFO src/pytest_helpers_namespace.egg-info/SOURCES.txt src/pytest_helpers_namespace.egg-info/dependency_links.txt src/pytest_helpers_namespace.egg-info/entry_points.txt src/pytest_helpers_namespace.egg-info/not-zip-safe src/pytest_helpers_namespace.egg-info/requires.txt src/pytest_helpers_namespace.egg-info/top_level.txt tests/conftest.py tests/test_helpers_namespace.pypytest-helpers-namespace-2021.4.29/src/pytest_helpers_namespace.egg-info/dependency_links.txt0000644000175000017500000000000114042473100033165 0ustar vampasvampas00000000000000 pytest-helpers-namespace-2021.4.29/src/pytest_helpers_namespace.egg-info/entry_points.txt0000644000175000017500000000010014042473100032404 0ustar vampasvampas00000000000000[pytest11] helpers_namespace = pytest_helpers_namespace.plugin pytest-helpers-namespace-2021.4.29/src/pytest_helpers_namespace.egg-info/not-zip-safe0000644000175000017500000000000114026613540031353 0ustar vampasvampas00000000000000 pytest-helpers-namespace-2021.4.29/src/pytest_helpers_namespace.egg-info/requires.txt0000644000175000017500000000032714042473100031521 0ustar vampasvampas00000000000000pytest>=6.0.0 [docs] sphinx sphinx-material-saltstack sphinx-prompt sphinxcontrib-spelling [lint] pylint==2.4.4 saltpylint==2019.6.7 pyenchant [lint:python_version >= "3.7"] black reorder-python-imports [tests] pytest-helpers-namespace-2021.4.29/src/pytest_helpers_namespace.egg-info/top_level.txt0000644000175000017500000000003114042473100031643 0ustar vampasvampas00000000000000pytest_helpers_namespace pytest-helpers-namespace-2021.4.29/tests/0000755000175000017500000000000014042473100020712 5ustar vampasvampas00000000000000pytest-helpers-namespace-2021.4.29/tests/conftest.py0000644000175000017500000000005714026647311023124 0ustar vampasvampas00000000000000# pragma: no cover pytest_plugins = "pytester" pytest-helpers-namespace-2021.4.29/tests/test_helpers_namespace.py0000644000175000017500000001461414026646574026032 0ustar vampasvampas00000000000000import pytest @pytest.fixture def reset_helpers_namespace(request): try: yield finally: plugin = request.config.pluginmanager.get_plugin("helpers-namespace") plugin._registry.clear() def test_namespace(testdir): testdir.makeconftest( """ import pytest @pytest.helpers.register def foo(bar): return bar """ ) testdir.makepyfile( """ import pytest def test_helpers(): assert pytest.helpers.foo(True) is True print('PASSED') """ ) result = testdir.runpytest_subprocess("-s") # fnmatch_lines does an assertion internally result.stdout.fnmatch_lines( [ "test_namespace.py PASSED", ] ) # make sure that that we get a '0' exit code for the test suite assert result.ret == 0 def test_nested_namespace(testdir): testdir.makeconftest( """ import pytest @pytest.helpers.foo.bar.register def foo(bar): return bar """ ) testdir.makepyfile( """ import pytest def test_helpers(): assert pytest.helpers.foo.bar.foo(True) is True print('PASSED') """ ) result = testdir.runpytest_subprocess("-s") # fnmatch_lines does an assertion internally result.stdout.fnmatch_lines( [ "test_nested_namespace.py PASSED", ] ) # make sure that that we get a '0' exit code for the test suite assert result.ret == 0 def test_unregistered_namespace(testdir): testdir.makepyfile( """ import pytest def test_helpers(): with pytest.raises(RuntimeError) as exc: assert pytest.helpers.foo(True) is True assert 'The helper being called was not registred' in str(exc) print('PASSED') """ ) result = testdir.runpytest_subprocess("-s") # fnmatch_lines does an assertion internally result.stdout.fnmatch_lines( [ "test_unregistered_namespace.py PASSED", ] ) # make sure that that we get a '0' exit code for the test suite assert result.ret == 0 def test_namespace_override(testdir): testdir.makeconftest( """ import pytest @pytest.helpers.foo.register def bar(bar): return bar @pytest.helpers.register def foo(bar): return bar """ ) testdir.makepyfile( """ import pytest def test_helpers(): with pytest.raises(RuntimeError) as exc: assert pytest.helpers.foo(True) is True assert 'The helper being called was not registred' in str(exc) print('PASSED') """ ) result = testdir.runpytest_subprocess("-s") # fnmatch_lines does an assertion internally result.stderr.fnmatch_lines( ["*RuntimeError: A helper function is already registered under the name: foo"] ) # make sure that that we get a '0' exit code for the test suite assert result.ret != 0 def test_namespace_override_2(testdir): testdir.makeconftest( """ import pytest @pytest.helpers.register def foo(bar): return bar @pytest.helpers.foo.register def bar(bar): return bar """ ) testdir.makepyfile( """ import pytest def test_helpers(): with pytest.raises(RuntimeError) as exc: assert pytest.helpers.foo(True) is True assert 'The helper being called was not registred' in str(exc) print('PASSED') """ ) result = testdir.runpytest_subprocess("-s") # fnmatch_lines does an assertion internally result.stderr.fnmatch_lines( ["*RuntimeError: A namespace is already registered under the name: bar"] ) # make sure that that we get a '0' exit code for the test suite assert result.ret != 0 def test_helper_override(testdir): testdir.makeconftest( """ import pytest @pytest.helpers.register def foo(bar): return bar @pytest.helpers.register def foo(bar): return bar """ ) testdir.makepyfile( """ import pytest def test_helpers(): with pytest.raises(RuntimeError) as exc: assert pytest.helpers.foo(True) is True assert 'The helper being called was not registred' in str(exc) print('PASSED') """ ) result = testdir.runpytest_subprocess("-s") # fnmatch_lines does an assertion internally result.stderr.fnmatch_lines( ["*RuntimeError: A helper function is already registered under the name: foo"] ) # make sure that that we get a '0' exit code for the test suite assert result.ret != 0 def test_helper_as_regular_function(testdir): testdir.makepyfile( """ import pytest @pytest.helpers.register def foo(): return 'bar' def test_helpers(): assert pytest.helpers.foo() == 'bar' assert foo() == 'bar' print('PASSED') """ ) result = testdir.runpytest_subprocess("-s") # fnmatch_lines does an assertion internally result.stdout.fnmatch_lines( [ "test_helper_as_regular_function.py PASSED", ] ) # make sure that that we get a '0' exit code for the test suite assert result.ret == 0 def test_helper_with_custom_name(testdir): testdir.makepyfile( """ import pytest @pytest.helpers.register('jump') def foo(): return 'bar' def test_helpers(): assert pytest.helpers.jump() == 'bar' assert foo() == 'bar' print('PASSED') """ ) result = testdir.runpytest_subprocess("-s") # fnmatch_lines does an assertion internally result.stdout.fnmatch_lines( [ "test_helper_with_custom_name.py PASSED", ] ) # make sure that that we get a '0' exit code for the test suite assert result.ret == 0 @pytest.mark.usefixtures("reset_helpers_namespace") def test_helper_contains_method(): assert "bar" not in pytest.helpers @pytest.helpers.register def bar(): return True assert "bar" in pytest.helpers assert pytest.helpers.bar() is True