pytest-skip-markers-1.3.0/.codecov.yml0000644000000000000000000001002314236250622016430 0ustar00rootrootcodecov: require_ci_to_pass: yes # Less spammy. Only notify on passing builds. notify: wait_for_ci: true # Should Codecov wait for all CI statuses to complete before sending theirs ignore: - ^*.py$ # python files at the repo root, ie, setup.py - docs/.* # ignore any code under doc/ coverage: round: up range: 70..100 precision: 2 status: project: # measuring the overall project coverage default: target: auto # will use the coverage from the base commit (pull request base or parent commit) coverage to compare against. base: auto # will use the pull request base if the commit is on a pull request. If not, the parent commit will be used. flags: - src - tests src: # declare a new status context "src" target: auto # will use the coverage from the base commit (pull request base or parent commit) coverage to compare against. base: auto # will use the pull request base if the commit is on a pull request. If not, the parent commit will be used. if_no_uploads: error # will post commit status of "error" if no coverage reports were uploaded # options: success, error, failure if_not_found: success # if parent is not found report status as success, error, or failure if_ci_failed: error # if ci fails report status as success, error, or failure flags: - src tests: # declare a new status context "tests" target: 95% # we always want 100% coverage here, close enough will do for now target: auto # auto while we get this going base: auto # will use the pull request base if the commit is on a pull request. If not, the parent commit will be used. if_no_uploads: error # will post commit status of "error" if no coverage reports were uploaded # options: success, error, failure if_not_found: success # if parent is not found report status as success, error, or failure if_ci_failed: error # if ci fails report status as success, error, or failure flags: - tests patch: # pull requests only: this commit status will measure the # entire pull requests Coverage Diff. Checking if the lines # adjusted are covered at least X%. default: target: 100% # Newly added lines must have 100% coverage if_no_uploads: error # will post commit status of "error" if no coverage reports were uploaded # options: success, error, failure if_not_found: success if_ci_failed: error flags: - src - tests changes: # if there are any unexpected changes in coverage default: if_no_uploads: error if_not_found: success if_ci_failed: error flags: - src - tests flags: src: paths: - src/ carryforward: false # https://docs.codecov.io/docs/carryforward-flags # We always test the full repo code. Carry-forward is False. tests: paths: - tests/ carryforward: false comment: layout: "reach, diff, flags, files" behavior: default # Comment posting behaviour # default: update, if exists. Otherwise post new. # once: update, if exists. Otherwise post new. Skip if deleted. # new: delete old and post new. # spammy: post new (do not delete old comments). pytest-skip-markers-1.3.0/.github/0000755000000000000000000000000014236250622015551 5ustar00rootrootpytest-skip-markers-1.3.0/.github/CODEOWNERS0000644000000000000000000000065314236250622017150 0ustar00rootroot# pytest-skip-markers CODE OWNERS # See GitHub's Docs About Code Owners # for more info about the CODEOWNERS file # This is a comment. # Each line is a file pattern followed by one or more owners. # These owners will be the default owners for everything in # the repo. Unless a later match takes precedence, # @and will be requested for # review when someone opens a pull request. # Team Core * @saltstack/team-core pytest-skip-markers-1.3.0/.github/workflows/0000755000000000000000000000000014236250622017606 5ustar00rootrootpytest-skip-markers-1.3.0/.github/workflows/release.yml0000644000000000000000000000117614236250622021756 0ustar00rootrootname: Release on: release: types: [created] jobs: Publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v2 with: python-version: 3.9 - name: Install Nox run: | python -m pip install nox - name: Build a binary wheel and a source tarball run: | nox -e build - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_TOKEN }} print_hash: true pytest-skip-markers-1.3.0/.github/workflows/testing.yml0000644000000000000000000005175214236250622022020 0ustar00rootrootname: CI on: [push, pull_request] jobs: Pre-Commit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Python uses: actions/setup-python@v2 with: python-version: 3.9 - 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') }}|${{ hashFiles('.pre-commit-hooks/*') }} - name: Install Dependencies run: | python -m pip install pre-commit pre-commit install --install-hooks - name: Run Pre-Commit run: | pre-commit run --show-diff-on-failure --color=always --all-files PyLint: runs-on: ubuntu-latest 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: Install Lint Requirements run: | nox --force-color -e lint --install-only - name: Run PyLint env: SKIP_REQUIREMENTS_INSTALL: YES run: | nox --force-color -e lint Docs: runs-on: ubuntu-latest 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: 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-latest needs: Pre-Commit timeout-minutes: 15 strategy: fail-fast: false max-parallel: 10 matrix: python-version: - "3.5" - "3.6" - "3.7" - "3.8" - "3.9" - "3.10" pytest-version: - "~=6.0.0" - "~=6.1.0" - "~=6.2.0" - "~=7.0.0" - "~=7.1.0" exclude: - {"python-version": "3.5", "pytest-version": "~=6.2.0"} - {"python-version": "3.5", "pytest-version": "~=7.0.0"} - {"python-version": "3.5", "pytest-version": "~=7.1.0"} - {"python-version": "3.6", "pytest-version": "~=7.1.0"} - {"python-version": "3.10", "pytest-version": "~=6.0.0"} - {"python-version": "3.10", "pytest-version": "~=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 'pytest${{ matrix.pytest-version }}' - name: Install Test Requirements env: PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }} run: | nox --force-color -e tests-3 --install-only - name: Test env: SKIP_REQUIREMENTS_INSTALL: YES run: | nox --force-color -e tests-3 -- -vv tests/ - name: Gather CodeCov Info if: always() id: codecov-info run: | echo ::set-output name=flag-python-version::$(python -c "import sys; print('Py{}{}'.format(*sys.version_info))") echo ::set-output name=flag-pytest-version::$(python -c "import pytest; print('PyTest{}{}'.format(*pytest.__version__.split('.')))") echo ::set-output name=flag-runner-os::$(python -c "print('${{ runner.os }}'.replace('-latest', ''))") echo ::set-output name=uploader-url::$(python -c "print('https://uploader.codecov.io/latest/codecov-linux')") echo ::set-output name=uploader-name::$(python -c "print('codecov-linux')") - name: Create CodeCov Flags if: always() id: codecov run: | echo ::set-output name=flags::$(python -c "print(','.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") echo ::set-output name=report-name::$(python -c "print('-'.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") - name: Download Code Coverage Tool if: always() shell: bash run: | if [ "$(which curl)x" == "x" ]; then echo "Failed to find the 'curl' binary" exit 0 fi if [ "$(which gpg)x" == "x" ]; then echo "Failed to find the 'gpg' binary" exit 0 fi if [ "$(which shasum)x" == "x" ]; then echo "Failed to find the 'shasum' binary" exit 0 fi if [ ! -x codecov-linux ]; then n=0 until [ "$n" -ge 5 ] do if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output ${{ steps.codecov-info.outputs.uploader-name }}; then break fi n=$((n+1)) sleep 15 done n=0 until [ "$n" -ge 5 ] do if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }}.SHA256SUM --output ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM; then break fi n=$((n+1)) sleep 15 done n=0 until [ "$n" -ge 5 ] do if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }}.SHA256SUM.sig --output ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM.sig; then break fi n=$((n+1)) sleep 15 done n=0 until [ "$n" -ge 5 ] do if curl --max-time 30 -L https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --import; then break fi n=$((n+1)) sleep 15 done gpg --verify ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM.sig ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM && \ shasum -a 256 -c ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM && \ chmod +x ${{ steps.codecov-info.outputs.uploader-name }} || exit 0 fi - name: Upload Project Code Coverage if: always() shell: bash env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},src REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-src REPORT_PATH: artifacts/coverage-project.xml run: | if [ -x ${{ steps.codecov-info.outputs.uploader-name }} ]; then n=0 until [ "$n" -ge 5 ] do if ./${{ steps.codecov-info.outputs.uploader-name }} -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then break fi n=$((n+1)) sleep 15 done fi - name: Upload Tests Code Coverage if: always() shell: bash env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},tests REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-tests REPORT_PATH: artifacts/coverage-tests.xml run: | if [ -x ${{ steps.codecov-info.outputs.uploader-name }} ]; then n=0 until [ "$n" -ge 5 ] do if ./${{ steps.codecov-info.outputs.uploader-name }} -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-${{ steps.codecov.outputs.report-name }}.log path: artifacts/runtests-*.log Windows: runs-on: windows-latest needs: Pre-Commit timeout-minutes: 40 strategy: fail-fast: false max-parallel: 10 matrix: python-version: - "3.6" - "3.7" - "3.8" - "3.9" - "3.10" pytest-version: - "~=6.2.0" - "~=7.0.0" - "~=7.1.0" exclude: - {"python-version": "3.6", "pytest-version": "~=7.1.0"} - {"python-version": "3.10", "pytest-version": "~=6.0.0"} - {"python-version": "3.10", "pytest-version": "~=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 'pytest${{ matrix.pytest-version }}' - name: Install Test Requirements shell: bash env: PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }} run: | export PATH="/C/Program Files (x86)/Windows Kits/10/bin/10.0.18362.0/x64;$PATH" nox --force-color -e tests-3 --install-only - name: Test 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-3 -- -vv tests/ - name: Gather CodeCov Info if: always() id: codecov-info shell: bash run: | echo ::set-output name=flag-python-version::$(python -c "import sys; print('Py{}{}'.format(*sys.version_info))") echo ::set-output name=flag-pytest-version::$(python -c "import pytest; print('PyTest{}{}'.format(*pytest.__version__.split('.')))") echo ::set-output name=flag-runner-os::$(python -c "print('${{ runner.os }}'.replace('-latest', ''))") echo ::set-output name=uploader-url::$(python -c "print('https://uploader.codecov.io/latest/windows/codecov.exe')") echo ::set-output name=uploader-name::$(python -c "print('codecov.exe')") - name: Create CodeCov Flags if: always() id: codecov run: | echo ::set-output name=flags::$(python -c "print(','.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") echo ::set-output name=report-name::$(python -c "print('-'.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") - name: Download Code Coverage Tool if: always() shell: powershell run: | If (-not(Test-Path -Path ./${{ steps.codecov-info.outputs.uploader-name }})) { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12, [Net.SecurityProtocolType]::Ssl3 [Net.ServicePointManager]::SecurityProtocol = "Tls, Tls11, Tls12, Ssl3" $ProgressPreference = 'SilentlyContinue' Invoke-WebRequest -Uri https://keybase.io/codecovsecurity/pgp_keys.asc -OutFile codecov.asc gpg.exe --import codecov.asc Invoke-WebRequest -Uri ${{ steps.codecov-info.outputs.uploader-url }} -Outfile ${{ steps.codecov-info.outputs.uploader-name }} Invoke-WebRequest -Uri ${{ steps.codecov-info.outputs.uploader-url }}.SHA256SUM -Outfile ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM Invoke-WebRequest -Uri ${{ steps.codecov-info.outputs.uploader-url }}.SHA256SUM.sig -Outfile ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM.sig gpg.exe --verify ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM.sig ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile ${{ steps.codecov-info.outputs.uploader-name }} SHA256)[1], "${{ steps.codecov-info.outputs.uploader-name }}") -join " ") -DifferenceObject $(Get-Content ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM)).length -eq 0) { echo "SHASUM verified" } Else { exit 0 } } - name: Upload Project Code Coverage if: always() shell: bash env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},src REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-src REPORT_PATH: artifacts/coverage-project.xml run: | if [ -x ${{ steps.codecov-info.outputs.uploader-name }} ]; then n=0 until [ "$n" -ge 5 ] do if ./${{ steps.codecov-info.outputs.uploader-name }} -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then break fi n=$((n+1)) sleep 15 done fi - name: Upload Tests Code Coverage if: always() shell: bash env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},tests REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-tests REPORT_PATH: artifacts/coverage-tests.xml run: | if [ -x ${{ steps.codecov-info.outputs.uploader-name }} ]; then n=0 until [ "$n" -ge 5 ] do if ./${{ steps.codecov-info.outputs.uploader-name }} -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-${{ steps.codecov.outputs.report-name }}.log path: artifacts/runtests-*.log macOS: runs-on: macOS-latest needs: Pre-Commit timeout-minutes: 40 strategy: fail-fast: false max-parallel: 10 matrix: python-version: - "3.6" - "3.7" - "3.8" - "3.9" - "3.10" pytest-version: - "~=6.2.0" - "~=7.0.0" - "~=7.1.0" exclude: - {"python-version": "3.6", "pytest-version": "~=7.1.0"} - {"python-version": "3.10", "pytest-version": "~=6.0.0"} - {"python-version": "3.10", "pytest-version": "~=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 'pytest${{ matrix.pytest-version }}' - name: Install Test Requirements env: PYTEST_VERSION_REQUIREMENT: pytest${{ matrix.pytest-version }} run: | nox --force-color -e tests-3 --install-only - name: Test env: SKIP_REQUIREMENTS_INSTALL: YES run: | nox --force-color -e tests-3 -- -vv tests/ - name: Gather CodeCov Info if: always() id: codecov-info run: | echo ::set-output name=flag-python-version::$(python -c "import sys; print('Py{}{}'.format(*sys.version_info))") echo ::set-output name=flag-pytest-version::$(python -c "import pytest; print('PyTest{}{}'.format(*pytest.__version__.split('.')))") echo ::set-output name=flag-runner-os::$(python -c "print('${{ runner.os }}'.replace('-latest', ''))") echo ::set-output name=uploader-url::$(python -c "print('https://uploader.codecov.io/latest/codecov-macos')") echo ::set-output name=uploader-name::$(python -c "print('codecov-macos')") - name: Create CodeCov Flags if: always() id: codecov run: | echo ::set-output name=flags::$(python -c "print(','.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") echo ::set-output name=report-name::$(python -c "print('-'.join(['${{ steps.codecov-info.outputs.flag-runner-os }}', '${{ steps.codecov-info.outputs.flag-python-version }}', '${{ steps.codecov-info.outputs.flag-pytest-version }}']))") - name: Download Code Coverage Tool if: always() shell: bash run: | if [ "$(which curl)x" == "x" ]; then echo "Failed to find the 'curl' binary" exit 0 fi if [ "$(which gpg)x" == "x" ]; then echo "Failed to find the 'gpg' binary" exit 0 fi if [ "$(which shasum)x" == "x" ]; then echo "Failed to find the 'shasum' binary" exit 0 fi if [ ! -x codecov-linux ]; then n=0 until [ "$n" -ge 5 ] do if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }} --output ${{ steps.codecov-info.outputs.uploader-name }}; then break fi n=$((n+1)) sleep 15 done n=0 until [ "$n" -ge 5 ] do if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }}.SHA256SUM --output ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM; then break fi n=$((n+1)) sleep 15 done n=0 until [ "$n" -ge 5 ] do if curl --max-time 30 -L ${{ steps.codecov-info.outputs.uploader-url }}.SHA256SUM.sig --output ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM.sig; then break fi n=$((n+1)) sleep 15 done n=0 until [ "$n" -ge 5 ] do if curl --max-time 30 -L https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --import; then break fi n=$((n+1)) sleep 15 done gpg --verify ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM.sig ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM && \ shasum -a 256 -c ${{ steps.codecov-info.outputs.uploader-name }}.SHA256SUM && \ chmod +x ${{ steps.codecov-info.outputs.uploader-name }} || exit 0 fi - name: Upload Project Code Coverage if: always() shell: bash env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},src REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-src REPORT_PATH: artifacts/coverage-project.xml run: | if [ -x ${{ steps.codecov-info.outputs.uploader-name }} ]; then n=0 until [ "$n" -ge 5 ] do if ./${{ steps.codecov-info.outputs.uploader-name }} -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then break fi n=$((n+1)) sleep 15 done fi - name: Upload Tests Code Coverage if: always() shell: bash env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},tests REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-tests REPORT_PATH: artifacts/coverage-tests.xml run: | if [ -x ${{ steps.codecov-info.outputs.uploader-name }} ]; then n=0 until [ "$n" -ge 5 ] do if ./${{ steps.codecov-info.outputs.uploader-name }} -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-${{ steps.codecov.outputs.report-name }}.log path: artifacts/runtests-*.log Build: runs-on: ubuntu-latest needs: - Docs - PyLint - Linux - Windows - macOS steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v2 with: python-version: 3.9 - name: Install Nox run: | python -m pip install nox - name: Build a binary wheel and a source tarball run: | nox -e build - name: Publish distribution 📦 to Test PyPI if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.TEST_PYPI_TOKEN }} repository_url: https://test.pypi.org/legacy/ print_hash: true pytest-skip-markers-1.3.0/.gitignore0000644000000000000000000000360214236250622016202 0ustar00rootroot# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ pip-wheel-metadata/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # 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/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py db.sqlite3 db.sqlite3-journal # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # Jupyter Notebook .ipynb_checkpoints # IPython profile_default/ ipython_config.py # pyenv .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ # Celery stuff celerybeat-schedule celerybeat.pid # SageMath parsed files *.sage.py # Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # Ignore the auto generated version.py src/pytestskipmarkers/version.py # Ignore the test generated artifacts artifacts/ pytest-skip-markers-1.3.0/.pre-commit-config.yaml0000644000000000000000000001272414236250622020500 0ustar00rootroot--- minimum_pre_commit_version: 1.15.2 repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.2.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. # ----- Local Hooks -----------------------------------------------------------------------------------------------> - 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$ - id: check-changelog-entries name: Check Changelog Entries entry: python .pre-commit-hooks/check-changelog-entries.py language: system - repo: local hooks: - id: check-copyright-headers name: Check python modules for appropriate copyright headers files: ^.*\.py$ entry: python .pre-commit-hooks/copyright-headers.py language: system # <---- Local Hooks ------------------------------------------------------------------------------------------------ # ----- Remove Typing - Py3.5 Support ----------------------------------------------------------------------------> - repo: https://github.com/s0undt3ch/downgrade-source rev: v2.1.0 hooks: - id: downgrade-source name: Downgrade source code into a separate package to support Py3.5 files: ^src/.*\.py$ exclude: ^src/pytestskipmarkers/((__init__|version|utils/__init__)\.py|downgraded/.*\.py)$ args: - --target-version=3.5 - --pkg-path=src/pytestskipmarkers - --skip-checker=nounusableimports - --skip-checker=nostarimports # <---- Remove Typing - Py3.5 Support ----------------------------------------------------------------------------- # ----- Formatting ------------------------------------------------------------------------------------------------> - repo: https://github.com/asottile/pyupgrade rev: v2.32.0 hooks: - id: pyupgrade name: Rewrite Code to be Py3.5+ args: [--py3-plus] exclude: ^src/pytestskipmarkers/downgraded/.*\.py$ - repo: https://github.com/asottile/reorder_python_imports rev: v3.0.1 hooks: - id: reorder-python-imports args: [ --py3-plus, --application-directories=.:src:examples/echo-extension/src ] exclude: ^src/pytestskipmarkers/(version.py|downgraded/.*)$ - repo: https://github.com/psf/black rev: 22.3.0 hooks: - id: black args: [-l 100] exclude: ^src/pytestskipmarkers/(version.py|downgraded/.*)$ - repo: https://github.com/asottile/blacken-docs rev: v1.12.1 hooks: - id: blacken-docs args: [--skip-errors] files: ^(.*\.rst|docs/.*\.rst|src/pytestskipmarkers/.*\.py)$ additional_dependencies: - black==22.3.0 # <---- Formatting ------------------------------------------------------------------------------------------------- # ----- Security --------------------------------------------------------------------------------------------------> - repo: https://github.com/PyCQA/bandit rev: "1.7.4" hooks: - id: bandit alias: bandit-salt name: Run bandit against Salt args: [--silent, -lll, --skip, B701] exclude: > (?x)^( tests/.* )$ - repo: https://github.com/PyCQA/bandit rev: "1.7.4" hooks: - id: bandit alias: bandit-tests name: Run bandit against the test suite args: [--silent, -lll, --skip, B701] files: ^tests/.* # <---- Security --------------------------------------------------------------------------------------------------- # ----- Code Analysis ---------------------------------------------------------------------------------------------> - repo: https://github.com/pycqa/flake8 rev: '4.0.1' hooks: - id: flake8 exclude: ^(src/pytestskipmarkers/(downgraded/.*|version\.py)|\.pre-commit-hooks/.*\.py)$ additional_dependencies: - flake8-mypy-fork - flake8-docstrings - flake8-typing-imports - repo: https://github.com/pre-commit/mirrors-mypy rev: v0.942 hooks: - id: mypy name: Run mypy against source files: ^src/.*\.py$ exclude: ^src/pytestskipmarkers/(downgraded/.*|utils/(socket|time)\.py)$ args: [--strict] additional_dependencies: - attrs - types-attrs - types-setuptools - repo: https://github.com/pre-commit/mirrors-mypy rev: v0.942 hooks: - id: mypy name: Run mypy against tests files: ^tests/.*\.py$ exclude: ^src/pytestskipmarkers/(downgraded/.*|utils/(socket|time)\.py)$ args: [] additional_dependencies: - pytest - attrs - types-attrs - types-setuptools # <---- Code Analysis ---------------------------------------------------------------------------------------------- pytest-skip-markers-1.3.0/.pre-commit-hooks/0000755000000000000000000000000014236250622017464 5ustar00rootrootpytest-skip-markers-1.3.0/.pre-commit-hooks/check-changelog-entries.py0000644000000000000000000001070314236250622024510 0ustar00rootroot#!/usr/bin/env python3 # Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # # pylint: skip-file import argparse import pathlib import re import sys CODE_ROOT = pathlib.Path(__file__).resolve().parent.parent CHANGELOG_ENTRIES_PATH = CODE_ROOT / "changelog" CHANGELOG_LIKE_RE = re.compile(r"([\d]+)\.([a-z]+)(\.rst)?$") CHANGELOG_EXTENSIONS = ( "breaking", "deprecation", "feature", "improvement", "bugfix", "doc", "trivial", ) CHANGELOG_ENTRY_REREX = r"^[\d]+\.({})\.rst$".format("|".join(CHANGELOG_EXTENSIONS)) CHANGELOG_ENTRY_RE = re.compile(CHANGELOG_ENTRY_REREX) def check_changelog_entries(files): exitcode = 0 for entry in files: path = pathlib.Path(entry).resolve() # Is it under changelog/ try: path.relative_to(CHANGELOG_ENTRIES_PATH) if path.name in (".gitignore", "_template.rst", __name__): # These files should be ignored continue # Is it named properly if not CHANGELOG_ENTRY_RE.match(path.name): # Does it end in .rst if path.suffix != ".rst": exitcode = 1 print( "The changelog entry '{}' should have '.rst' as it's file extension".format( path.relative_to(CODE_ROOT), ), file=sys.stderr, flush=True, ) continue print( "The changelog entry '{}' should have one of the following extensions: {}.".format( path.relative_to(CODE_ROOT), ", ".join(repr(ext) for ext in CHANGELOG_EXTENSIONS), ), file=sys.stderr, flush=True, ) exitcode = 1 continue check_changelog_entry_contents(path) except ValueError: # Not under changelog/, carry on checking # Is it a changelog entry if CHANGELOG_ENTRY_RE.match(path.name): # So, this IS a changelog entry, but it's misplaced.... exitcode = 1 print( "The changelog entry '{}' should be placed under '{}/', not '{}'".format( path.relative_to(CODE_ROOT), CHANGELOG_ENTRIES_PATH.relative_to(CODE_ROOT), path.relative_to(CODE_ROOT).parent, ), file=sys.stderr, flush=True, ) continue elif CHANGELOG_LIKE_RE.match(path.name) and not CHANGELOG_ENTRY_RE.match(path.name): # Does it look like a changelog entry print( "The changelog entry '{}' should have one of the following extensions: {}.".format( path.relative_to(CODE_ROOT), ", ".join(repr(ext) for ext in CHANGELOG_EXTENSIONS), ), file=sys.stderr, flush=True, ) exitcode = 1 continue elif not CHANGELOG_LIKE_RE.match(path.name) and not CHANGELOG_ENTRY_RE.match(path.name): # Does not look like, and it's not a changelog entry continue # Does it end in .rst if path.suffix != ".rst": exitcode = 1 print( "The changelog entry '{}' should have '.rst' as it's file extension".format( path.relative_to(CODE_ROOT), ), file=sys.stderr, flush=True, ) return exitcode def check_changelog_entry_contents(entry): contents = entry.read_text().splitlines() if len(contents) > 1: # More than one line. # If the second line starts with '*' it's a bullet list and we need to add an # empty line before it. if contents[1].strip().startswith("*"): contents.insert(1, "") entry.write_text("{}\n".format("\n".join(contents))) def main(argv): parser = argparse.ArgumentParser(prog=__name__) parser.add_argument("files", nargs="+") options = parser.parse_args(argv) return check_changelog_entries(options.files) if __name__ == "__main__": sys.exit(main(sys.argv)) pytest-skip-markers-1.3.0/.pre-commit-hooks/copyright-headers.py0000644000000000000000000000673514236250622023472 0ustar00rootroot#!/usr/bin/env python3 # Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # # pylint: disable=invalid-name,missing-module-docstring,missing-function-docstring import argparse import pathlib import re import sys from datetime import datetime CODE_ROOT = pathlib.Path(__file__).resolve().parent.parent SPDX_HEADER = "# SPDX-License-Identifier: Apache-2.0" COPYRIGHT_HEADER = "# Copyright {year} VMware, Inc." COPYRIGHT_REGEX = re.compile( r"# Copyright (?:(?P[0-9]{4})(?:-(?P[0-9]{4}))?) VMware, Inc\." ) SPDX_REGEX = re.compile(r"# SPDX-License-Identifier:.*") def check_copyright(files): for file in files: contents = file.read_text() if not contents.strip(): # Don't add headers to empty files continue original_contents = contents try: if not COPYRIGHT_REGEX.search(contents): contents = inject_copyright_header(contents) if contents != original_contents: print(f"Added the copyright header to {file}") else: contents = update_copyright_header(contents) if contents != original_contents: print(f"Updated the copyright header on {file}") if not SPDX_REGEX.search(contents): contents = inject_spdx_header(contents) if contents != original_contents: print(f"Added the SPDX header to {file}") finally: if not contents.endswith("\n"): contents += "\n" if original_contents != contents: file.write_text(contents) def inject_copyright_header(contents): lines = contents.splitlines() shebang_found = False for idx, line in enumerate(lines[:]): if idx == 0 and line.startswith("#!"): shebang_found = True continue if shebang_found and line.strip(): shebang_found = False lines.insert(idx, "") idx += 1 lines.insert(idx, COPYRIGHT_HEADER.format(year=datetime.today().year)) break return "\n".join(lines) def update_copyright_header(contents): lines = contents.splitlines() for idx, line in enumerate(lines[:]): match = COPYRIGHT_REGEX.match(line) if match: this_year = str(datetime.today().year) cur_year = match.group("cur_year") if cur_year and cur_year.strip() == this_year: return contents initial_year = match.group("start_year").strip() if initial_year == this_year: return contents lines[idx] = COPYRIGHT_HEADER.format(year=f"{initial_year}-{this_year}") break return "\n".join(lines) def inject_spdx_header(contents): lines = contents.splitlines() for idx, line in enumerate(lines[:]): if COPYRIGHT_REGEX.match(line): lines.insert(idx + 1, SPDX_HEADER) next_line = lines[idx + 2].strip() if next_line and not next_line.startswith('"""'): # If the next line is not empty, insert an empty comment lines.insert(idx + 2, "#") break return "\n".join(lines) def main(argv): parser = argparse.ArgumentParser(prog=__name__) parser.add_argument("files", nargs="+", type=pathlib.Path) options = parser.parse_args(argv) return check_copyright(options.files) if __name__ == "__main__": sys.exit(main(sys.argv)) pytest-skip-markers-1.3.0/.pre-commit-hooks/sort-pylint-spelling-words.py0000644000000000000000000000110514236250622025306 0ustar00rootroot#!/usr/bin/env python # Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # # 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-skip-markers-1.3.0/.pylint-spelling-words0000644000000000000000000000076714236250622020512 0ustar00rootrootabc abspath aix argparse args attr autodoc basepath bool changelog cli config conftest confvals css cwd darwin dns eg eq favicon favicons freebsd getsockname gz https ico illumos ini intersphinx intl ips iterable itertools linkcheck linux localhost lru lsof macos mtime namespace namespaced ne netbsd noqa nox openbsd os png pragma prepend py pyproject pytest pytest's pytestskipmarkers rc rst rtype sdist sid sids sitevars smartos str subtests sunos sys toml towncrier utils varname virtualenvs vmware pytest-skip-markers-1.3.0/.pylintrc0000644000000000000000000003235714236250622016070 0ustar00rootroot[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= # 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, consider-using-f-string # 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__,__salt__ # 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=_.* # 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-skip-markers-1.3.0/.readthedocs.yaml0000644000000000000000000000133714236250622017444 0ustar00rootroot# .readthedocs.yaml # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details # Required version: 2 # Set the version of Python and other tools you might need build: os: ubuntu-20.04 tools: python: "3.9" # You can also specify other tool versions: # nodejs: "16" # rust: "1.55" # golang: "1.17" # Build documentation in the docs/ directory with Sphinx sphinx: configuration: docs/conf.py # If using Sphinx, optionally build your docs in additional formats such as PDF formats: - pdf # Optionally declare the Python requirements required to build your docs python: install: - method: pip path: . extra_requirements: - docs pytest-skip-markers-1.3.0/CHANGELOG.rst0000644000000000000000000000454714236250622016244 0ustar00rootroot.. _changelog: ========= Changelog ========= Versions follow `Semantic Versioning `_ (`..`). Backward incompatible (breaking) changes will only be introduced in major versions with advance notice in the **Deprecations** section of releases. .. towncrier-draft-entries:: .. towncrier release notes start 1.3.0 (2022-05-09) ================== Features -------- - Support skipping all test cases that access the Internet by setting the environment variable `NO_INTERNET`. This is useful to make the test run reproducible and robust for future runs (to avoid breaking in case some random service on the Internet changes). (`#16 `_) 1.2.0 (2022-02-22) ================== Features -------- - Added ``pytest.mark.skip_on_photonos`` and ``pytest.mark.skip_unless_on_photonos`` markers (`#13 `_) - Added the ``pytest.mark.skip_on_env`` marker. (`#14 `_) 1.1.3 (2022-02-16) ================== Bug Fixes --------- - Fixed issue with ``sdist`` recompression for reproducible packages not iterating though subdirectories contents. (`#12 `_) 1.1.2 (2022-02-05) ================== Bug Fixes --------- - Set lower required python to `3.5.2` and avoid issues with `flake8-typing-imports`. (`#10 `_) 1.1.1 (2022-02-05) ================== Bug Fixes --------- - Allow installing on older minior versions of Py3.5. Looking at you Debian. (`#10 `_) 1.1.0 (2022-01-26) ================== Improvements ------------ - Maintain the skip location under Pytest >= 7.0.x (`#7 `_) - The plugin is now fully typed (`#8 `_) Trivial/Internal Changes ------------------------ - Reproducible builds * Fix copyright headers hook * ``towncrier`` now uses ``issue_format`` (`#7 `_) skip-markers 1.0.0 (2021-10-04) =============================== Features -------- - First public release of the Pytest Skip Markers Plugin pytest-skip-markers-1.3.0/CODE_OF_CONDUCT.md0000644000000000000000000001221014236250622017004 0ustar00rootroot# Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in pytest-shell-utilities project and our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at oss-coc@@vmware.com. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. pytest-skip-markers-1.3.0/CONTRIBUTING.md0000644000000000000000000000464314236250622016451 0ustar00rootroot# Contributing to pytest-skip-markers The pytest-skip-markers project team welcomes contributions from the community. If you wish to contribute code and you have not signed our [Contributor License Agreement](https://cla.vmware.com/cla/1/preview), our bot will update the issue when you open a Pull Request. For any questions about the CLA process, please refer to our [FAQ](https://cla.vmware.com/faq). ## Contribution Flow This is a rough outline of what a contributor's workflow looks like: - Create a topic branch from where you want to base your work - Make commits of logical units - Make sure your commit messages are in the proper format (see below) - Push your changes to a topic branch in your fork of the repository - Submit a pull request Example: ``` shell git remote add upstream https://github.com/saltstack/pytest-skip-markers.git git checkout -b my-new-feature main git commit -a git push origin my-new-feature ``` ### Staying In Sync With Upstream When your branch gets out of sync with the pytest-skip-markers/main branch, use the following to update: ``` shell git checkout my-new-feature git fetch -a git pull --rebase upstream main git push --force-with-lease origin my-new-feature ``` ### Updating pull requests If your PR fails to pass CI or needs changes based on code review, you'll most likely want to squash these changes into existing commits. If your pull request contains a single commit or your changes are related to the most recent commit, you can simply amend the commit. ``` shell git add . git commit --amend git push --force-with-lease origin my-new-feature ``` If you need to squash changes into an earlier commit, you can use: ``` shell git add . git commit --fixup git rebase -i --autosquash main git push --force-with-lease origin my-new-feature ``` Be sure to add a comment to the PR indicating your new changes are ready to review, as GitHub does not generate a notification when you git push. ### Code Style ### Formatting Commit Messages We follow the conventions on [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/). Be sure to include any related GitHub issue references in the commit message. See [GFM syntax](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown) for referencing issues and commits. ## Reporting Bugs and Creating Issues When opening a new issue, try to roughly follow the commit message format conventions above. pytest-skip-markers-1.3.0/LICENSE0000644000000000000000000002210314236250622015214 0ustar00rootrootApache 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 pytest-skip-markers-1.3.0/NOTICE0000644000000000000000000000063414236250622015120 0ustar00rootrootCopyright 2021 VMware, Inc. This product is licensed to you under the Apache License, V2.0 (the "License"). You may not use this product except in compliance with the License. This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. pytest-skip-markers-1.3.0/PKG-INFO0000644000000000000000000000723414236250622015314 0ustar00rootrootMetadata-Version: 2.1 Name: pytest-skip-markers Version: 1.3.0 Summary: Pytest Salt Plugin Home-page: https://github.com/saltstack/pytest-skip-markers Author: Pedro Algarvio Author-email: pedro@algarvio.me License: Apache Software License 2.0 Project-URL: Source, https://github.com/saltstack/pytest-skip-markers Project-URL: Tracker, https://github.com/saltstack/pytest-skip-markers/issues Project-URL: Documentation, https://pytest-skip-markers.readthedocs.io 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: Framework :: Pytest Classifier: Typing :: Typed Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License Requires-Python: >=3.5.2 Provides-Extra: docker Provides-Extra: salt Provides-Extra: docs Provides-Extra: lint Provides-Extra: tests Provides-Extra: changelog License-File: LICENSE License-File: NOTICE .. image:: https://img.shields.io/github/workflow/status/saltstack/pytest-skip-markers/CI?style=plastic :target: https://github.com/saltstack/pytest-skip-markers/actions/workflows/testing.yml :alt: CI .. image:: https://readthedocs.org/projects/pytest-skip-markers/badge/?style=plastic :target: https://pytest-skip-markers.readthedocs.io :alt: Docs .. image:: https://img.shields.io/codecov/c/github/saltstack/pytest-skip-markers?style=plastic&token=CqV7t0yKTb :target: https://codecov.io/gh/saltstack/pytest-skip-markers :alt: Codecov .. image:: https://img.shields.io/pypi/pyversions/pytest-skip-markers?style=plastic :target: https://pypi.org/project/pytest-skip-markers :alt: Python Versions .. image:: https://img.shields.io/pypi/wheel/pytest-skip-markers?style=plastic :target: https://pypi.org/project/pytest-skip-markers :alt: Python Wheel .. image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=plastic :target: https://github.com/psf/black :alt: Code Style: black .. image:: https://img.shields.io/pypi/l/pytest-skip-markers?style=plastic :alt: PyPI - License .. include-starts-here ==================== What is Skip Markers ==================== This pytest plugin was extracted from `pytest-salt-factories`_. It's a collection of of useful skip markers created to simplify and reduce code required to skip tests in some common scenarios, for example, platform specific tests. .. _pytest-salt-factories: https://github.com/saltstack/pytest-salt-factories Install ======= Installing Skip Markers is as simple as: .. code-block:: bash python -m pip install pytest-skip-markers And, that's honestly it. Usage ===== Once installed, you can now skip some tests with some simple pytest markers, for example. .. code-block:: python import pytest @pytest.mark.skip_unless_on_linux def test_on_linux(): assert True Contributing ============ The pytest-skip-markers project team welcomes contributions from the community. For more detailed information, refer to `CONTRIBUTING`_. .. _CONTRIBUTING: https://github.com/saltstack/pytest-skip-markers/blob/main/CONTRIBUTING.md .. include-ends-here Documentation ============= The full documentation can be seen `here `_. pytest-skip-markers-1.3.0/README.rst0000644000000000000000000000443414236250622015705 0ustar00rootroot.. image:: https://img.shields.io/github/workflow/status/saltstack/pytest-skip-markers/CI?style=plastic :target: https://github.com/saltstack/pytest-skip-markers/actions/workflows/testing.yml :alt: CI .. image:: https://readthedocs.org/projects/pytest-skip-markers/badge/?style=plastic :target: https://pytest-skip-markers.readthedocs.io :alt: Docs .. image:: https://img.shields.io/codecov/c/github/saltstack/pytest-skip-markers?style=plastic&token=CqV7t0yKTb :target: https://codecov.io/gh/saltstack/pytest-skip-markers :alt: Codecov .. image:: https://img.shields.io/pypi/pyversions/pytest-skip-markers?style=plastic :target: https://pypi.org/project/pytest-skip-markers :alt: Python Versions .. image:: https://img.shields.io/pypi/wheel/pytest-skip-markers?style=plastic :target: https://pypi.org/project/pytest-skip-markers :alt: Python Wheel .. image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=plastic :target: https://github.com/psf/black :alt: Code Style: black .. image:: https://img.shields.io/pypi/l/pytest-skip-markers?style=plastic :alt: PyPI - License .. include-starts-here ==================== What is Skip Markers ==================== This pytest plugin was extracted from `pytest-salt-factories`_. It's a collection of of useful skip markers created to simplify and reduce code required to skip tests in some common scenarios, for example, platform specific tests. .. _pytest-salt-factories: https://github.com/saltstack/pytest-salt-factories Install ======= Installing Skip Markers is as simple as: .. code-block:: bash python -m pip install pytest-skip-markers And, that's honestly it. Usage ===== Once installed, you can now skip some tests with some simple pytest markers, for example. .. code-block:: python import pytest @pytest.mark.skip_unless_on_linux def test_on_linux(): assert True Contributing ============ The pytest-skip-markers project team welcomes contributions from the community. For more detailed information, refer to `CONTRIBUTING`_. .. _CONTRIBUTING: https://github.com/saltstack/pytest-skip-markers/blob/main/CONTRIBUTING.md .. include-ends-here Documentation ============= The full documentation can be seen `here `_. pytest-skip-markers-1.3.0/changelog/0000755000000000000000000000000014236250622016140 5ustar00rootrootpytest-skip-markers-1.3.0/changelog/.gitignore0000644000000000000000000000001414236250622020123 0ustar00rootroot!.gitignore pytest-skip-markers-1.3.0/docs/0000755000000000000000000000000014236250622015141 5ustar00rootrootpytest-skip-markers-1.3.0/docs/Makefile0000644000000000000000000000117214236250622016602 0ustar00rootroot# Minimal makefile for Sphinx documentation # # You can set these variables from the command line, and also # from the environment for the first two. SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build SOURCEDIR = . BUILDDIR = _build # Put it first so that "make" without argument is like "make help". help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) .PHONY: help Makefile # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) pytest-skip-markers-1.3.0/docs/_static/0000755000000000000000000000000014236250622016567 5ustar00rootrootpytest-skip-markers-1.3.0/docs/_static/.gitkeep0000644000000000000000000000000014236250622020206 0ustar00rootrootpytest-skip-markers-1.3.0/docs/_static/css/0000755000000000000000000000000014236250622017357 5ustar00rootrootpytest-skip-markers-1.3.0/docs/_static/css/inline-include.css0000644000000000000000000000065114236250622022772 0ustar00rootroot.literal-block-wrapper, article div[class^="highlight-default"] { margin-top: 0.4em; } .literal-block-wrapper .code-block-caption { text-align: left; } .literal-block-wrapper .code-block-caption .caption-text { padding: 0.5em 0.7em; border: .1em solid var(--color-code-background); border-radius: 0.6rem 0.6rem 0 0; background-color: var(--color-code-background); font-family: var(--font-stack--monospace); } pytest-skip-markers-1.3.0/docs/_static/img/0000755000000000000000000000000014236250622017343 5ustar00rootrootpytest-skip-markers-1.3.0/docs/_static/img/SaltProject_Logomark_teal.png0000644000000000000000000002416714236250622025155 0ustar00rootroot‰PNG  IHDRèbòˆãZ pHYs&|&|…¢Û IDATxœíÝÙmÜܶ.Ðu/ÎûÞ`vvre`€ („ÊàÒÐH°# å,%@üŠ`_p›>îÔTÃf5c„0g½|˜¬õýŸÿüç?HWÕwMáÿY!¤M@€„U}÷2„pBø—=@Úþ¯ý@Òáòà‚‰ªúîM¡·?ȃ :¤«±;ȇ€ ªúî2„pawŸ¸@bª¾ûwáÖÏ /.èž½pùqA€„Lµjßì òã‚iií ò䂉P«ysA€t¸ž@ÆtH@ÕwãÃp¯ì òåwˆœZ5(ƒ :įÎ .è1µjPtˆÛ•ý@tˆTÕwoCöeÐ ^jÕ  :D¨ê»ña¸våðHDF­”ÉâÓ çPtˆHÕw¯C_ìÊã‚qñ0J@€HT}w©V ÊåwˆÀô0Ü—Û \.臽pesA€U}÷rºž{¹ æ‚Ûk„sÀ6TõÝ›Bo€ :lK­ð_:ldªU{eþ@ð‰;lcªU»õßsàtØÆ^8~å‚+›jÕ¾™;ð+tXŸ‡á€¿¸ ÀŠÔªqA€u]™7ðVRõÝø0Ü óâwXZ5à9.è°ŽF8žâ‚ «úîuá‹9OqA€å©Už% À‚ª¾{B¸0cà9:,Ëõ8ˆ€ ©ú®Q«Ê#q°µjÀ±\Ð`­pÃfVõÝ›Bo®À1\Ð`~™ÇÐ`FUß]ªUNáw˜Éô0Ü—Û€S¸ À|öÂ9p*t˜AÕw/§ë¹—Û€“¸ À<ÔªgqA€3©Uæà‚çkÍ8—€g˜jÕ^™!p.Ÿ¸À‰¦Zµ[ÿ=æà‚§Û çÀ\\ÐàS­Ú7³æâ‚§¹27`N:iªU»07`N:Ïõ˜€G¨ún|î…™sóHH­°$t8\+œKqA€T}÷:„ðŬ€¥¸ ÀaZs–$ À3ª¾{«V Xš€Ïs=' Àª¾kÔªkðH<¢ê»—!„/·kpA€Ç5Â9°tx@ÕwoB½ÙkqA€‡5æ¬I@€?T}w©V X›OÜàUßý{zÎËíÀª\Ðàw{áØ‚ :L¦ZµoælÁ~jÍØŠ :¨U"à‚ß¹ž›Ð(^ÕwãÃp¯JŸ°-Ÿ¸P´©Ví6„ð¯ÒglË€Ò5Â9tŠ¥V ˆ‰ :%»²} :EšjÕ.lˆ…€@©\Ï€¨è§ê»ña¸6ÄÄ#qE­+tJÓ ç@Œ\Ð(FÕw¯C_lˆ‘ :%imˆ•€@ª¾{«V ˆ™OÜÈÞô0Ü—Û€˜¹ P‚½pÄ΀¬U}÷rºž{¹ˆš :¹k„s .èd«ê»7!„Þ†€¸ ³Æv€Tèd©ê»Kµj@J|â@v¦Zµ[ÿ=Râ‚@ŽöÂ9t²2Õª}³U 5.è䦵Q E.èdC­2trre›@ªt²PõÝø0Ü ÛRåw’§V È :9h„s u.è$M­ tRça8 :ɪúîmá€褬µ= :Iªú®Q«äÄ#q$G­#tRÔ ç@n\ÐHJÕw¯C_l È :©ñ0%€dT}w©V È•OÜHÂô0Ü—Û€\¹ нpäÌ€èU}÷rºž{¹È– :)h„s w.èD­ê»7!„Þ–€Ü¹ ;µj@t¢5Õª½²! >q JS­Ú­ÿž¥pA V{á(‰ :Ñ™jÕ¾Ù Ptbte+@it¢2Õª]Ø P€Ø¸žEЈFÕwãÃp/l(‘G∂Z5 t.èĢ΀’¹ °¹ªï^‡¾ØP2tbÐÚP:€MU}÷V­€€Àö\Ï€â€-U}רUøÎ#qlB­Àï\ÐØJ+œüä‚Àꪾ{BèMà't¶Ð˜:ÀïtVUõÝ¥Z5€¿ùÄ€ÕLÃÝx¹ào.è¬i/œ<Ì€UT}÷rºž{¹à.è¬E­À\ÐXœZ5€ç¹ °†Ö”ž& °¨©Ví•)<Í'î,fªU»õßs€ç¹ °¤F88Œ :‹˜jÕ¾™.Àa\ÐXÊ•ÉN@`vS­Ú…ÉN@` ®çGИUÕwû S8ŽGâ˜Z5€Ó¹ 0§V88 :³¨úîuá‹iœÆ€¹´& p:€³U}÷V­Àytæàzp&€³T}רU8ŸGâ8YÕw/C7^n8Ÿ :çh„s€y¸ p’ªïÞ„zÓ˜‡ :§jL`>:G«úîR­À¼|âÀQª¾ûwáÖÏæå‚À±öÂ9Àü\Ð8ØT«öÍÄæç‚À1ZÓX† :Q«°,tåz° €gU}7> ÷ʤ–ãwž¤V `.è<§Î–ç‚À£Ôª¬Ç€§\™À:t4Õª]˜À:tãz°"€¿T}7> ÷ÂdÖã‘8~£V `.èü©ÎÖç‚Àÿªúîuዉ¬Ï€_µ¦° €ÿªúî­Z5€íøÄ€ÃÝx¹`;.èŒöÂ9À¶\Ð WõÝËézîåv€ ¹ ÐçÛsA(XÕwoB½ßÀö\ÐʦV :@¡ª¾» !¼²€8øÄ @S­Ú­ÿžÄàL{á ..è…™jÕ¾Ù;@\\ÐÊãa8€¹ D­@¼\ÐÊreßqÐ QõÝø0Ü ûˆ“OÜ  V ~.èeh„s€¸¹ dN­@\Ðòça8€è«úîmáÂŽâ' ä­µ_€4虪ú®Q«ÄdH­@z\ÐòÔ çiqAÈLÕw¯C_ì -.èùñ0@‚t€ŒT}w©V M>qÈÄô0Ü—ÛÒ䂽p.t€ T}÷rºž{¹ Q.èyP«8t€ÄU}÷&„ÐÛ#@Ú\ÐÒ§V :@¦ZµWv>Ÿ¸$jªU»õßs€<¸ ¤k/œäà AS­Ú7»ȇ :@š®ì /:@b¦Zµ {È‹€×s€ è ©ún|î…äÇ#q‰P«7t€t4Â9@¾\ÐPõÝë»ȗ :@Z{È›€¹ªïÞªUÈŸ€?×s€è«ú®Q«PÄDJ­@Y\ÐâÕ çåpAˆPÕwoB½Ý”à N½”E@ˆLÕw—jÕÊãw€ˆLÃÝx¹ <.èqÙ çerAˆDÕw/Cßì L.èñhí \.èP«€ :@\Ï ' llªU{eeó‰;À†¦ZµÛ¿ì l.èÛj„s‚ :ÀvÔªð+t€í\™=?è˜jÕ.Ì€t€m¸žð`eUßíC/Ì€_y$`EjÕxŒ :ÀºZဇ¸ ¬¤ê»×!„/æ ÀC\ÐÖÓš5ÐVPõÝ[µj<Å'î ›†»ñr;OqAXžZ5žå‚° ªï^N×s/·ð$t€e5Â9‡pAXHÕwoB½ùpt€å4f À¡t€T}w©V €cøÄ`fS­Ú­ÿžp t€ùí…sŽå‚0£©Ví›™p,t€yµæ À)\Ðf¢V €s¸ ÌÇõ€“ è3¨ún|î•Yp*Ÿ¸œI­spA8_#œp.t€3¨U`..èç¹2?æ  œhªU»0?æ  œÎõ€Ùè'¨ún|î…Ù0ÄI­KpA8^+œ07t€#T}÷:„ðÅ̘› :ÀqZó` :Àª¾»T«ÀR|âp€éa¸/·°t€Ãì…s–ä‚ðŒªï^N×s/·°t€ç5Â9KsAxBÕwoB½°4t€§©U`:À#¦ZµWæÀ|âð€©VíÖÏX‹ :ÀÃöÂ9krAøÃT«öÍ\X“ :Àß< Àê\Ð~¡V €­¸ üîÊ<Ø‚€0©ún|î…y°Ÿ¸¨U .èß5Â9[rAЧV €¸ x€è@Ѫ¾{B¸(}lO@J×–>â  Ūú®Q«@,<I­±qAJÕ çÄÄ(NÕwoB½Ít D­(JÕw—jÕˆ‘OÜbLÃÝx¹€¹ %Ù çÄÊ(BÕw/§ë¹—Ûˆ’ :P µjDÍÈžZ5Rà‚” µeb' Y›jÕ^Ù2±ó‰;­©VíÖÏH :³½p@*\Ð,Mµjßl€T¸ ¹º²YR" Ù™jÕ.l€”è@Ž\ÏHŽ€d¥ê»ña¸¶ @j<dC­)sArÒç¤ÊÈBÕw¯C_l€T¹ ¹hm€” è@òª¾{«V €Ô è@\ÏHž€$­ê»F­9ðH¬ªï^†n¼Ü@\Д©U .è@’ª¾{Bèm€\¸ ©jl€œè@rª¾»T«@n|â$¥ê»OÃy¹€¬¸ ©Ù çäÈHÆT«öÍÆÈ‘ :’Ö¶È• :µjäÎH…ë9YÐèMµj¯l €œùĈÚT«vBø—M3t vp@ \Ðh©U $.è@Ì®l€Rè@”¦Zµ Û :+×sŠ" Ñ©ún|î…ÍPÄQQ«@©\ÐØ´Â9%rA¢QõÝë D.è@LZÛ T:…ªïÞªU d>q67= wãåvJæ‚Ä`/œP:t`SUß½œ®ç^n h.èÀÖá\Ð U}÷&„ÐÛ¸ Ûj̾ÐMT}w©V ~ò‰;°º©VíÖÏà't` {á~炬jªUûfêð;t`m­‰Àß\ÐÕ¨U€Ç¹ kr=€GèÀ*ª¾†{eÚð0Ÿ¸‹S«ÏsAÖÐçð4t`QjÕà0.èÀÒ®Lž' ‹©úîmá„ày:°$µjp XDÕwãÃp/Lã‘8`vjÕàx.èÀZáŽã‚̪ê»×!„/¦ ÇqAææa88€̦ê»KµjpŸ¸³˜†»ñr;œÆ˜Ë^8€Ó¹ g«úîåt=÷r;œÈ˜C#œÀy\гT}÷&„Л"œÇ8—Z5˜€œlªU{e‚p>Ÿ¸'™jÕný÷æá‚œj/œÀ|\УMµjßLæã‚œÂÃp03tà(jÕ`.èÀ±®L æ' «ún|î…‰Àü|âD­,Ë8T#œÀr\ÐgU}÷:„ðŤ`9.èÀ!ÔªÀÂtàIUß½ !\˜,K@žãz+ÐGU}רU€ux$xZ5X— :ð˜V8€õ¸ ©úîM¡7X :ðÆT`]:ð›ªï.ÕªÀú|âü¯éa¸/·Àú\Ð_í…s؆ :ð_Uß½œ®ç^n€ ¸ ?¨U€ ¹ jÕ .è@˜®çÀ†t(ÜT«öªô9ÀÖ|â›jÕný÷¶ç‚eÛ çt(ÔT«öÍþ .èP®+»€xèP ©VíÂî :”Éõ"# Caª¾†{aïÄAAÔª@¼\С,­pqrA‡BT}÷:„ðž N.èPŽÖ® ^: ê»·jÕ n:”Áõ"÷?Ußù:Äí.„piG·ÿ±_ˆÞ~ØÕŸ¬ òæwˆÛçaW°#ÈŸ€qÛÛ”A@€x]»úÆ~  :ÄéÞõÊ" @œÚaWÿc7Pâs7ìêÆ^ ,:ÄGç9H@€¸|ÖyeÐ .®çP(âñ~ØÕ·öeÐ c­š‡á `:Äa¯V Ê& Àö¾»úÊ l:loo€€Ûú¨V :lÎõø/¶óN­ðƒ€Û¸ !´fü  À6µjÀ¯tXßgµjÀŸtX_cæÀŸtX×µZ5à!:¬çÞõxŒ€ëiÕªÐ`wîv=% À:öæ {µjÀ©t˜Ç×aW_™%p*æ±7Gà:œï£Z5à\:œçÞõ˜ƒ€çiÕªsÐàtwjÕ€¹èpºF­0NóY­0'NÓ˜0'Žw­V ˜›€ÇQ«,B@€ã´†–  Àáî†]í¿çÀ"t8œOÛÅèp˜±VíƒYKÐà0®çÀ¢txÞûaWߘ°$ž6ÖªyXœ€OkÔªkÐàqc­Zk>ÀtxÜ¥ÙkÐàa‡]ýÉl€µèð0µjÀªtøÛ»aWßš °&~7ÖªyX€¿Û«U¶  ÀO_‡]}eÀtøÉÃpÀftøîZ­°%¾? ט°%BhÕª[Ð(ÝZ5 :¥kÔª1Ð(Ùgµj@,tJ¦V ˆ†€@©ÆZµÛb! P¢{×s 6:%j= ÄF@ 4wînlˆ€@i.mˆ‘€@IÆZµO6ÄH@ $®ç@´tJñ~ØÕ·¶ ÄJ@ c­š‡á€¨ è” Q«ÄN@ w_‡]ÝÚ2;€ÜímH€@Î>ªUR! 3×s :¹z§V H‰€@ŽÆZ5ÃIÐÈÑ^­€Ü|võ•­©ÐÈMc£@Štrr­V H•€@.î]Ï” èä¢U«¤L@ wjÕ€Ô èä@­<€ÔµjlH€@êö6ä@@ ec­Ú 9ÐHÕ½ë9€T5†r" ¢»aW«U²" ¢K[r# š±Ví“­¹ÐHë9%€”¼võ­9ÐHÅX«ÖØ+€TìÕª9ÐHÁ×aW_Ù3€ìm È€@ì>ªUJ  ;×s :1{§V (…€@¬îB­í¥ÐˆU£V (‰€@Œ>«UJ# £ÆV€ÒèÄæZ­P"€˜Ü»ž¥ÐˆI«V (•€@,î†]ízK@ {›J& ƒ±VíƒM%Јë9P<€­½võ-¥ÐØ’Z5€‰€À–šaWÿc:ÛkÕZóøN@`+—&ð“€ÀÆZµO&ð“€À\Ïþ  °¶wî¾5u€ß è¬i¬Uó0ÀtÖ´W«ð0€µ|võ•iªUxš€ÀÒî]Ïž' °´V­Àót–t§V à0:KjÔªF@`)ŸÕªN@`)ÉN@` ×jÕŽ# 07µj'И[ëa8€ã èÌénØÕþ{p€9ù´àD:skÕ>˜&Àitæri’§Ð˜ÃûaWßš$ÀétÎ5ÖªyàL:çjÔªœO@àc­Zk‚çÐ8‡‡áf" pªÃ®þdzóÐ8ÕÞäæ# pŠwjÕæ% p¬±VÍÃp3Ð8Ö^­ÀütŽñuØÕW&0?€cx`!:‡ºV«°€CŒÃ5&°€C´jÕ–% ðœ;µjËÐxŽZ5€è<åó°«?˜Àòtž¢V `%:kÕnL`:¹w=X—€ÀCZìK@àOwînL`]:º4€õ èüj¬Uûd"ëÐø•ë9ÀFt~x?ìê[ÓØ†€@˜jÕ< °!€Q£V `[:_‡]Ý?€ è싟@t€²}T« l®ç‘ÐÊõN­@<t€2µj†ˆˆ€P¦½Z5€¸èåù<ìê+{ˆ‹€PžÆÎâ# ”åZ­@œt€rÜ»žÄK@(G«V ^:@î†]íz1  {{ˆ›€¿±Víƒ=ÄM@ÈŸë9@t€¼µj7v ? _÷®çéÐòÕ »úûHƒ€§±V­µ[€tèyº´W€´èùkÕ>Ù+@Zt€ü¸ž$H@ÈËûaWßÚ)@zt€|Œµj}¤I@ÈÇ^­@ºt€<|võ•]¤K@ÈÃÞÒ& ¤ï£Z5€ô èés=È€€¶wjÕò  ¤ë.„ÐÚ@t€t5jÕò! ¤é³Z5€¼èijì /:@z®ÕªäG@H˽Z5€< èii= ' wîößs€L èéði;@Æt€4Œµjì _:@\Ï2' Äïý°«oì o:@ÜÆZ5Ã@@ˆ[£V   :@¼ÆZµÖ~Ê  ÄëÒnÊ! Äi¬Uûd7åÐâäzP >ï†]}k/eÐâ2Öªy @:@\öjÕÊ$ Äãë°«¯ì L:@<övP. Õª”M@ØÞ½ë9:ÀöZµjèÛºS«@Ð6רU è›ú¬V €t€íx€ÿ% lãzØÕ7fÀ:ÀúÔªð`}­‡áø“€°®»aW7fÀŸt€uù´€ èëkÕ>˜7ÐÖsiÖ»úÊ\X“€ð·ÆLX›€ð»kµjlA@øéÞõ€­è?µjÕØŠ€ðÝݰ«]ÏØŒ€ðÝÞØ’€ð½Víƒ9°%Àõ€è@éÆZµ›Ò‡Àöt d÷®çÄB@JÖ »ú¿b  ¥kÕZÛ :PªK› &:P¢±Ví“Í(‘ë9ÑЀҼvõ­­(ÉX«ÖØ81Ѐ’ìÕª+(Å×aW_Ù6±Ð€Rìm€˜ è@ >ªU v:»{×sR  ¹kÕªÈÙÝÐm€è@εj¤B@rõY­)Ѐ\56 @Jt G×jÕH€äF­IЀܴ† E:“»aWûï9IЀœø´€d è@.ÆZµ¶ @ªt ®ç$M@rð~ØÕ76 @Êt uc­š‡áHž€¤®Q«@t ec­Zkƒä@@Rvi{äB@R5Öª}²=r! ©r= +:¢wî¾µ9r" ©kÕ< @vt 5{µjäH@RòuØÕW6@Žt %{Û W:ŠkµjäL@R0> ר9Ѐ´jÕÈ€ÄîN­%ЀØ5jÕ(€Äì³Z5J! 1S«@1t Vc­ÚíP ˆÑ½ë9¥Ð€µ† 4:›»aW7¶@it 6>m H:“±VíƒP"ˆÉ¥mP*ˆÅûaWßڥЀŒµj† h:ƒF­¥Ð€­}vuk ”N@¶¦V €âØØÇaW²Ð€m¹žÀD@¶òN­ü$ [kÕ< ¿Ð€-ìÕªÀït`mŸ‡]}eêð;X[câð7XÓµZ5x˜€¬åÞõ' kiÕªÀãt` wjÕài:°µjð XÚX«öÁ”ài:°´½ Àót`Ic­Ú Àót`)÷®çp8XJëa88œ€,ánØÕÉÀát` —¦ ÇЀ¹µjŸLŽ# ss=€èÀœÞ»úÖDàx:0—±VÍÃpp"˜Ë^­œN@æðuØÕW& §Ð€9ìMÎ# çú¨V Î' çr=€èÀ9Þ©U€yèÀ©îB­éÀ<tàTZ5˜€œâ³Z5˜—€œ¢15˜—€ëZ­ÌO@ŽqïzËЀc´jÕ`:p¨»aW»žÀBtàP{“€åèÀ!ÆZµ&ËЀC¸žÀÂtà9c­Ú)À²tà)÷®ç°xJ3ìêL–' kÕZÓ€uèÀc.MÖ# kÕ>™ ¬G@âz+Ѐ?½võ­©ÀºtàWc­š‡á`:ð«½Z5؆€üðuØÕW¦ÛЀö&ÛЀÑGµj°-¸w=€í è@«V ¶' @ÙîÔª@t([£V â  @¹>«U€xèP®Æî :”éZ­ÄE@€ò¨U€ èPžÖÃpÊr7ìjÿ=€ èPŸ¶@¤t(ÇX«öÁ¾ N:”Ãõ"& @Þ»úÆ® ^:äo¬Uó0DN@€ü5jÕ ~:äm¬Ukíâ' @Þ.íÒ  @¾>»ú“ý@tÈ—Z5Hˆ€yz7ìê[»€t蟱VÍÃpò³W«éÐ /_‡]}e§òâa8H”€ù¸V«éÐ ãÃp]@ºtÈC«V BøÿÊC޶S•œIEND®B`‚pytest-skip-markers-1.3.0/docs/_static/img/SaltProject_altlogo_teal.png0000644000000000000000000002256714236250622025045 0ustar00rootroot‰PNG  IHDRèd³Nn pHYsýý ˜yj IDATxœíÝÿqÛVö7`d'ÿ;Ëì­ÀÚ ,V`í°+D[å "W`ùÿåDnàK¹‚ÈDj€¯UÁ¾s“ƒ,#ëHäð<3;Ž$‚%ásϽ÷|÷÷ÿûÏ+`¯þæôÀþ 耀 耀 耀 耀 耀 耀 |¿Å!ÜVUuå"=󢪪çòMUU×.88¨ªêÙ&'h›€~µœÎ] O&‹ùiUUo7<äóåtvê‚ðÉb~YUÕ«MN) 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 |ï"ÀÃ&‹ùUU¬yо.§³+§X‡€ÀèLóUU­>VCxùïçÛž“Éb~÷Ÿ¾”࿊¿­ÿ.Ð:ƒ5YÌ"p—?#ˆ¿ÜÓë]}ÞWwÿgúÛì×ñ¸,.§³ë)°:ƒSÑWÂø7!¸žÅq×Çþ¶úãµÕÁý*Bû•ÐÃ# Ð[“żñ£äûªŒïÂjpÿ©ú_h¿¬¦ÈïOÌÔ8JxhÞ‹å.ÇŽe9&8Œ™,æ£z½<ªÌ;wŠþ  Ð+“Åü(ÂÐQ×±*¯ýu<êÀ~½³¯ÞÙ;s–tÆÆÑŽÍ‹z¦Jc ¬YÎ;û÷¹ª*=褕òc¡üQå¼¼‰Ç‡Ébþ%nx.L‡ïN¼7³.§x9YÌU¦úC@ ¥XS^BùI»ªP™òÿsyëÊ^õµ9 @n:;3YÌÏTÍ{åyL}¿´™ÜzZ=¯=‹¶…$% йØ®LiÿÉÙî¥W±™Ü™ lï×rŸ¸†y èt*ÂÀ¥)íƒPX®Æ:í½çÕóš*:@b:Y ç/åÁ¨§½_Œ°;”ÐUÑ’Ðè„p>x¯ÇT‰^ý}¯ž×TÑ’úÞ…¡¯Jõ&nÙ¡åtöóÍS„óQø¼œÎFÑ[;ÞÏC ´¥Š~¶œÎ¾&8‚ :½4YÌ…sHíL8´›ªªÆ´ýd€žÅ÷)‰èô•› Hj²˜—0óÆõ¬ÛÎÇRyhõ¼öf²˜¿Èq(T:}7ÿ*sPÜìbÚóˆ,§³«½ü!VÏWù~HD@§W¢’áfò:x˜»÷Ëéì|,ç`àÕóš*:@":}sêærŠÑz×§åt6¶¿‡^=¯øHB@§7b„ÿ'W Òr“?\_ªª:Ó Žß9cPEHB›5úd4Ó*¡o¢z>”Ñ«J0½o3´òoõ:ìÃ>÷` Õײ)ÜñÛqmÆÖéØa2Ðé…h«fê,äÕ×êù窪®ãqÁûz9]·ù$Q,"¸×¾èÁÀÆñÈ6…«¯×Ø:”*úùr:»Lp,£% ÓªçÔd1?èIõ¼ôÇÕ.Cgþ:ô_Üýÿ1ù"BûA¢É/§³oŽwƺ\ãô‘!쀀Nz“Åüt Sga(2¯Ó½¾óÌUàûª–ÚëÇ>ûÇåtv¶‡çÝ«‘VÏk¯ÊûN`tRI‹軣„Ç_ªå§}n !éÏ 4YÌâ\î`ÐòˈöŽ}³CUt€=ÐÉîL[5È+¦·gû}·œÎ²bªùïÓÍ£º~½íó_fpS¸±WÏkªè{$ “VÜøýF ²ËTi«ƒåàƒÅju=vÐo³ýQÛ›äõÈè¦ô?@]˜öü,'ºOíû¹Ý€ðct2s£ùeº‰?cÕ/¦ñŸGõ÷tËÆÇZ9Y ¯Jªèt®ïï¯ø™‘‚ïÕaùÛØO9ÅZKmÕ ¿IŽðÓHwÿS©z/§³RÑùG™æ3 Öñ±Ïkö[eYÄÇÇP$Øtbc87Ð/“¥VŒ!‚úi ž4 {_"ÜRTÂ2 ŒÍùÖ\éÂËX>À èdt¢­°Ž±WÏïS6y[©¨zäCo­7NS=?Íù² R}G{€ÐI%ÖPj«=iý‹ŠúQl"tsççcܱ½–©z¾²9ßY’*úsUt€ÝÐÉæT[5`] ž›•îïW>ød9]e=æIS=¯ÿ¢Š0^:iÄ ¶¶jÀ&Tùˆiï'QM7òMá²VÏkªè#$ “‰Qz`So¢û ”jzl$7vY(¾¹QEϲ·‚÷ ÀŽè¤£óÚªÛ8W飩x¯dØô¾êy-K0.UtûÃ쀀ÎÞi«½•mírÙ¿âÃd1¿ˆ 'á1éÖžßÁ=K_ôÓø} @‡t28±1ôOâ¿_WUõ[uÓÞùFOªçµ, ÏtY螀Î^E•ë­«½u·mW&%¨ÿ2YÌÿaýÔnï„ôÕóZ²*ú‰*:@·¾w~Ù3SÛ¡ß®’T"Ÿò:o'‹yùÐ/UU]Çñ_×s?ð±èYõ¼vš¤ËI]E·i@Gtö&*Y¯]èµËž~¿ŒÇ_Ž=ÂûMö¯+ëìë_ ò½×›êy­ùÉbþ1IH/Uô3ßÝÐÙ§Q÷ß…¸à…|¾Ra½wð!‚|•ø:¨\Ý÷÷ÒÒ¬ûC¦‰²Ì!IõüÓÕóš*:ÀèìE´kéôXàËéìj²˜ßŒøûùåÊßïm¹æoW*òuh¯ƒ¼ª|Çbít–MÎÖ^Þ¥Š0:;7IFÞa8.ªªúÉõ|Ò³•ÿM˜ ÿ9þóÒÚøÖeéòy‹Y™ªèeá8Á± Š€Î>œj«ƒr& ·æÞ?YÌëêûåJhÏÖ‡>­dÕ󨣊þ)ɾoÊ’ ¦êðжjnäa@’M½ªºúþgp_©¸×ÁýJXzЪ絳D3žª¢´KtvÍÆp0L–­ìÇ«ôü¥ªªß&‹y,9/­Äô«þÃPªçµøŸ›}tçÞÄÀ;-ÐÙ™Éb~ôÐ&J@¿Eåö½Ë¸wÏc&Ǫªþßd1/›øN󃟓!UÏk™Ä δH@g—ÖÞµè•ÓØ©œ<Ê.óo«ªú5ªëgc ëQÝLõ¼¦Š0\:;‘¨÷,БØiüÈùMëyL‡ÿ5*ë'#˜ŸeSÒ6«ç5Ut€Ðé\²õ@‡"„¼sŽÓ+•õŸËŽð±f}pÐxMY6.l=À&¬¢&8€ÞÐÙ…3mÕ`<–ÓY #]ò^x!ö·êCšþž¥ªÛEõ¼¦Š00:Š›=­—`d–ÓÙ±Þ;obú{ï+êC¯ž×’UÑ_©¢lO@§k6†ƒ‘Ò{«®¨÷¹":†êyM`@t:Súðj«ã!]ûµ~z;¿÷jÚûXªçµøÒõó4¤Š°%NÄÆpFÒ Ê&‘?jÁÖKÏcÚ{Ÿ~žg™¹µ‹êy-Ól5¿û¶  Ó•mÕ€Úr:;¯ªê Q¥õ”júEö¶lQ½}àPª]†æøþºÙÕó=A` :­‹é…Úª±œÎ®—ÓÙA´aSMïŸ|/“‡ô,ÕÛ›åtv±ãç´`tºpª­ðhÃV‚ú''©w^f éQµÍ²ïÉÎjÂ*úq‚ãèVÅ ’¶jÀ£¢š~TUÕ4Q›(šÉÒ3UÏÏ÷ôܪè=' Ó6mÕ€ÆÊ&ZËéìPPïßCz–ƒ{õ¼–¬Šþ\`}:­‰_Ä/Q`]+AýÑ;Ýõü^Nó,ƒ²ªçÿ£ŠÐc:­ˆ©ŽªçÀVbê{ì{­ÙìúžÛO“ÅühŸG¨zþWªèý& Ó–ÃmYNg_KЈ]ßKUý}¢ÐÁ_íy=z–Áá Õóš*:@O èl-Úª½u&.DUýd9½ˆ°þoëÕSy¾¯ÖšÉ–V¥ ¢ªèý% Ó†,`à"¬ŸÅzõ¿WUõ/ÕõNöTE·öüa™Žgß³,zC@g+ÉÖþ#Óà/Vªë«]…}·žíºŠUÙç ^{•t÷Y¢Íwþþè+m©ž)Ü ì‡Ëé컪ªþ›Í íÝÛuS=Dù~H¶yë¾fYôÊ÷.›š,æ'‰ªßXNgWUU]­þ{ì›Q‡ñgyØèrkÏÊŽîe¤ë'R=oì,Ñ&®uݦqÐÙHŒ‚û% ôNYÇ^UUy\Þ=öX¶SEx_ýÓRžfJ˵Îz²ß?&‹ù‡ÇÑ¥Š~Õ}î! ³©SÕ&`h–ÓYÚ¿ ïÕ¾TÚˆÇAüs]…¯ÿ>æ™E÷D7{«×TÑž  ³¶¸AýÉ™Æ&¦Ì×­?æ‡^‘/ÓÜ֘½5ªèÐÙD¦MgRjæcJ}࢟¥¯÷¦ï®ûoQ–õÔlîY ²ØÕà:k)Y‹ ÐŽ•)õ ðQ}?ŒÐ~س)Ý/|ÌÚ¢z.Ô ÃOQE¿û‰¸K@g]ªç»»û|ì<_H{Pa?hð1›P=–Óx?°Bt›,æ§6æ¶Qª 6YC©4.§³Rq<ˆÞÖ{]«žÒ? ¾% Óˆ›# %ç¥2}¬Ù@©®/§³rþþQUÕç„ç°‹ ¿êù0Ùðà¦ÎÜÛ˜,æ%œ¿ŽŸ%¥w´%3[ˆªúaòjúÖ š*:À:OŠ]†ß8SÀ¦¢b~÷çHÙ(êÊ úv¢š>än€xØTÑVè4á—'°±äûðÀç¿4å½¥Â|;€×ñ1xc€xØÞD׀ѫtž7ÍÚª‰ï{{€¯¨§¼_ÄtfÖ´œÎ¾Æúþ¡1@<–»Ų›#`#ñ3äbéÉe}úõd1·Þx3—]|Ñ}Q=•W1Ó`ôts¢­°‰ç—ü )aþçX›î†}=_“G[Sí ‹ë Œ^% ó¨\¼u‚€ mÙn«|î¢ìün¹Þ¹Úö€UÏGI½J@çÖƒ™,æ§-†«òu~ÔÉnÚ¨ä«¦Ž“ëŒž€Î7bûµ3¬+6–ìbö þ´,;áoUA×ÚsÔTÑÑйê9°¶Ø±ý¡vjm©ƒú…ùÿ‰‘,{†l;Å]uÜ\`Ôtþ"nò¶Y7 ŒP„ó]î"þ:Ö¨ÿ¾ëû˜Û³Å¹Ï4°ºq@A­=ÇíUÜ‹ŒÒ÷.;µ¸ÁU=Ö?;Î×h§Ö¦R5þ9v~ÿmÝ.¢/øà­ ŒìãÜßçf9]oñùª§Tñ>b_ÿGMóAµJÜ¥åtfFƒ! ³ê4ÑMÐIfÞ¼ŽÇ‡1„õØŒ/[·‹M?QõœÏK}9-¤{ÿ:ˆM—~r:€u”MÛ’ÞT®†õ//—ÓY¯+T1[¡Lÿ=I´æ|Õ6çWõœU£¬¢èÔüÖRÖ~÷d·í—ñx;YÌËŽ YÖJ_m9%»sÊKuù(ùù.ÓÛ7ª «žs±VÑ‘Ðqc¬m²˜ÅÚï>zµú3o²˜ßÖa½ªªëúÏ}÷ø™\f5D0ïËÆÛ)ûŸpUt`tô–Äñ¾öæõËh,6&ÒÏgwC{õÇë,ÜDhÿº²;ùׇv*_B•³üûwþ~Ðó}@6zO$ìò%®ñX½H´|B½=Ç 7ë!¯dŸV ÷‰Ð™i×ð®=_ +¯Ÿz®õcôq‹Ÿi™Öž—iú ªŒBÌàX$z­g“Å|4ôA‡Ý{'œÓG# ç4·QÈŽêy¦ÍîF¿Q]ÌùœàPjÏbSD€QÐa·n­µ¤ÇÎ{´šÝÙfÐ1[õÜTê?d¨8‰B€ÁÐa·NLÓ£ÇÎc j7›:ªžç¥Š°?:ìÎÕú,ZhÆ&ZPo1è¨zž›*:Àè°;Fÿé½åtv›h½w5Gïýê®õëˆúªç‰©¢쇀»ñiÓYÈh9•å™ò>ZŸã=°¶¨‚ªž÷ƒ*:ÀŽ èн[£þ QLy/=“?¹À£R–8mñ‚O’uP=@Ò*ºë š€Ý;ÓV¡*ë—ÓÙ‘júhÜn³î<ªŸ™,UÏŸ–-ÿ4YÌ_$8€NèЭw8†>Y©¦[›>\%œ–}¶x…ªç=Uô›dGíºƒ% C·NµUc,¢š^Ø?“M‹e{_¶ çªç½–-¿QE†J@‡î|vóÇÅNï¥Û +o¬oëpTÏ{*~—©¢쀀ݱ1£Vnê—ÓY©rýÛúôÞúXÚêm;Hõ|TÑv@@‡n|l¡Úƒ°œÎÎb}ú;A½7Êuúq9·tÀgɪçöY“*:ÀnèÐ>mÕàŽXŸ~ºÔM}Ï«ìpÐV…9ªœo½Úò3Zõ|3«è Ž 5:´ïÌÆpp¿:¨ÇÔwkÔs©«æ‡-·†ÌêüŒÞPÒ*ºÙÀ èЮ›¨OXY£>-ËBœ¯½*³^´½.;iõ\ ÛN¶ßq¯&‹ùa‚ãh…€í2µÖTú,ÇZç˜þ¾se`ä1«¡‹ª²êùÀX‹Ð-ÚSÚª]8Ÿ°™2­zeú{]U·©\ûÊ9}Áü¸åéìR=4Ut€Ž|ïÄBkÚÚíF¯TÕ«ª*ôŽªªª™vï››V;ª"«žT©¢Oór}Ÿ'z…åx„t ÷thÇû®ªP0v13å÷Ù)Q%«Ãz¦pU½cùù.[?ÆuR=¶ˆ?$z…¿WÑcp ·tØÞ­õo°+•õ“˜B]öCÕõ?ÝÄ€Æå—ݨžœ*:@7tØ^W›+ˆY+çuOëè‡|7èåÏ—#9·1hqÓ×÷>›§´jÛ÷1нØ/¢×bÐï;oÖ]{hh€Û)mÕL›„b ÷ÕJ`ÿa%°¿Phÿ\UÕuò«]N]º% Ãvl IÅÌ–?7›«E¥ý‡îuˆÿ!Yx¿Á†¯ñgy\ ã0l:lî“Íh VBî½ß¿+íšêð^»oÚv“`ï»VŸ¿ã_…p/6wâÜÁðÜxÛ×&kÀýÍE‡¼ÓV h“€ëÓOh€ë;ÑV h›€ëù²œÎÎ3 m:¬ÇÆp@'thj@Wth¦l wê\]С™3mÕ€. èð´mÕ€® èð4mՀΠèð¸ÏËéìÂ9º& Ãã´UvB@‡‡•¶jWΰ :ÜïVõØ%îwfc8`—tøÖÍr:;u^€]Ðá[ÇÎ °k:üUi«v霻& Ã_©ž{! Ãÿ¼_Ng×ΰ:ü¡´U³1°7:üáT[5`Ÿt¨ª/ËéìÌyöI@‡ª:q€}лOÚªèŒê9‚€Î˜½ÓV ÈB@g¬J[5ÃièŒÕ‰¶j@&:côy9»ò@&:ctêªÙèŒÍGmÕ€ŒtÆäVõÈJ@gLδU²Ð‹›åt¦z¤% 3'®4™€Î”¶j®4Ù÷®# z@oLóUU•ÇAUU?Äq×ÿV¬v#¹ªªê«%Lóƒ•÷Mí0þ¼ŽGï™+ûò@N:CWÚª]¹ÊÀXLó]í·Qáu7ùPÛþºèìu45YÌK?Š0UÏŸøÔWwÿa²˜—?>Çë¹èÃニïÕrmÎ;üú»pÞá÷ÉQ<¾yOÜqß{¦t·)3 /7=Ç÷|Í㕤 6~ÿÀ¾è Ù­ê90Bowô’ž•›üó«¸/öð:n"Üží*ÜFÀ:€õ¬…/ù*oãõœ&'M®qtØô5ìê=ô”Ë•êõÖ&‹ùa¼ož åO)ï¹7å1YÌÏâ;V¦°—÷fù^ë —÷àOeê{¢™0J:CUÚª¹º;õ<‚zßþ¾êêuDX¾Ž`¾ åšü2YÌ/b*==¡ù×T§ŸÅ Œ«XÓ였ÎPíjí"ßú)*Ä}×êëˆõ¹¿tT1Êë2ÕZHïŸxîzºþËx¿¸Ÿ‚ТÏv³Ø»7™*ÛÊ눠ó¡CÚØK!½_"œïj¶Å]Ïb™„;$ 3D~‘äð66Bë»­^G¬gßw8¯½¼Ó¦¤b`h_á|ÕÓÝawìâÎм××àI·Ñ y]›¬=ípàôKé¾ÁçíìuDµúbƒç«âõÕ;€¯^¯¢×õA´e[wÊüËþ–Ó™ÍÀªê¦ÍÖ°ö{4ñ&ÓÚoã=sU÷È_ù‡[¼g.’µOƒÁÐ’Û¸àqWËél£]ÊWz”7 ]î ~²é’¦•×qÒ0¬lú:š~ýZù]vÖ wöŸ¡?6ž;Ysàá¤LŸ6¨ýûyÎxï°î…MÚêýù½ÓÖOôܯb ¨iÛÚ“@ZG4ø¹ÁÇÿ{ƒEÝ|è!9ÑV  [èNWÚ==åY©xS+¯ã"vÇnýuDõ¼i°©¢góѺ¿Ë–ÓYy ºÎ<‹c[çøØX±Î`Ë»uJ÷þÙ#Óè×É÷ùd1oú¡Wöb ¬Ag(¾¬ó €íÄò§†_$í¦d(ºzÇkTÏ?–Y Û 4ÇïÁèÂ7=>òYçºü¸é €ò^[Ngå¹>Þù_7ñu_¸·‚ÝÐ €ÝKUßBW¯£é´ø›¶~Å€CÓÀö,¦Ç“KÓkò©!ý³`9è Á'SžH¨é4åV—h-§³³X7܄ݹ‰ÍášÎºhsÄ‘`9XƒÎ¨žìÇPÂ]ëS½×hKukÈÛvÖ°µÛF›Hi¡·ÉnéZNgßmñéMß7ŸZÔ±‡$! Ówïì@ °{±‘Õë†Oœr*|lâvÖp'ëjÍÙZM׫w5¬é×M»?ÀH5mefæ ”€ÞžëX¿Ãî|Ý  [Ø ÍÚM‡Õ¹ƒ5v€^uAèhMÜÖ|ަA«“Aæ2xÝðܼìâùéÜPöîÐ[kv¬Û ¢MÚºÖiýTëòwc“ÞÉmY÷u4 èð'ÆçÙ†a{]·™éôÞf¤ì‚]Ü€®`ó©/k´-[µ×@ëë›hÚ3\ì% ]ø±£ÝÉwéSY¯Þñ CW}È›îξ—µÌk Ø]ü~cß}Ëw M·Q9ïs8¿ÞäÛ¬Ÿo|_–÷:èHÒ4øï«JÓvb] ”n0›ÌèÊeà ´™…aRAÚPBí»²9ZÃy™Îþc¼†­6·‹ªû—†Þê:ýèÁþ¦á‡ïk*~W3ú®é€ÄóÉbÞZ@Ÿ,æG“Åü<º4{¤‚lêKŠ‹=…ò›àÖh%v±m0¿ã²ás¿ž,æÇm‚ݳ^[{jý=îe„Äã&!q²˜Ÿ®1hñi]6q±Æµ¬Czùø³¦ç+YNžXï^õ÷›Ì”6# ƒÓ†ï©>äb›ªä%ýºÆÇ¿Ž)ïŸâxïÂë0GkT¤kŸ×„(ç$ÂãÝsXBú¯qÌqÌ×+ŸwÇy²æqîbÙÄa ti­Yñ~-ÇôsÃOyAû¤¬#_yßü%PÇ{æ Þ/Çk 攕ãrUÓ¡{:0xQÍ.ÁdÑàµ>‹~°mÕ0ž÷ýUãÚëx”`µÍ!Üç6Zc1ÀñÔ´ë6ùKËû<äÕ36õyÍ}Êûæ,Þ¯ëÛ³xŸýþ^kù}s.œÃnØÅ…¨ÿØðµ>©ÃMûu?h9DHËâx°ÕÜ&k¢Û¤…Ø•îÛÇñ%ÞÃÀèÀhDUöcÃ×ûrÝÊç#ŽÖh»Ö¥{ÐïÝÈöH¸WÌÞ8ÜsHÿÇ숀ŒÊr:+Óµ?5|ͯc]ïVVÂVÓÁ¶•7ÝdÚx씿«ãþØdgþ±ˆý÷4¸ó~9­»C?°%£ã5BÏ›Xƒ½•tbpà_;®Š–*èÁ6Ué8î;>îwñ<üõÜ×!ýýŽÎËMyšÖû! £UÁuÖø~h#¤WÎûút³ñ5x±rþËã‡Øàð>å=óuåýbp:Ps7mᨂD¦Þ„¦Ùñ`?×àºÅnÀžYƒ 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 耀 |÷÷ÿûÏ]Ø/tH@@€tH@@€tH@@€tH@@€tH@@€tH@@€tH@@€}«ªêÿm<¦¿E3IEND®B`‚pytest-skip-markers-1.3.0/docs/changelog.rst0000644000000000000000000000003614236250622017621 0ustar00rootroot.. include:: ../CHANGELOG.rst pytest-skip-markers-1.3.0/docs/conf.py0000644000000000000000000001702014236250622016440 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # # 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 from sphinx.directives.code import LiteralInclude try: from importlib.metadata import version as pkg_version except ImportError: from importlib_metadata import version as pkg_version try: DOCS_BASEPATH = pathlib.Path(__file__).resolve().parent except NameError: # sphinx-intl and six execute some code which will raise this NameError # assume we're in the doc/ directory DOCS_BASEPATH = pathlib.Path(".").resolve().parent REPO_ROOT = DOCS_BASEPATH.parent addtl_paths = ( DOCS_BASEPATH / "_ext", # custom Sphinx extensions REPO_ROOT / "src", # pytestskipmarkers itself (for autodoc) ) for addtl_path in addtl_paths: sys.path.insert(0, str(addtl_path)) # -- Project information ----------------------------------------------------- this_year = datetime.datetime.today().year if this_year == 2020: copyright_year = 2020 else: copyright_year = f"2020 - {this_year}" project = "PyTest Skip Markers" copyright = f"{copyright_year}, VMware, Inc." author = "VMware, Inc." # The full version, including alpha/beta/rc tags release = pkg_version("pytest-skip-markers") # 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.ext.autodoc", "sphinx.ext.autosummary", "sphinx_copybutton", # "sphinx.ext.napoleon", "sphinx.ext.intersphinx", "sphinx.ext.viewcode", "sphinx.ext.todo", "sphinx.ext.coverage", "sphinxcontrib.spelling", "sphinxcontrib.towncrier", ] # 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 modindex_common_prefix = ["pytestskipmarkers."] master_doc = "contents" # -- 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 = "furo" html_title = project html_theme_options = { "light_logo": "img/SaltProject_altlogo_teal.png", "dark_logo": "img/SaltProject_altlogo_teal.png", "announcement": None, } # 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"] # These paths are either relative to html_static_path # or fully qualified paths (eg. https://...) html_css_files = [ "css/inline-include.css", ] # 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 = "_static/img/SaltProject_Logomark_teal.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://docs.pytest.org/en/stable/", None), "salt": ("https://docs.saltproject.io/en/latest", None), "psutil": ("https://psutil.readthedocs.io/en/latest/", None), "coverage": ("https://coverage.readthedocs.io/en/latest/", None), } # <---- Intersphinx Config ----------------------------------------------------------------------------------------- # ----- Autodoc Config ----------------------------------------------------------------------------------------------> autodoc_default_options = {"member-order": "bysource"} autodoc_mock_imports = ["salt"] autodoc_typehints = "description" # <---- Autodoc Config ----------------------------------------------------------------------------------------------- # ----- Towncrier Draft Release -------------------------------------------------------------------------------------> # Options: draft/sphinx-version/sphinx-release towncrier_draft_autoversion_mode = "draft" towncrier_draft_include_empty = True towncrier_draft_working_directory = REPO_ROOT # Not yet supported: # towncrier_draft_config_path = 'pyproject.toml' # relative to cwd # <---- Towncrier Draft Release -------------------------------------------------------------------------------------- # ----- Literal Include - Auto Caption ------------------------------------------------------------------------------> class IncludeExample(LiteralInclude): """ The first argument to the directive is the file path relative to the repository root .. code-block:: rst .. include-example:: relative/path/to/example.py """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.example_file = self.arguments[0] # Get the current doc path relative to the docs directory rel_current_source = os.path.relpath(DOCS_BASEPATH, self.state.document.current_source) # Now, the passed filename, relative to the current doc, so that including it actually works self.arguments[0] = os.path.join(rel_current_source, self.example_file) def run(self): if "caption" not in self.options: self.options["caption"] = self.example_file if "name" not in self.options: self.options["name"] = self.example_file return super().run() # <---- Literal Include - Auto Caption ------------------------------------------------------------------------------- def setup(app): app.add_directive("include-example", IncludeExample) app.add_crossref_type( directivename="fixture", rolename="fixture", indextemplate="pair: %s; fixture", ) # Allow linking to pytest's confvals. app.add_object_type( "confval", "pytest-confval", objname="configuration value", indextemplate="pair: %s; configuration value", ) pytest-skip-markers-1.3.0/docs/contents.rst0000644000000000000000000000040214236250622017524 0ustar00rootroot.. _table-of-contents: ================= Table Of Contents ================= .. toctree:: :maxdepth: 3 ref/pytestskipmarkers/plugin ref/pytestskipmarkers/index changelog GitHub Repository pytest-skip-markers-1.3.0/docs/index.rst0000644000000000000000000000106114236250622017000 0ustar00rootroot:orphan: .. _about: .. include:: ../README.rst :start-after: include-starts-here :end-before: include-ends-here Documentation ============= Please see :ref:`Contents ` for full documentation, including installation and tutorials. Bugs/Requests ============= Please use the `GitHub issue tracker`_ to submit bugs or request features. Changelog ========= Consult the :ref:`Changelog ` page for fixes and enhancements of each version. .. _GitHub issue tracker: https://github.com/saltstack/pytest-skip-markers/issues pytest-skip-markers-1.3.0/docs/make.bat0000644000000000000000000000137014236250622016547 0ustar00rootroot@ECHO OFF pushd %~dp0 REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set SOURCEDIR=. set BUILDDIR=_build if "%1" == "" goto help %SPHINXBUILD% >NUL 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 ) %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% goto end :help %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% :end popd pytest-skip-markers-1.3.0/docs/ref/0000755000000000000000000000000014236250622015715 5ustar00rootrootpytest-skip-markers-1.3.0/docs/ref/pytestskipmarkers/0000755000000000000000000000000014236250622021521 5ustar00rootrootpytest-skip-markers-1.3.0/docs/ref/pytestskipmarkers/index.rst0000644000000000000000000000021114236250622023354 0ustar00rootroot========================== PyTest Skip Makers Package ========================== .. toctree:: :maxdepth: 2 plugin utils/index pytest-skip-markers-1.3.0/docs/ref/pytestskipmarkers/plugin.rst0000644000000000000000000003610314236250622023554 0ustar00rootroot======= Markers ======= .. _markers.destructive_test: ``destructive_test`` ==================== .. py:decorator:: pytest.mark.destructive_test Skip the test if ``--run-destructive`` is not passed to pytest on the CLI. Use this mark when the test does something destructive to the system where the tests are running, for example, adding or removing a user, changing a user password. .. admonition:: Note Do not use this marker if all the test does is add/remove/change files in the test suite temporary directory .. code-block:: python @pytest.mark.destructive_test def test_func(): assert True .. _markers.expensive_test: ``expensive_test`` ================== .. py:decorator:: pytest.mark.expensive_test Skip the test if ``--run-expensive`` is not passed to pytest on the CLI. Use this test when the test does something expensive(as in monetary expensive), like creating a virtual machine on a cloud provider, etc. .. code-block:: python @pytest.mark.expensive_test def test_func(): assert True .. _markers.skip_if_not_root: ``skip_if_not_root`` ==================== .. py:decorator:: pytest.mark.skip_if_not_root Skip the test if the user running the test suite is not ``root`` or ``Administrator`` on Windows. .. code-block:: python @pytest.mark.skip_if_not_root def test_func(): assert True Look :py:func:`here ` for the full function signature. .. _markers.skip_if_binaries_missing: ``skip_if_binaries_missing`` ============================ .. py:decorator:: pytest.mark.skip_if_binaries_missing(\*binaries, check_all=True, reason=None) :param str binaries: Any argument passed must be a :py:class:`str` which is the name of the binary check for presence in the path. Multiple arguments can be passed. :keyword bool check_all: If ``check_all`` is :py:const:`True`, the default, all binaries must exist. If ``check_all`` is :py:class:`False`, then only one the passed binaries needs to be found. Useful when, for example, passing a list of python interpreter names(python3.5, python3, python), where only one needs to exist. :keyword str reason: The skip reason. Skip tests if binaries are not found in path. .. code-block:: python @pytest.mark.skip_if_binaries_missing("sshd") def test_func(): assert True @pytest.mark.skip_if_binaries_missing("python3.7", "python3", "python", check_all=False) def test_func(): assert True Look :py:func:`here ` for the full function signature. .. _markers.requires_network: ``requires_network`` ==================== .. _markers.skip_on_windows: ``skip_on_windows`` =================== .. py:decorator:: pytest.mark.skip_on_windows(reason=None) :keyword str reason: The skip reason Skip test if test suite is running on windows. .. code-block:: python @pytest.mark.skip_on_windows def test_func(): assert True .. _markers.skip_unless_on_windows: ``skip_unless_on_windows`` ========================== .. py:decorator:: pytest.mark.skip_unless_on_windows(reason=None) :keyword str reason: The skip reason Skip test unless the test suite is running on windows. .. code-block:: python @pytest.mark.skip_unless_on_windows def test_func(): assert True .. _markers.skip_on_linux: ``skip_on_linux`` ================= .. py:decorator:: pytest.mark.skip_on_linux(reason=None) :keyword str reason: The skip reason Skip test if test suite is running on linux. .. code-block:: python @pytest.mark.skip_on_linux def test_func(): assert True .. _markers.skip_unless_on_linux: ``skip_unless_on_linux`` ======================== .. py:decorator:: pytest.mark.skip_unless_on_linux(reason=None) :keyword str reason: The skip reason Skip test unless the test suite is running on linux. .. code-block:: python @pytest.mark.skip_unless_on_linux def test_func(): assert True .. _markers.skip_on_darwin: ``skip_on_darwin`` ================== .. py:decorator:: pytest.mark.skip_on_darwin(reason=None) :keyword str reason: The skip reason Skip test if test suite is running on darwin. .. code-block:: python @pytest.mark.skip_on_darwin def test_func(): assert True .. _markers.skip_unless_on_darwin: ``skip_unless_on_darwin`` ========================= .. py:decorator:: pytest.mark.skip_unless_on_darwin(reason=None) :keyword str reason: The skip reason Skip test unless the test suite is running on darwin. .. code-block:: python @pytest.mark.skip_unless_on_darwin def test_func(): assert True .. _markers.skip_on_sunos: ``skip_on_sunos`` ================= .. py:decorator:: pytest.mark.skip_on_sunos(reason=None) :keyword str reason: The skip reason Skip test if test suite is running on sunos. .. code-block:: python @pytest.mark.skip_on_sunos def test_func(): assert True .. _markers.skip_unless_on_sunos: ``skip_unless_on_sunos`` ======================== .. py:decorator:: pytest.mark.skip_unless_on_sunos(reason=None) :keyword str reason: The skip reason Skip test unless the test suite is running on sunos. .. code-block:: python @pytest.mark.skip_unless_on_sunos def test_func(): assert True .. _markers.skip_on_smartos: ``skip_on_smartos`` =================== .. py:decorator:: pytest.mark.skip_on_smartos(reason=None) :keyword str reason: The skip reason Skip test if test suite is running on smartos. .. code-block:: python @pytest.mark.skip_on_smartos def test_func(): assert True .. _markers.skip_unless_on_smartos: ``skip_unless_on_smartos`` ========================== .. py:decorator:: pytest.mark.skip_unless_on_smartos(reason=None) :keyword str reason: The skip reason Skip test unless the test suite is running on smartos. .. code-block:: python @pytest.mark.skip_unless_on_smartos def test_func(): assert True .. _markers.skip_on_freebsd: ``skip_on_freebsd`` =================== .. py:decorator:: pytest.mark.skip_on_freebsd(reason=None) :keyword str reason: The skip reason Skip test if test suite is running on freebsd. .. code-block:: python @pytest.mark.skip_on_freebsd def test_func(): assert True .. _markers.skip_unless_on_freebsd: ``skip_unless_on_freebsd`` ========================== .. py:decorator:: pytest.mark.skip_unless_on_freebsd(reason=None) :keyword str reason: The skip reason Skip test unless the test suite is running on freebsd. .. code-block:: python @pytest.mark.skip_unless_on_freebsd def test_func(): assert True .. _markers.skip_on_netbsd: ``skip_on_netbsd`` ================== .. py:decorator:: pytest.mark.skip_on_netbsd(reason=None) :keyword str reason: The skip reason Skip test if test suite is running on netbsd. .. code-block:: python @pytest.mark.skip_on_netbsd def test_func(): assert True .. _markers.skip_unless_on_netbsd: ``skip_unless_on_netbsd`` ========================= .. py:decorator:: pytest.mark.skip_unless_on_netbsd(reason=None) :keyword str reason: The skip reason Skip test unless the test suite is running on netbsd. .. code-block:: python @pytest.mark.skip_unless_on_netbsd def test_func(): assert True .. _markers.skip_on_openbsd: ``skip_on_openbsd`` =================== .. py:decorator:: pytest.mark.skip_on_openbsd(reason=None) :keyword str reason: The skip reason Skip test if test suite is running on openbsd. .. code-block:: python @pytest.mark.skip_on_openbsd def test_func(): assert True .. _markers.skip_unless_on_openbsd: ``skip_unless_on_openbsd`` ========================== .. py:decorator:: pytest.mark.skip_unless_on_openbsd(reason=None) :keyword str reason: The skip reason Skip test unless the test suite is running on openbsd. .. code-block:: python @pytest.mark.skip_unless_on_openbsd def test_func(): assert True .. _markers.skip_on_aix: ``skip_on_aix`` =============== .. py:decorator:: pytest.mark.skip_on_aix(reason=None) :keyword str reason: The skip reason Skip test if test suite is running on aix. .. code-block:: python @pytest.mark.skip_on_aix def test_func(): assert True .. _markers.skip_unless_on_aix: ``skip_unless_on_aix`` ====================== .. py:decorator:: pytest.mark.skip_unless_on_aix(reason=None) :keyword str reason: The skip reason Skip test unless the test suite is running on aix. .. code-block:: python @pytest.mark.skip_unless_on_aix def test_func(): assert True .. _markers.skip_on_aarch64: ``skip_on_aarch64`` =================== .. py:decorator:: pytest.mark.skip_on_aarch64(reason=None) :keyword str reason: The skip reason Skip test if test suite is running on aarch64. .. code-block:: python @pytest.mark.skip_on_aarch64 def test_func(): assert True .. _markers.skip_unless_on_aarch64: ``skip_unless_on_aarch64`` ========================== .. py:decorator:: pytest.mark.skip_unless_on_aarch64(reason=None) :keyword str reason: The skip reason Skip test unless the test suite is running on aarch64. .. code-block:: python @pytest.mark.skip_unless_on_aarch64 def test_func(): assert True .. _markers.skip_on_photonos: ``skip_on_photonos`` ==================== .. py:decorator:: pytest.mark.skip_on_photonos(reason=None) :keyword str reason: The skip reason Skip test if test suite is running on PhotonOS. .. code-block:: python @pytest.mark.skip_on_photonos def test_func(): assert True .. _markers.skip_unless_on_photonos: ``skip_unless_on_photonos`` =========================== .. py:decorator:: pytest.mark.skip_unless_on_photonos(reason=None) :keyword str reason: The skip reason Skip test unless the test suite is running on PhotonOS. .. code-block:: python @pytest.mark.skip_unless_on_photonos def test_func(): assert True .. _markers.skip_on_spawning_platform: ``skip_on_spawning_platform`` ============================= .. py:decorator:: pytest.mark.skip_on_spawning_platform(reason=None) :keyword str reason: The skip reason Skip test if test suite is running on a platfor which defaults multiprocessing to ``spawn``. .. code-block:: python @pytest.mark.skip_on_spawning_platform def test_func(): assert True .. _markers.skip_unless_on_spawning_platform: ``skip_unless_on_spawning_platform`` ==================================== .. py:decorator:: pytest.mark.skip_unless_on_spawning_platform(reason=None) :keyword str reason: The skip reason Skip test unless the test suite is not running on a platform which defaults multiprocessing to ``spawn``. .. code-block:: python @pytest.mark.skip_unless_on_spawning_platform def test_func(): assert True .. _markers.skip_on_env: ``skip_on_env`` =============== .. py:decorator:: pytest.mark.skip_on_env(envvar, present=True, eq=None, ne=None) :keyword str varname: The environment variable to check :keyword bool present: When ``True``, skip if variable is present in the environment. When ``False``, skip if variable is not present in the environment. :keyword str eq: Skips when the variable is present in the environment and matches this value. :keyword str ne: Skips when the variable is present in the environment and does not match this value. :keyword str reason: The skip reason Skip test based on the presence/absence of `envvar` in the environment and it's value. .. code-block:: python @pytest.mark.skip_on_env("FLAKY_TEST") def test_func(): assert True @pytest.mark.skip_on_env("FLAKY_TEST", eq="1") def test_func(): assert True @pytest.mark.skip_on_env("FLAKY_TEST", present=False) def test_func(): assert True .. _markers.skip_on_platforms: ``skip_on_platforms`` ===================== .. py:decorator:: pytest.mark.skip_on_platforms(**platforms, reason=None) :keyword bool windows: Skip on windows if :py:const:`True` :keyword bool linux: Skip on linux if :py:const:`True` :keyword bool darwin: Skip on darwin if :py:const:`True` :keyword bool sunos: Skip on sunos if :py:const:`True` :keyword bool smartos: Skip on smartos if :py:const:`True` :keyword bool freebsd: Skip on freebsd if :py:const:`True` :keyword bool netbsd: Skip on netbsd if :py:const:`True` :keyword bool openbsd: Skip on openbsd if :py:const:`True` :keyword bool aix: Skip on aix if :py:const:`True` :keyword bool aarch64: Skip on aarch64 if :py:const:`True` :keyword bool photonos: Skip on photonos if :py:const:`True` :keyword bool spawning: Skip on platforms for which multiprocessing defaults to ``spawn`` if :py:const:`True` :keyword str reason: The skip reason Pass :py:const:`True` to any of the platforms defined as keyword arguments to skip the test when running on that platform .. code-block:: python @pytest.mark.skip_on_platforms(windows=True, darwin=True) def test_func(): assert True .. _markers.skip_unless_on_platforms: ``skip_unless_on_platforms`` ============================ .. py:decorator:: pytest.mark.skip_unless_on_platforms(**platforms, reason=None) :keyword bool windows: Skip unless on windows if :py:const:`True` :keyword bool linux: Skip unless on linux if :py:const:`True` :keyword bool darwin: Skip unless on darwin if :py:const:`True` :keyword bool sunos: Skip unless on sunos if :py:const:`True` :keyword bool smartos: Skip unless on smartos if :py:const:`True` :keyword bool freebsd: Skip unless on freebsd if :py:const:`True` :keyword bool netbsd: Skip unless on netbsd if :py:const:`True` :keyword bool openbsd: Skip unless on openbsd if :py:const:`True` :keyword bool aix: Skip unless on aix if :py:const:`True` :keyword bool aarch64: Skip on aarch64 if :py:const:`True` :keyword bool photonos: Skip on photonos if :py:const:`True` :keyword bool spawning: Skip on platforms for which multiprocessing does not default to ``spawn`` if :py:const:`True` :keyword str reason: The skip reason Pass :py:const:`True` to any of the platforms defined as keyword arguments to skip the test when not running on that platform .. code-block:: python @pytest.mark.skip_unless_on_platforms(windows=True, darwin=True) def test_func(): assert True pytest-skip-markers-1.3.0/docs/ref/pytestskipmarkers/utils/0000755000000000000000000000000014236250622022661 5ustar00rootrootpytest-skip-markers-1.3.0/docs/ref/pytestskipmarkers/utils/index.rst0000644000000000000000000000025114236250622024520 0ustar00rootroot===== Utils ===== .. automodule:: pytestskipmarkers.utils :members: :show-inheritance: :inherited-members: :no-undoc-members: .. toctree:: :glob: * pytest-skip-markers-1.3.0/docs/ref/pytestskipmarkers/utils/markers.rst0000644000000000000000000000030314236250622025053 0ustar00rootrootPyTest Markers related utilities ================================ .. automodule:: pytestskipmarkers.utils.markers :members: :show-inheritance: :inherited-members: :no-undoc-members: pytest-skip-markers-1.3.0/docs/ref/pytestskipmarkers/utils/platform.rst0000644000000000000000000000027014236250622025236 0ustar00rootrootPlatform related utilities ========================== .. automodule:: pytestskipmarkers.utils.platform :members: :show-inheritance: :inherited-members: :no-undoc-members: pytest-skip-markers-1.3.0/docs/ref/pytestskipmarkers/utils/ports.rst0000644000000000000000000000027714236250622024570 0ustar00rootrootPorts related utility functions =============================== .. automodule:: pytestskipmarkers.utils.ports :members: :show-inheritance: :inherited-members: :no-undoc-members: pytest-skip-markers-1.3.0/docs/sitevars.rst0000644000000000000000000000042114236250622017530 0ustar00rootroot.. |salt| replace:: `Salt`_ .. _salt: https://saltproject.io .. |saltrepo| replace:: `Salt repository`_ .. _Salt repository: https://github.com/saltstack/salt .. |salt-extension| replace:: `salt-extension`_ .. _salt-extension: https://www.youtube.com/watch?v=hhomJkwxK3Q pytest-skip-markers-1.3.0/noxfile.py0000644000000000000000000004503514236250622016236 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # import datetime import gzip import json import os import pathlib import shutil import sys import tarfile 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 = 91 elif IS_DARWIN: COVERAGE_FAIL_UNDER_PERCENT = 93 else: COVERAGE_FAIL_UNDER_PERCENT = 93 # 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)) 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 pytest_version(session): try: return session._runner._pytest_version_info except AttributeError: session_pytest_version = session_run_always( session, "python", "-c", 'import sys, pkg_resources; sys.stdout.write("{}".format(pkg_resources.get_distribution("pytest").version))', silent=True, log=False, ) session._runner._pytest_version_info = tuple( int(part) for part in session_pytest_version.split(".") if part.isdigit() ) return session._runner._pytest_version_info def python_version(session): try: return session._runner._python_version_info except AttributeError: session_python_version = session_run_always( session, "python", "-c", 'import sys; sys.stdout.write("{}.{}.{}".format(*sys.version_info))', silent=True, log=False, ) session._runner._python_version_info = tuple( int(part) for part in session_python_version.split(".") if part.isdigit() ) return session._runner._python_version_info 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) if python_version(session) < (3, 6): # coverage will pull more-itertools and after versions 8.11.0, itertools # is no longer Py3.5 compatible session.install("more-itertools<8.11.0") session.install(COVERAGE_VERSION_REQUIREMENT, silent=PIP_INSTALL_SILENT) pytest_version_requirement = os.environ.get("PYTEST_VERSION_REQUIREMENT") or None if pytest_version_requirement: # Account that, under CI, when we test previous version of pytest # we need to pin pytest-subtests to a lower version so that pytest # itself does not get upgraded pytest_requirements = [] if not pytest_version_requirement.startswith("pytest"): pytest_version_requirement = "pytest{}".format(pytest_version_requirement) pytest_requirements.append(pytest_version_requirement) if pytest_version_requirement.startswith("pytest~=6"): pytest_requirements.append("pytest-subtests<0.7.0") session.install(*pytest_requirements, silent=PIP_INSTALL_SILENT) session.install("-e", ".", silent=PIP_INSTALL_SILENT) session.install("-r", os.path.join("requirements", "base.txt"), 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) if IS_WINDOWS: _python_version = python_version(session) if _python_version > (3, 8) and _python_version < (3, 10): # We skip a lot of tests, so lower the expected code coverage global COVERAGE_FAIL_UNDER_PERCENT COVERAGE_FAIL_UNDER_PERCENT = 50 session.run("coverage", "erase") env.update( { # The full path to the .coverage data file. Makes sure we always write # them to the same directory "COVERAGE_FILE": str(COVERAGE_REPORT_DB), } ) args = [ "--rootdir", str(REPO_ROOT), "--log-file={}".format(RUNTESTS_LOGFILE), "--log-file-level=debug", "--show-capture=no", "--junitxml={}".format(JUNIT_REPORT), "--showlocals", "--strict-markers", "-ra", "-s", ] if pytest_version(session) > (6, 2): args.append("--lsof") 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) try: session.run("coverage", "run", "-m", "pytest", *args, env=env) finally: # Generate report for project code coverage session.run( "coverage", "xml", "-o", str(COVERAGE_REPORT_PROJECT), "--omit=tests/*", "--include=src/pytestskipmarkers/*", ) # Generate report for tests code coverage session.run( "coverage", "xml", "-o", str(COVERAGE_REPORT_TESTS), "--omit=src/pytestskipmarkers/*", "--include=tests/*", ) try: cmdline = [ "coverage", "report", "--show-missing", "--include=src/pytestskipmarkers/*,tests/*", ] if pytest_version(session) >= (6, 2): cmdline.append("--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", encoding="utf-8") 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", "--ignore-paths=src/pytestskipmarkers/downgraded/.*"] if session.posargs: paths = session.posargs else: paths = ["setup.py", "noxfile.py", "src/pytestskipmarkers/"] _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, ) session.install("-e", ".", 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, encoding="utf-8") 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-dev", python="3") def docs_dev(session): """ Build Docs. """ session.install( "--progress-bar=off", "-r", os.path.join("requirements", "docs.txt"), silent=PIP_INSTALL_SILENT, ) session.install("-e", ".", silent=PIP_INSTALL_SILENT) os.chdir("docs/") session.run("make", "html", "SPHINXOPTS=-W", external=True, env={"LOCAL_DEV_BUILD": "1"}) 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, ) session.install("-e", ".", 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, ) session.install("-e", ".", silent=PIP_INSTALL_SILENT) shutil.rmtree("docs/ref", ignore_errors=True) session.run("sphinx-apidoc", "--module-first", "-o", "docs/ref/", "src/pytestskipmarkers/") @nox.session(name="twine-check", python="3") def twine_check(session): """ Run ``twine-check`` against the source distribution package. """ build(session) session.run("twine", "check", "dist/*") @nox.session(name="changelog", python="3") @nox.parametrize("draft", [False, True]) def changelog(session, draft): """ Generate changelog. """ session.install("--progress-bar=off", "-e", ".[changelog]", silent=PIP_INSTALL_SILENT) version = session.run( "python", "setup.py", "--version", silent=True, log=False, stderr=None, ).strip() town_cmd = ["towncrier", "build", "--version={}".format(version)] if draft: town_cmd.append("--draft") session.run(*town_cmd) @nox.session(name="release") def release(session): """ Create a release tag. """ if not session.posargs: session.error( "Forgot to pass the version to release? For example `nox -e release -- 1.1.0`" ) if len(session.posargs) > 1: session.error( "Only one argument is supported by the `release` nox session. " "For example `nox -e release -- 1.1.0`" ) version = session.posargs[0] try: session.log("Generating temporary %s tag", version) session.run("git", "tag", "-as", version, "-m", "Release {}".format(version), external=True) changelog(session, draft=False) except CommandFailed: session.error("Failed to generate the temporary tag") # session.notify("changelog(draft=False)") try: session.log("Generating the release changelog") session.run( "git", "commit", "-a", "-m", "Generate Changelog for version {}".format(version), external=True, ) except CommandFailed: session.error("Failed to generate the release changelog") try: session.log("Overwriting temporary %s tag", version) session.run( "git", "tag", "-fas", version, "-m", "Release {}".format(version), external=True ) except CommandFailed: session.error("Failed to overwrite the temporary tag") session.warn("Don't forget to push the newly created tag") class Recompress: """ Helper class to re-compress a ``.tag.gz`` file to make it reproducible. """ def __init__(self, mtime): self.mtime = int(mtime) def tar_reset(self, tarinfo): """ Reset user, group, mtime, and mode to create reproducible tar. """ tarinfo.uid = tarinfo.gid = 0 tarinfo.uname = tarinfo.gname = "root" tarinfo.mtime = self.mtime if tarinfo.type == tarfile.DIRTYPE: tarinfo.mode = 0o755 else: tarinfo.mode = 0o644 if tarinfo.pax_headers: raise ValueError(tarinfo.name, tarinfo.pax_headers) return tarinfo def recompress(self, targz): """ Re-compress the passed path. """ tempd = pathlib.Path(tempfile.mkdtemp()).resolve() d_src = tempd.joinpath("src") d_src.mkdir() d_tar = tempd.joinpath(targz.stem) d_targz = tempd.joinpath(targz.name) with tarfile.open(d_tar, "w|") as wfile: with tarfile.open(targz, "r:gz") as rfile: rfile.extractall(d_src) extracted_dir = next(pathlib.Path(d_src).iterdir()) for name in sorted(extracted_dir.rglob("*")): wfile.add( str(name), filter=self.tar_reset, recursive=False, arcname=str(name.relative_to(d_src)), ) with open(d_tar, "rb") as rfh: with gzip.GzipFile( fileobj=open(d_targz, "wb"), mode="wb", filename="", mtime=self.mtime ) as gz: while True: chunk = rfh.read(1024) if not chunk: break gz.write(chunk) targz.unlink() shutil.move(str(d_targz), str(targz)) @nox.session(python="3") def build(session): """ Build source and binary distributions based off the current commit author date UNIX timestamp. The reason being, reproducible packages. .. code-block: shell git show -s --format=%at HEAD """ shutil.rmtree("dist/", ignore_errors=True) session.install("--progress-bar=off", "-r", "requirements/build.txt", silent=PIP_INSTALL_SILENT) timestamp = session.run( "git", "show", "-s", "--format=%at", "HEAD", silent=True, log=False, stderr=None, ).strip() env = {"SOURCE_DATE_EPOCH": str(timestamp)} session.run( "python", "-m", "build", "--sdist", "--wheel", str(REPO_ROOT), env=env, ) # Recreate sdist to be reproducible recompress = Recompress(timestamp) for targz in REPO_ROOT.joinpath("dist").glob("*.tar.gz"): session.log("Re-compressing %s...", targz.relative_to(REPO_ROOT)) recompress.recompress(targz) sha256sum = shutil.which("sha256sum") if sha256sum: packages = [str(pkg.relative_to(REPO_ROOT)) for pkg in REPO_ROOT.joinpath("dist").iterdir()] session.run("sha256sum", *packages, external=True) session.run("python", "-m", "twine", "check", "dist/*") pytest-skip-markers-1.3.0/pyproject.toml0000644000000000000000000000233414236250622017127 0ustar00rootroot[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/pytestskipmarkers/version.py" write_to_template = "# pylint: skip-file\n\n__version__ = \"{version}\"\n" [tool.towncrier] package = "pytestskipmarkers" filename = "CHANGELOG.rst" directory = "changelog/" issue_format = "`#{issue} `_" title_format = "{version} ({project_date})" [[tool.towncrier.type]] directory = "breaking" name = "Breaking Changes" showcontent = true [[tool.towncrier.type]] directory = "deprecation" name = "Deprecations" showcontent = true [[tool.towncrier.type]] directory = "feature" name = "Features" showcontent = true [[tool.towncrier.type]] directory = "improvement" name = "Improvements" showcontent = true [[tool.towncrier.type]] directory = "bugfix" name = "Bug Fixes" showcontent = true [[tool.towncrier.type]] directory = "doc" name = "Improved Documentation" showcontent = true [[tool.towncrier.type]] directory = "trivial" name = "Trivial/Internal Changes" showcontent = true pytest-skip-markers-1.3.0/pytest.ini0000644000000000000000000000053414236250622016244 0ustar00rootroot[pytest] log_file_level=debug log_date_format=%H:%M:%S log_cli_format=%(asctime)s,%(msecs)03.0f [%(name)-5s:%(lineno)-4d][%(levelname)-8s][%(processName)18s(%(process)s)] %(message)s log_file_format=%(asctime)s,%(msecs)03d [%(name)-17s:%(lineno)-4d][%(levelname)-8s][%(processName)18s(%(process)d)] %(message)s junit_family=xunit2 testpaths=tests/ pytest-skip-markers-1.3.0/requirements/0000755000000000000000000000000014236250622016734 5ustar00rootrootpytest-skip-markers-1.3.0/requirements/base.txt0000644000000000000000000000010414236250622020402 0ustar00rootrootpytest>=6.0.0 attrs>=19.2.0 pywin32; sys_platform == "win32" distro pytest-skip-markers-1.3.0/requirements/build.txt0000644000000000000000000000002314236250622020567 0ustar00rootroottwine build>=0.7.0 pytest-skip-markers-1.3.0/requirements/changelog.txt0000644000000000000000000000002514236250622021421 0ustar00rootroottowncrier==21.9.0rc1 pytest-skip-markers-1.3.0/requirements/docs.txt0000644000000000000000000000022014236250622020417 0ustar00rootroot-r base.txt -r tests.txt -r changelog.txt furo sphinx sphinx-copybutton sphinx-prompt sphinxcontrib-spelling sphinxcontrib-towncrier >= 0.2.1a0 pytest-skip-markers-1.3.0/requirements/lint.txt0000644000000000000000000000031214236250622020437 0ustar00rootroot-r base.txt -r tests.txt pylint==2.12.2 pyenchant black; python_version >= '3.7' reorder-python-imports; python_version >= '3.7' flake8 >= 4.0.1 flake8-mypy-fork flake8-docstrings flake8-typing-imports pytest-skip-markers-1.3.0/requirements/tests.txt0000644000000000000000000000014114236250622020633 0ustar00rootrootdocker pytest-subtests pyfakefs==4.4.0; python_version == '3.5' pyfakefs; python_version > '3.5' pytest-skip-markers-1.3.0/setup.cfg0000644000000000000000000000510614236250622016034 0ustar00rootroot[metadata] name = pytest-skip-markers description = Pytest Salt Plugin long_description = file: README.rst author = Pedro Algarvio author_email = pedro@algarvio.me url = https://github.com/saltstack/pytest-skip-markers project_urls = Source=https://github.com/saltstack/pytest-skip-markers Tracker=https://github.com/saltstack/pytest-skip-markers/issues Documentation=https://pytest-skip-markers.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 Framework :: Pytest Typing :: Typed 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.2 setup_requires = setuptools>=50.3.2 setuptools_scm[toml]>=3.4 setuptools-declarative-requirements [options.packages.find] where = src exclude = tests* [options.extras_require] docker = docker salt = salt>=3001 [requirements-files] install_requires = requirements/base.txt extras_require = docs = requirements/docs.txt lint = requirements/lint.txt tests = requirements/tests.txt changelog = requirements/changelog.txt [options.entry_points] pytest11 = skip-markers = pytestskipmarkers.plugin [bdist_wheel] universal = false [sdist] owner = root group = root [flake8] max-line-length = 120 exclude = .git, .nox, __pycache__, src/pytestskipmarkers/version.py, build, dist, docs/conf.py, setup.py, .pre-commit-hooks per-file-ignores = __init__.py: F401 noxfile.py: D100,D102,D103,D107,D212,E501 src/pytestskipmarkers/utils/socket.py: F401,F403 tests/*.py: D100,D101,D102,D103 ignore = D104, D107, D212, D200, W503 builtins = __salt__ __opts__ __salt_system_encoding__ docstring-convention = google [mypy] python_version = 3.7 mypy_path = src ignore_missing_imports = True no_implicit_optional = True show_error_codes = True strict_equality = True warn_redundant_casts = True warn_return_any = True warn_unused_configs = True warn_unused_ignores = True disallow_any_generics = True check_untyped_defs = True no_implicit_reexport = True [mypy-pytestskipmarkers.utils.socket] no_implicit_reexport = False [egg_info] tag_build = tag_date = 0 pytest-skip-markers-1.3.0/setup.py0000644000000000000000000000027214236250622015724 0ustar00rootroot#!/usr/bin/env python # Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # import setuptools if __name__ == "__main__": setuptools.setup(use_scm_version=True) pytest-skip-markers-1.3.0/src/0000755000000000000000000000000014236250622015000 5ustar00rootrootpytest-skip-markers-1.3.0/src/pytest_skip_markers.egg-info/0000755000000000000000000000000014236250622022574 5ustar00rootrootpytest-skip-markers-1.3.0/src/pytest_skip_markers.egg-info/PKG-INFO0000644000000000000000000000723414236250622023677 0ustar00rootrootMetadata-Version: 2.1 Name: pytest-skip-markers Version: 1.3.0 Summary: Pytest Salt Plugin Home-page: https://github.com/saltstack/pytest-skip-markers Author: Pedro Algarvio Author-email: pedro@algarvio.me License: Apache Software License 2.0 Project-URL: Source, https://github.com/saltstack/pytest-skip-markers Project-URL: Tracker, https://github.com/saltstack/pytest-skip-markers/issues Project-URL: Documentation, https://pytest-skip-markers.readthedocs.io 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: Framework :: Pytest Classifier: Typing :: Typed Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License Requires-Python: >=3.5.2 Provides-Extra: docker Provides-Extra: salt Provides-Extra: docs Provides-Extra: lint Provides-Extra: tests Provides-Extra: changelog License-File: LICENSE License-File: NOTICE .. image:: https://img.shields.io/github/workflow/status/saltstack/pytest-skip-markers/CI?style=plastic :target: https://github.com/saltstack/pytest-skip-markers/actions/workflows/testing.yml :alt: CI .. image:: https://readthedocs.org/projects/pytest-skip-markers/badge/?style=plastic :target: https://pytest-skip-markers.readthedocs.io :alt: Docs .. image:: https://img.shields.io/codecov/c/github/saltstack/pytest-skip-markers?style=plastic&token=CqV7t0yKTb :target: https://codecov.io/gh/saltstack/pytest-skip-markers :alt: Codecov .. image:: https://img.shields.io/pypi/pyversions/pytest-skip-markers?style=plastic :target: https://pypi.org/project/pytest-skip-markers :alt: Python Versions .. image:: https://img.shields.io/pypi/wheel/pytest-skip-markers?style=plastic :target: https://pypi.org/project/pytest-skip-markers :alt: Python Wheel .. image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=plastic :target: https://github.com/psf/black :alt: Code Style: black .. image:: https://img.shields.io/pypi/l/pytest-skip-markers?style=plastic :alt: PyPI - License .. include-starts-here ==================== What is Skip Markers ==================== This pytest plugin was extracted from `pytest-salt-factories`_. It's a collection of of useful skip markers created to simplify and reduce code required to skip tests in some common scenarios, for example, platform specific tests. .. _pytest-salt-factories: https://github.com/saltstack/pytest-salt-factories Install ======= Installing Skip Markers is as simple as: .. code-block:: bash python -m pip install pytest-skip-markers And, that's honestly it. Usage ===== Once installed, you can now skip some tests with some simple pytest markers, for example. .. code-block:: python import pytest @pytest.mark.skip_unless_on_linux def test_on_linux(): assert True Contributing ============ The pytest-skip-markers project team welcomes contributions from the community. For more detailed information, refer to `CONTRIBUTING`_. .. _CONTRIBUTING: https://github.com/saltstack/pytest-skip-markers/blob/main/CONTRIBUTING.md .. include-ends-here Documentation ============= The full documentation can be seen `here `_. pytest-skip-markers-1.3.0/src/pytest_skip_markers.egg-info/SOURCES.txt0000644000000000000000000001007614236250622024464 0ustar00rootroot.codecov.yml .gitignore .pre-commit-config.yaml .pylint-spelling-words .pylintrc .readthedocs.yaml CHANGELOG.rst CODE_OF_CONDUCT.md CONTRIBUTING.md LICENSE NOTICE README.rst noxfile.py pyproject.toml pytest.ini setup.cfg setup.py .github/CODEOWNERS .github/workflows/release.yml .github/workflows/testing.yml .pre-commit-hooks/check-changelog-entries.py .pre-commit-hooks/copyright-headers.py .pre-commit-hooks/sort-pylint-spelling-words.py changelog/.gitignore docs/Makefile docs/changelog.rst docs/conf.py docs/contents.rst docs/index.rst docs/make.bat docs/sitevars.rst docs/_static/.gitkeep docs/_static/css/inline-include.css docs/_static/img/SaltProject_Logomark_teal.png docs/_static/img/SaltProject_altlogo_teal.png docs/ref/pytestskipmarkers/index.rst docs/ref/pytestskipmarkers/plugin.rst docs/ref/pytestskipmarkers/utils/index.rst docs/ref/pytestskipmarkers/utils/markers.rst docs/ref/pytestskipmarkers/utils/platform.rst docs/ref/pytestskipmarkers/utils/ports.rst requirements/base.txt requirements/build.txt requirements/changelog.txt requirements/docs.txt requirements/lint.txt requirements/tests.txt src/pytest_skip_markers.egg-info/PKG-INFO src/pytest_skip_markers.egg-info/SOURCES.txt src/pytest_skip_markers.egg-info/dependency_links.txt src/pytest_skip_markers.egg-info/entry_points.txt src/pytest_skip_markers.egg-info/not-zip-safe src/pytest_skip_markers.egg-info/requires.txt src/pytest_skip_markers.egg-info/top_level.txt src/pytestskipmarkers/__init__.py src/pytestskipmarkers/plugin.py src/pytestskipmarkers/py.typed src/pytestskipmarkers/version.py src/pytestskipmarkers/downgraded/__init__.py src/pytestskipmarkers/downgraded/plugin.py src/pytestskipmarkers/downgraded/utils/__init__.py src/pytestskipmarkers/downgraded/utils/markers.py src/pytestskipmarkers/downgraded/utils/platform.py src/pytestskipmarkers/downgraded/utils/ports.py src/pytestskipmarkers/downgraded/utils/socket.py src/pytestskipmarkers/downgraded/utils/win_functions.py src/pytestskipmarkers/utils/__init__.py src/pytestskipmarkers/utils/markers.py src/pytestskipmarkers/utils/platform.py src/pytestskipmarkers/utils/ports.py src/pytestskipmarkers/utils/socket.py src/pytestskipmarkers/utils/socket.pyi src/pytestskipmarkers/utils/win_functions.py tests/__init__.py tests/conftest.py tests/functional/test_destructive_test.py tests/functional/test_expensive_test.py tests/functional/test_requires_network.py tests/functional/test_skip_if_binaries_missing.py tests/functional/test_skip_if_not_root.py tests/functional/test_skip_on_aarch64.py tests/functional/test_skip_on_aix.py tests/functional/test_skip_on_darwin.py tests/functional/test_skip_on_env.py tests/functional/test_skip_on_freebsd.py tests/functional/test_skip_on_linux.py tests/functional/test_skip_on_netbsd.py tests/functional/test_skip_on_openbsd.py tests/functional/test_skip_on_photonos.py tests/functional/test_skip_on_platforms.py tests/functional/test_skip_on_smartos.py tests/functional/test_skip_on_spawning_platform.py tests/functional/test_skip_on_sunos.py tests/functional/test_skip_on_windows.py tests/functional/test_skip_unless_on_aarch64.py tests/functional/test_skip_unless_on_aix.py tests/functional/test_skip_unless_on_darwin.py tests/functional/test_skip_unless_on_freebsd.py tests/functional/test_skip_unless_on_linux.py tests/functional/test_skip_unless_on_netbsd.py tests/functional/test_skip_unless_on_openbsd.py tests/functional/test_skip_unless_on_photonos.py tests/functional/test_skip_unless_on_platforms.py tests/functional/test_skip_unless_on_smartos.py tests/functional/test_skip_unless_on_spawning_platform.py tests/functional/test_skip_unless_on_sunos.py tests/functional/test_skip_unless_on_windows.py tests/functional/markers/__init__.py tests/unit/__init__.py tests/unit/utils/__init__.py tests/unit/utils/test_platform.py tests/unit/utils/test_ports.py tests/unit/utils/markers/__init__.py tests/unit/utils/markers/test_skip_if_binaries_missing.py tests/unit/utils/markers/test_skip_if_no_local_network.py tests/unit/utils/markers/test_skip_if_no_remote_network.py tests/unit/utils/markers/test_skip_if_not_root.py tests/unit/utils/markers/test_skip_on_env.pypytest-skip-markers-1.3.0/src/pytest_skip_markers.egg-info/dependency_links.txt0000644000000000000000000000000114236250622026642 0ustar00rootroot pytest-skip-markers-1.3.0/src/pytest_skip_markers.egg-info/entry_points.txt0000644000000000000000000000006314236250622026071 0ustar00rootroot[pytest11] skip-markers = pytestskipmarkers.plugin pytest-skip-markers-1.3.0/src/pytest_skip_markers.egg-info/not-zip-safe0000644000000000000000000000000114236250622025022 0ustar00rootroot pytest-skip-markers-1.3.0/src/pytest_skip_markers.egg-info/requires.txt0000644000000000000000000000103014236250622025166 0ustar00rootrootpytest>=6.0.0 attrs>=19.2.0 distro [:sys_platform == "win32"] pywin32 [changelog] towncrier==21.9.0rc1 [docker] docker [docs] furo sphinx sphinx-copybutton sphinx-prompt sphinxcontrib-spelling sphinxcontrib-towncrier>=0.2.1a0 [lint] pylint==2.12.2 pyenchant flake8>=4.0.1 flake8-mypy-fork flake8-docstrings flake8-typing-imports [lint:python_version >= "3.7"] black reorder-python-imports [salt] salt>=3001 [tests] docker pytest-subtests [tests:python_version == "3.5"] pyfakefs==4.4.0 [tests:python_version > "3.5"] pyfakefs pytest-skip-markers-1.3.0/src/pytest_skip_markers.egg-info/top_level.txt0000644000000000000000000000002214236250622025320 0ustar00rootrootpytestskipmarkers pytest-skip-markers-1.3.0/src/pytestskipmarkers/0000755000000000000000000000000014236250622020604 5ustar00rootrootpytest-skip-markers-1.3.0/src/pytestskipmarkers/__init__.py0000644000000000000000000000574114236250622022724 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # # type: ignore import importlib import pathlib import re import sys USE_DOWNGRADED_TRANSPILED_CODE = sys.version_info < (3, 6) if USE_DOWNGRADED_TRANSPILED_CODE: # We generated downgraded code just for Py3.5 # Let's just import from those modules instead class NoTypingImporter: """ Meta importer to redirect imports on Py35. """ NO_REDIRECT_NAMES = ( "pytestskipmarkers.version", "pytestskipmarkers.downgraded", ) def find_module(self, module_name, package_path=None): # noqa: D102 if module_name.startswith(self.NO_REDIRECT_NAMES): return None if not module_name.startswith("pytestskipmarkers"): return None return self def load_module(self, name): # noqa: D102 if not name.startswith(self.NO_REDIRECT_NAMES): mod = importlib.import_module("pytestskipmarkers.downgraded.{}".format(name[18:])) else: mod = importlib.import_module(name) sys.modules[name] = mod return mod # Try our importer first sys.meta_path = [NoTypingImporter()] + sys.meta_path 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("pytest-skip-markers") except PackageNotFoundError: # package is not installed pass except ImportError: try: from importlib_metadata import version, PackageNotFoundError try: __version__ = version("pytest-skip-markers") except PackageNotFoundError: # package is not installed pass except ImportError: try: from pkg_resources import get_distribution, DistributionNotFound try: __version__ = get_distribution("pytest-skip-markers").version except DistributionNotFound: # package is not installed pass except ImportError: # pkg resources isn't even available?! pass # Define __version_info__ attribute VERSION_INFO_REGEX = re.compile( r"(?P[\d]+)\.(?P[\d]+)\.(?P[\d]+)" r"(?:\.dev(?P[\d]+)\+g(?P[a-z0-9]+)\.d(?P[\d]+))?" ) try: __version_info__ = tuple( int(p) if p.isdigit() else p for p in VERSION_INFO_REGEX.match(__version__).groups() if p ) except AttributeError: # pragma: no cover __version_info__ = (-1, -1, -1) finally: del VERSION_INFO_REGEX # Define some constants CODE_ROOT_DIR = pathlib.Path(__file__).resolve().parent IS_WINDOWS = sys.platform.startswith("win") IS_DARWIN = IS_OSX = sys.platform.startswith("darwin") pytest-skip-markers-1.3.0/src/pytestskipmarkers/downgraded/0000755000000000000000000000000014236250622022722 5ustar00rootrootpytest-skip-markers-1.3.0/src/pytestskipmarkers/downgraded/__init__.py0000644000000000000000000000000014236250622025021 0ustar00rootrootpytest-skip-markers-1.3.0/src/pytestskipmarkers/downgraded/plugin.py0000644000000000000000000001346114236250622024577 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Pytest plugin hooks. """ from __future__ import generator_stop from typing import TYPE_CHECKING import pytest import pytestskipmarkers.utils.markers if TYPE_CHECKING: from _pytest.config import Config from _pytest.config.argparsing import Parser from _pytest.nodes import Item def pytest_addoption(parser: 'Parser') -> None: """ Register argparse-style options and ini-style config values. """ test_selection_group = parser.getgroup('Tests Selection') test_selection_group.addoption( '--run-destructive', action='store_true', default=False, help='Run destructive tests. These tests can include adding or removing users from your system for example. Default: False', ) test_selection_group.addoption( '--run-expensive', action='store_true', default=False, help='Run expensive tests. These tests usually involve costs like for example bootstrapping a cloud VM. Default: False', ) @pytest.hookimpl(tryfirst=True) def pytest_runtest_setup(item: 'Item') -> None: """ Fixtures injection based on markers or test skips based on CLI arguments. """ __tracebackhide__ = True pytestskipmarkers.utils.markers.evaluate_markers(item) @pytest.mark.trylast def pytest_configure(config: 'Config') -> None: """ Configure the plugin. called after command line options have been parsed and all plugins and initial conftest files been loaded. """ config.addinivalue_line( 'markers', 'destructive_test: Run destructive tests. These tests can include adding or removing users from your system for example.', ) config.addinivalue_line( 'markers', 'expensive_test: Run expensive tests. These tests can include starting resources which cost money, like VMs, for example.', ) config.addinivalue_line( 'markers', 'skip_if_not_root: Skip if the current user is not root on non windows platforms or not Administrator on windows platforms', ) config.addinivalue_line( 'markers', 'skip_if_not_root: Skip if the current user is not `root`.' ) config.addinivalue_line( 'markers', "skip_if_binaries_missing(*binaries, check_all=True, message=None):If 'check_all' is True, all binaries must exist.If 'check_all' is False, then only one the passed binaries needs to be found. Usefull when, for example, passing a list of python interpreter names(python3.5, python3, python), where only one needs to exist.", ) config.addinivalue_line( 'markers', "requires_network(only_local_network=False): Skip if no networking is set up. If 'only_local_network' is 'True', only the local network is checked.", ) config.addinivalue_line('markers', 'skip_on_windows: Skip test on Windows') config.addinivalue_line( 'markers', 'skip_unless_on_windows: Skip test unless on Windows' ) config.addinivalue_line('markers', 'skip_on_linux: Skip test on Linux') config.addinivalue_line( 'markers', 'skip_unless_on_linux: Skip test unless on Linux' ) config.addinivalue_line('markers', 'skip_on_darwin: Skip test on Darwin') config.addinivalue_line( 'markers', 'skip_unless_on_darwin: Skip test unless on Darwin' ) config.addinivalue_line('markers', 'skip_on_sunos: Skip test on SunOS') config.addinivalue_line( 'markers', 'skip_unless_on_sunos: Skip test unless on SunOS' ) config.addinivalue_line('markers', 'skip_on_smartos: Skip test on SmartOS') config.addinivalue_line( 'markers', 'skip_unless_on_smartos: Skip test unless on SmartOS' ) config.addinivalue_line('markers', 'skip_on_freebsd: Skip test on FreeBSD') config.addinivalue_line( 'markers', 'skip_unless_on_freebsd: Skip test unless on FreeBSD' ) config.addinivalue_line('markers', 'skip_on_netbsd: Skip test on NetBSD') config.addinivalue_line( 'markers', 'skip_unless_on_netbsd: Skip test unless on NetBSD' ) config.addinivalue_line('markers', 'skip_on_openbsd: Skip test on OpenBSD') config.addinivalue_line( 'markers', 'skip_unless_on_openbsd: Skip test unless on OpenBSD' ) config.addinivalue_line('markers', 'skip_on_aix: Skip test on AIX') config.addinivalue_line('markers', 'skip_unless_on_aix: Skip test unless on AIX') config.addinivalue_line('markers', 'skip_on_aarch64: Skip test on AArch64') config.addinivalue_line( 'markers', 'skip_unless_on_aarch64: Skip test unless on AArch64' ) config.addinivalue_line('markers', 'skip_on_photonos: Skip test on PhotonOS') config.addinivalue_line( 'markers', 'skip_unless_on_photonos: Skip test unless on PhotonOS' ) config.addinivalue_line( 'markers', 'skip_on_spawning_platform: Skip test on spawning platforms' ) config.addinivalue_line( 'markers', 'skip_unless_on_spawning_platform: Skip test unless on spawning platforms', ) config.addinivalue_line( 'markers', 'skip_on_platforms(windows=False, linux=False, darwin=False, sunos=False, smartos=False, freebsd=False, netbsd=False, openbsd=False, aix=False, aarch64=False, spawning=False, photonos=False): Pass True to one or more keywords to get the test skipped.', ) config.addinivalue_line( 'markers', 'skip_unless_on_platforms(windows=False, linux=False, darwin=False, sunos=False, smartos=False, freebsd=False, netbsd=False, openbsd=False, aix=False, aarch64=False, spawning=False, photonos=False): Pass True to one or more keywords to get the test skipped unless matched.', ) config.addinivalue_line( 'markers', 'skip_on_env(envvar, present=True, eq=None, ne=None): Skip test based on environment variables presence and contents.', ) pytest-skip-markers-1.3.0/src/pytestskipmarkers/downgraded/utils/0000755000000000000000000000000014236250622024062 5ustar00rootrootpytest-skip-markers-1.3.0/src/pytestskipmarkers/downgraded/utils/__init__.py0000644000000000000000000000015414236250622026173 0ustar00rootroot# Copyright 2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # from __future__ import generator_stop pytest-skip-markers-1.3.0/src/pytestskipmarkers/downgraded/utils/markers.py0000644000000000000000000010210714236250622026101 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ PyTest Markers related utilities. .. PYTEST_DONT_REWRITE """ from __future__ import generator_stop import contextlib import logging import os import shutil from typing import Any from typing import cast from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import TYPE_CHECKING from typing import Union import _pytest._version import pytest import pytestskipmarkers.utils.platform import pytestskipmarkers.utils.ports as ports import pytestskipmarkers.utils.socket as socket if TYPE_CHECKING: from _pytest.nodes import Item PYTEST_GE_7 = getattr(_pytest._version, 'version_tuple', (-1, -1)) >= (7, 0) log = logging.getLogger(__name__) def skip_if_not_root() -> Optional[str]: """ Helper function to check for root/Administrator privileges. Returns: str: The reason of the skip """ if not pytestskipmarkers.utils.platform.is_windows(): if os.getuid() != 0: return 'You must be logged in as root to run this test' else: from pytestskipmarkers.utils import win_functions current_user = win_functions.get_current_user() if TYPE_CHECKING: assert current_user if current_user != 'SYSTEM': if not win_functions.is_admin(cast(str, current_user)): return 'You must be logged in as an Administrator to run this test' return None def skip_if_binaries_missing( binaries: Union[List[str], Tuple[str, ...]], check_all: bool = True, reason: Optional[str] = None, ) -> Optional[str]: """ Helper function to check for existing binaries. Args: binaries (list or tuple): Iterator of binaries to check check_all (bool): If ``check_all`` is ``True``, the default, all binaries must exist. If ``check_all`` is ``False``, then only one the passed binaries needs to be found. Useful when, for example, passing a list of python interpreter names(python3.5, python3, python), where only one needs to exist. reason (str): The skip reason. Returns: str: The reason for the skip. None: Should not be skipped. """ if check_all is False: for binary in binaries: if shutil.which(binary) is not None: break else: if reason is not None: return reason return 'None of the following binaries was found: {}'.format( ', '.join(binaries) ) else: for binary in binaries: if shutil.which(binary) is None: if reason is not None: return reason return "The '{}' binary was not found".format(binary) log.debug('All binaries found. Searched for: %s', ', '.join(binaries)) return None def skip_if_no_local_network() -> Optional[str]: """ Helper function to check for existing local network. Returns: str: The reason for the skip. None: Should not be skipped. """ check_port = ports.get_unused_localhost_port() has_local_network = False try: with contextlib.closing( socket.socket(socket.AF_INET, socket.SOCK_STREAM) ) as pubsock: pubsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) pubsock.bind(('', check_port)) has_local_network = True except OSError: try: with contextlib.closing( socket.socket(socket.AF_INET6, socket.SOCK_STREAM) ) as pubsock: pubsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) pubsock.bind(('', check_port)) has_local_network = True except OSError: pass if has_local_network is False: return 'No local network was detected' return None def skip_if_no_remote_network() -> Optional[str]: """ Helper function to check for existing remote network(internet). Returns: str: The reason for the skip. None: Should not be skipped. """ if os.environ.get('NO_INTERNET'): return 'Environment variable NO_INTERNET is set' has_remote_network = False for addr in ( '172.217.17.14', '172.217.16.238', '173.194.41.198', '173.194.41.199', '173.194.41.200', '173.194.41.201', '173.194.41.206', '173.194.41.192', '173.194.41.193', '173.194.41.194', '173.194.41.195', '173.194.41.196', '173.194.41.197', '216.58.201.174', ): try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(0.25) sock.connect((addr, 80)) sock.close() has_remote_network = True break except OSError: continue if has_remote_network is False: return 'No internet network connection was detected' return None def skip_on_env( varname: str, present: bool = True, eq: Optional[str] = None, ne: Optional[str] = None, reason: Optional[str] = None, ) -> Optional[str]: """ Helper function to check for environment variables. If any of the checks match, return the skip reason. Args: varname(str): The environment variable to check present(bool): When ``True``, skip if variable is present in the environment. When ``False``, skip if variable is not present in the environment. eq(str): Skips when the variable is present in the environment and matches this value. ne(str): Skips when the variable is present in the environment and does not match this value. reason(str): The custom reason message to use. Returns: str: The skip reason None: Should not be skipped. """ if eq and ne: raise pytest.UsageError('Cannot pass both `eq` and `ne`.') if present is False and (eq or ne): raise pytest.UsageError('Cannot pass `present=False` and either `eq` or `ne`.') if present is False and varname not in os.environ: if not reason: reason = "The variable '{0}' is not present in the environ.".format(varname) return reason elif present is True and varname in os.environ: varname_value = os.environ[varname] if eq: if varname_value == eq: if not reason: reason = "'{0}' present in environ and '{1}=={2}'".format( varname, varname, eq ) elif ne: if varname_value != ne: if not reason: reason = "'{0}' present in environ and '{1}!={2}'".format( varname, varname, eq ) elif not reason: reason = "The variable '{0}' is present in the environ.".format(varname) return reason return None def evaluate_markers(item: 'Item') -> None: """ Fixtures injection based on markers or test skips based on CLI arguments. """ exc_kwargs = {} if PYTEST_GE_7: exc_kwargs['_use_item_location'] = True destructive_tests_marker = item.get_closest_marker('destructive_test') if destructive_tests_marker is not None: if destructive_tests_marker.args or destructive_tests_marker.kwargs: raise pytest.UsageError( "The 'destructive_test' marker does not accept any arguments or keyword arguments" ) if item.config.getoption('--run-destructive') is False: raise pytest.skip.Exception('Destructive tests are disabled', **exc_kwargs) expensive_tests_marker = item.get_closest_marker('expensive_test') if expensive_tests_marker is not None: if expensive_tests_marker.args or expensive_tests_marker.kwargs: raise pytest.UsageError( "The 'expensive_test' marker does not accept any arguments or keyword arguments" ) if item.config.getoption('--run-expensive') is False: raise pytest.skip.Exception('Expensive tests are disabled', **exc_kwargs) skip_if_not_root_marker = item.get_closest_marker('skip_if_not_root') if skip_if_not_root_marker is not None: if skip_if_not_root_marker.args or skip_if_not_root_marker.kwargs: raise pytest.UsageError( "The 'skip_if_not_root' marker does not accept any arguments or keyword arguments" ) skip_reason = skip_if_not_root() if skip_reason: raise pytest.skip.Exception(skip_reason, **exc_kwargs) skip_if_binaries_missing_marker = item.get_closest_marker( 'skip_if_binaries_missing' ) if skip_if_binaries_missing_marker is not None: binaries = skip_if_binaries_missing_marker.args if not binaries: raise pytest.UsageError( "The 'skip_if_binaries_missing' marker needs at least one binary name to be passed" ) for arg in binaries: if not isinstance(arg, str): raise pytest.UsageError( "The 'skip_if_binaries_missing' marker only accepts strings as arguments. If you are trying to pass multiple binaries, each binary should be an separate argument." ) message = cast(Dict[str, Any], skip_if_binaries_missing_marker.kwargs).pop( 'message', None ) if message: item.warn( pytest.PytestWarning( 'Please stop passing \'message="{0}"\' and instead pass \'reason="{0}"\''.format( message ) ) ) cast(Dict[str, Any], skip_if_binaries_missing_marker.kwargs)[ 'reason' ] = message skip_reason = skip_if_binaries_missing( binaries, **skip_if_binaries_missing_marker.kwargs ) if skip_reason: raise pytest.skip.Exception(skip_reason, **exc_kwargs) requires_network_marker = item.get_closest_marker('requires_network') if requires_network_marker is not None: only_local_network = requires_network_marker.kwargs.get( 'only_local_network', False ) local_skip_reason = skip_if_no_local_network() if local_skip_reason: raise pytest.skip.Exception(local_skip_reason, **exc_kwargs) if only_local_network is False: remote_skip_reason = skip_if_no_remote_network() if remote_skip_reason: raise pytest.skip.Exception(remote_skip_reason, **exc_kwargs) skip_on_windows_marker = item.get_closest_marker('skip_on_windows') if skip_on_windows_marker is not None: if skip_on_windows_marker.args: raise pytest.UsageError( 'The skip_on_windows marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_on_windows_marker.kwargs).pop('reason', None) if skip_on_windows_marker.kwargs: raise pytest.UsageError( "The skip_on_windows marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Skipped on Windows' if pytestskipmarkers.utils.platform.is_windows(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_windows_marker = item.get_closest_marker('skip_unless_on_windows') if skip_unless_on_windows_marker is not None: if skip_unless_on_windows_marker.args: raise pytest.UsageError( 'The skip_unless_on_windows marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_unless_on_windows_marker.kwargs).pop( 'reason', None ) if skip_unless_on_windows_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_windows marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Platform is not Windows, skipped' if not pytestskipmarkers.utils.platform.is_windows(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_linux_marker = item.get_closest_marker('skip_on_linux') if skip_on_linux_marker is not None: if skip_on_linux_marker.args: raise pytest.UsageError( 'The skip_on_linux marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_on_linux_marker.kwargs).pop('reason', None) if skip_on_linux_marker.kwargs: raise pytest.UsageError( "The skip_on_linux marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Skipped on Linux' if pytestskipmarkers.utils.platform.is_linux(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_linux_marker = item.get_closest_marker('skip_unless_on_linux') if skip_unless_on_linux_marker is not None: if skip_unless_on_linux_marker.args: raise pytest.UsageError( 'The skip_unless_on_linux marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_unless_on_linux_marker.kwargs).pop( 'reason', None ) if skip_unless_on_linux_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_linux marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Platform is not Linux, skipped' if not pytestskipmarkers.utils.platform.is_linux(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_darwin_marker = item.get_closest_marker('skip_on_darwin') if skip_on_darwin_marker is not None: if skip_on_darwin_marker.args: raise pytest.UsageError( 'The skip_on_darwin marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_on_darwin_marker.kwargs).pop('reason', None) if skip_on_darwin_marker.kwargs: raise pytest.UsageError( "The skip_on_darwin marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Skipped on Darwin' if pytestskipmarkers.utils.platform.is_darwin(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_darwin_marker = item.get_closest_marker('skip_unless_on_darwin') if skip_unless_on_darwin_marker is not None: if skip_unless_on_darwin_marker.args: raise pytest.UsageError( 'The skip_unless_on_darwin marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_unless_on_darwin_marker.kwargs).pop( 'reason', None ) if skip_unless_on_darwin_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_darwin marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Platform is not Darwin, skipped' if not pytestskipmarkers.utils.platform.is_darwin(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_sunos_marker = item.get_closest_marker('skip_on_sunos') if skip_on_sunos_marker is not None: if skip_on_sunos_marker.args: raise pytest.UsageError( 'The skip_on_sunos marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_on_sunos_marker.kwargs).pop('reason', None) if skip_on_sunos_marker.kwargs: raise pytest.UsageError( "The skip_on_sunos marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Skipped on SunOS' if pytestskipmarkers.utils.platform.is_sunos(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_sunos_marker = item.get_closest_marker('skip_unless_on_sunos') if skip_unless_on_sunos_marker is not None: if skip_unless_on_sunos_marker.args: raise pytest.UsageError( 'The skip_unless_on_sunos marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_unless_on_sunos_marker.kwargs).pop( 'reason', None ) if skip_unless_on_sunos_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_sunos marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Platform is not SunOS, skipped' if not pytestskipmarkers.utils.platform.is_sunos(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_smartos_marker = item.get_closest_marker('skip_on_smartos') if skip_on_smartos_marker is not None: if skip_on_smartos_marker.args: raise pytest.UsageError( 'The skip_on_smartos marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_on_smartos_marker.kwargs).pop('reason', None) if skip_on_smartos_marker.kwargs: raise pytest.UsageError( "The skip_on_smartos marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Skipped on SmartOS' if pytestskipmarkers.utils.platform.is_smartos(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_smartos_marker = item.get_closest_marker('skip_unless_on_smartos') if skip_unless_on_smartos_marker is not None: if skip_unless_on_smartos_marker.args: raise pytest.UsageError( 'The skip_unless_on_smartos marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_unless_on_smartos_marker.kwargs).pop( 'reason', None ) if skip_unless_on_smartos_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_smartos marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Platform is not SmartOS, skipped' if not pytestskipmarkers.utils.platform.is_smartos(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_freebsd_marker = item.get_closest_marker('skip_on_freebsd') if skip_on_freebsd_marker is not None: if skip_on_freebsd_marker.args: raise pytest.UsageError( 'The skip_on_freebsd marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_on_freebsd_marker.kwargs).pop('reason', None) if skip_on_freebsd_marker.kwargs: raise pytest.UsageError( "The skip_on_freebsd marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Skipped on FreeBSD' if pytestskipmarkers.utils.platform.is_freebsd(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_freebsd_marker = item.get_closest_marker('skip_unless_on_freebsd') if skip_unless_on_freebsd_marker is not None: if skip_unless_on_freebsd_marker.args: raise pytest.UsageError( 'The skip_unless_on_freebsd marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_unless_on_freebsd_marker.kwargs).pop( 'reason', None ) if skip_unless_on_freebsd_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_freebsd marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Platform is not FreeBSD, skipped' if not pytestskipmarkers.utils.platform.is_freebsd(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_netbsd_marker = item.get_closest_marker('skip_on_netbsd') if skip_on_netbsd_marker is not None: if skip_on_netbsd_marker.args: raise pytest.UsageError( 'The skip_on_netbsd marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_on_netbsd_marker.kwargs).pop('reason', None) if skip_on_netbsd_marker.kwargs: raise pytest.UsageError( "The skip_on_netbsd marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Skipped on NetBSD' if pytestskipmarkers.utils.platform.is_netbsd(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_netbsd_marker = item.get_closest_marker('skip_unless_on_netbsd') if skip_unless_on_netbsd_marker is not None: if skip_unless_on_netbsd_marker.args: raise pytest.UsageError( 'The skip_unless_on_netbsd marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_unless_on_netbsd_marker.kwargs).pop( 'reason', None ) if skip_unless_on_netbsd_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_netbsd marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Platform is not NetBSD, skipped' if not pytestskipmarkers.utils.platform.is_netbsd(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_openbsd_marker = item.get_closest_marker('skip_on_openbsd') if skip_on_openbsd_marker is not None: if skip_on_openbsd_marker.args: raise pytest.UsageError( 'The skip_on_openbsd marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_on_openbsd_marker.kwargs).pop('reason', None) if skip_on_openbsd_marker.kwargs: raise pytest.UsageError( "The skip_on_openbsd marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Skipped on OpenBSD' if pytestskipmarkers.utils.platform.is_openbsd(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_openbsd_marker = item.get_closest_marker('skip_unless_on_openbsd') if skip_unless_on_openbsd_marker is not None: if skip_unless_on_openbsd_marker.args: raise pytest.UsageError( 'The skip_unless_on_openbsd marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_unless_on_openbsd_marker.kwargs).pop( 'reason', None ) if skip_unless_on_openbsd_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_openbsd marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Platform is not OpenBSD, skipped' if not pytestskipmarkers.utils.platform.is_openbsd(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_aix_marker = item.get_closest_marker('skip_on_aix') if skip_on_aix_marker is not None: if skip_on_aix_marker.args: raise pytest.UsageError( 'The skip_on_aix marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_on_aix_marker.kwargs).pop('reason', None) if skip_on_aix_marker.kwargs: raise pytest.UsageError( "The skip_on_aix marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Skipped on AIX' if pytestskipmarkers.utils.platform.is_aix(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_aix_marker = item.get_closest_marker('skip_unless_on_aix') if skip_unless_on_aix_marker is not None: if skip_unless_on_aix_marker.args: raise pytest.UsageError( 'The skip_unless_on_aix marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_unless_on_aix_marker.kwargs).pop( 'reason', None ) if skip_unless_on_aix_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_aix marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Platform is not AIX, skipped' if not pytestskipmarkers.utils.platform.is_aix(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_aarch64_marker = item.get_closest_marker('skip_on_aarch64') if skip_on_aarch64_marker is not None: if skip_on_aarch64_marker.args: raise pytest.UsageError( 'The skip_on_aarch64 marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_on_aarch64_marker.kwargs).pop('reason', None) if skip_on_aarch64_marker.kwargs: raise pytest.UsageError( "The skip_on_aarch64 marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Skipped on AArch64' if pytestskipmarkers.utils.platform.is_aarch64(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_aarch64_marker = item.get_closest_marker('skip_unless_on_aarch64') if skip_unless_on_aarch64_marker is not None: if skip_unless_on_aarch64_marker.args: raise pytest.UsageError( 'The skip_unless_on_aarch64 marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_unless_on_aarch64_marker.kwargs).pop( 'reason', None ) if skip_unless_on_aarch64_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_aarch64 marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Platform is not AArch64, skipped' if not pytestskipmarkers.utils.platform.is_aarch64(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_spawning_platform_marker = item.get_closest_marker( 'skip_on_spawning_platform' ) if skip_on_spawning_platform_marker is not None: if skip_on_spawning_platform_marker.args: raise pytest.UsageError( 'The skip_on_spawning_platform marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_on_spawning_platform_marker.kwargs).pop( 'reason', None ) if skip_on_spawning_platform_marker.kwargs: raise pytest.UsageError( "The skip_on_spawning_platform marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Skipped on spawning platforms' if pytestskipmarkers.utils.platform.is_spawning_platform(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_spawning_platform_marker = item.get_closest_marker( 'skip_unless_on_spawning_platform' ) if skip_unless_on_spawning_platform_marker is not None: if skip_unless_on_spawning_platform_marker.args: raise pytest.UsageError( 'The skip_unless_on_spawning_platform marker does not accept any arguments' ) reason = cast( Dict[str, Any], skip_unless_on_spawning_platform_marker.kwargs ).pop('reason', None) if skip_unless_on_spawning_platform_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_spawning_platform marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Platform does not default multiprocessing to spawn, skipped' if not pytestskipmarkers.utils.platform.is_spawning_platform(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_photonos_marker = item.get_closest_marker('skip_on_photonos') if skip_on_photonos_marker is not None: if skip_on_photonos_marker.args: raise pytest.UsageError( 'The skip_on_photonos marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_on_photonos_marker.kwargs).pop( 'reason', None ) if skip_on_photonos_marker.kwargs: raise pytest.UsageError( "The skip_on_photonos marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Skipped on PhotonOS' if pytestskipmarkers.utils.platform.is_photonos(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_photonos_marker = item.get_closest_marker('skip_unless_on_photonos') if skip_unless_on_photonos_marker is not None: if skip_unless_on_photonos_marker.args: raise pytest.UsageError( 'The skip_unless_on_photonos marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_unless_on_photonos_marker.kwargs).pop( 'reason', None ) if skip_unless_on_photonos_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_photonos marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = 'Platform is not PhotonOS, skipped' if not pytestskipmarkers.utils.platform.is_photonos(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_platforms_marker = item.get_closest_marker('skip_on_platforms') if skip_on_platforms_marker is not None: if skip_on_platforms_marker.args: raise pytest.UsageError( 'The skip_on_platforms marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_on_platforms_marker.kwargs).pop( 'reason', None ) if not skip_on_platforms_marker.kwargs: raise pytest.UsageError( 'Pass at least one platform to skip_on_platforms as a keyword argument' ) if not any(skip_on_platforms_marker.kwargs.values()): raise pytest.UsageError( 'Pass at least one platform with a True value to skip_on_platforms as a keyword argument' ) if reason is None: reason = 'Skipped on platform match' try: if pytestskipmarkers.utils.platform.on_platforms( **skip_on_platforms_marker.kwargs ): raise pytest.skip.Exception(reason, **exc_kwargs) except TypeError as exc: raise pytest.UsageError( 'Passed an invalid platform to skip_on_platforms: {}'.format(exc) ) skip_unless_on_platforms_marker = item.get_closest_marker( 'skip_unless_on_platforms' ) if skip_unless_on_platforms_marker is not None: if skip_unless_on_platforms_marker.args: raise pytest.UsageError( 'The skip_unless_on_platforms marker does not accept any arguments' ) reason = cast(Dict[str, Any], skip_unless_on_platforms_marker.kwargs).pop( 'reason', None ) if not skip_unless_on_platforms_marker.kwargs: raise pytest.UsageError( 'Pass at least one platform to skip_unless_on_platforms as a keyword argument' ) if not any(skip_unless_on_platforms_marker.kwargs.values()): raise pytest.UsageError( 'Pass at least one platform with a True value to skip_unless_on_platforms as a keyword argument' ) if reason is None: reason = 'Platform(s) do not match, skipped' try: if not pytestskipmarkers.utils.platform.on_platforms( **skip_unless_on_platforms_marker.kwargs ): raise pytest.skip.Exception(reason, **exc_kwargs) except TypeError as exc: raise pytest.UsageError( 'Passed an invalid platform to skip_unless_on_platforms: {}'.format(exc) ) skip_on_env_marker = item.get_closest_marker('skip_on_env') if skip_on_env_marker is not None: args = list(skip_on_env_marker.args) if not args: raise pytest.UsageError( "The 'skip_on_env' marker needs at least one argument to be passed, the environment variable name." ) envvar = args.pop(0) if args: raise pytest.UsageError( "The 'skip_on_env' only accepts one argument, the environment variable name." ) if not isinstance(envvar, str): raise pytest.UsageError( 'The environment variable argument must be a string.' ) kwargs = cast(Dict[str, Any], skip_on_env_marker.kwargs).copy() present = kwargs.pop('present', True) eq = kwargs.pop('eq', None) ne = kwargs.pop('ne', None) reason = kwargs.pop('reason', None) if kwargs: raise pytest.UsageError( "The 'skip_on_env' marker only accepts 'present', 'eq', 'ne' and 'reason' as keyword arguments." ) skip_reason = skip_on_env(envvar, present=present, eq=eq, ne=ne, reason=reason) if skip_reason: raise pytest.skip.Exception(skip_reason, **exc_kwargs) pytest-skip-markers-1.3.0/src/pytestskipmarkers/downgraded/utils/platform.py0000644000000000000000000001356514236250622026272 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Platform related utilities. .. PYTEST_DONT_REWRITE """ from __future__ import generator_stop import multiprocessing import os import pathlib import platform import shutil import subprocess import sys from functools import lru_cache from typing import cast import distro @lru_cache(maxsize=None) def is_windows() -> bool: """ Simple function to return if a host is Windows or not. :return bool: Return true on Windows """ return sys.platform.startswith('win') @lru_cache(maxsize=None) def is_linux() -> bool: """ Simple function to return if a host is Linux or not. Note for a proxy minion, we need to return something else :return bool: Return true on Linux """ return sys.platform.startswith('linux') @lru_cache(maxsize=None) def is_darwin() -> bool: """ Simple function to return if a host is Darwin (macOS) or not. :return bool: Return true on Darwin(macOS) """ return sys.platform.startswith('darwin') @lru_cache(maxsize=None) def is_sunos() -> bool: """ Simple function to return if host is SunOS or not. :return bool: Return true on SunOS """ return sys.platform.startswith('sunos') @lru_cache(maxsize=None) def is_smartos() -> bool: """ Simple function to return if host is SmartOS (Illumos) or not. :return bool: Return true on SmartOS (Illumos) """ if is_sunos(): return os.uname()[3].startswith('joyent_') return False @lru_cache(maxsize=None) def is_freebsd() -> bool: """ Simple function to return if host is FreeBSD or not. :return bool: Return true on FreeBSD """ return sys.platform.startswith('freebsd') @lru_cache(maxsize=None) def is_netbsd() -> bool: """ Simple function to return if host is NetBSD or not. :return bool: Return true on NetBSD """ return sys.platform.startswith('netbsd') @lru_cache(maxsize=None) def is_openbsd() -> bool: """ Simple function to return if host is OpenBSD or not. :return bool: Return true on OpenBSD """ return sys.platform.startswith('openbsd') @lru_cache(maxsize=None) def is_aix() -> bool: """ Simple function to return if host is AIX or not. :return bool: Return true on AIX """ return sys.platform.startswith('aix') @lru_cache(maxsize=None) def is_aarch64() -> bool: """ Simple function to return if host is AArch64 or not. """ return platform.machine().startswith('aarch64') @lru_cache(maxsize=None) def is_photonos() -> bool: """ Simple function to return if host is Photon OS or not. """ osname, _, _ = (x.strip('"').strip("'") for x in distro.linux_distribution()) return cast(bool, osname == 'VMware Photon OS') def is_spawning_platform() -> bool: """ Returns ``True`` if running on a platform which defaults multiprocessing to spawn. """ return multiprocessing.get_start_method(allow_none=False) == 'spawn' def on_platforms( windows: bool = False, linux: bool = False, darwin: bool = False, sunos: bool = False, smartos: bool = False, freebsd: bool = False, netbsd: bool = False, openbsd: bool = False, aix: bool = False, aarch64: bool = False, spawning: bool = False, photonos: bool = False, ) -> bool: """ Check to see if we're on one of the provided platforms. :keyword bool windows: When :py:const:`True`, check if running on Windows. :keyword bool linux: When :py:const:`True`, check if running on Linux. :keyword bool darwin: When :py:const:`True`, check if running on Darwin. :keyword bool sunos: When :py:const:`True`, check if running on SunOS. :keyword bool smartos: When :py:const:`True`, check if running on SmartOS. :keyword bool freebsd: When :py:const:`True`, check if running on FreeBSD. :keyword bool netbsd: When :py:const:`True`, check if running on NetBSD. :keyword bool openbsd: When :py:const:`True`, check if running on OpenBSD. :keyword bool aix: When :py:const:`True`, check if running on AIX. :keyword bool aarch64: When :py:const:`True`, check if running on AArch64. :keyword bool spawning: When :py:const:`True`, check if running on a platform which defaults multiprocessing to spawn """ if windows and is_windows(): return True if linux and is_linux(): return True if darwin and is_darwin(): return True if sunos and is_sunos(): return True if smartos and is_smartos(): return True if freebsd and is_freebsd(): return True if netbsd and is_netbsd(): return True if openbsd and is_openbsd(): return True if aix and is_aix(): return True if aarch64 and is_aarch64(): return True if spawning and is_spawning_platform(): return True if photonos and is_photonos(): return True return False def is_fips_enabled() -> bool: """ Check is FIPS is enabled. :return bool: Return true when enabled """ if pathlib.Path('/etc/system-fips').exists(): return True kernel_fips_enabled_path = pathlib.Path('/proc/sys/crypto/fips_enabled') if ( kernel_fips_enabled_path.exists() and kernel_fips_enabled_path.read_text(encoding='utf-8').strip() == '1' ): return True sysctl_path = shutil.which('sysctl') if not sysctl_path: return False ret = subprocess.run( [sysctl_path, 'crypto.fips_enabled'], check=False, shell=False, stdout=subprocess.PIPE, universal_newlines=True, ) if ret.returncode == 0: stripped_output = ret.stdout.strip() if not stripped_output: return False if '=' not in stripped_output: return False if stripped_output.split('=')[-1].strip() == '1': return True return False pytest-skip-markers-1.3.0/src/pytestskipmarkers/downgraded/utils/ports.py0000644000000000000000000000420114236250622025600 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Ports related utility functions. """ from __future__ import generator_stop import contextlib import logging from typing import Set import pytest from pytestskipmarkers.utils import socket log = logging.getLogger(__name__) def get_unused_localhost_port(use_cache: bool = False) -> int: """ Return a random unused port on localhost. :keyword bool use_cache: If ``use_cache`` is ``True``, consecutive calls to this function will never return the cached port. """ if not isinstance(use_cache, bool): raise pytest.UsageError( "The value of 'use_cache' needs to be an boolean, not {}".format( type(use_cache) ) ) with contextlib.closing( socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) ) as usock: usock.bind(('127.0.0.1', 0)) port = usock.getsockname()[1] if use_cache: try: cached_ports = get_unused_localhost_port.__cached_ports__ except AttributeError: cached_ports = get_unused_localhost_port.__cached_ports__ = set() if port in cached_ports: return get_unused_localhost_port(use_cache=use_cache) cached_ports.add(port) return port def get_connectable_ports(ports: Set[int]) -> Set[int]: """ Returns a set of the ports where connection was successful. :param ~collections.abc.Iterable ports: An iterable of ports to try and connect to :rtype: set :return: Returns a set of the ports where connection was successful """ connectable_ports = set() ports = set(ports) for port in set(ports): with contextlib.closing( socket.socket(socket.AF_INET, socket.SOCK_STREAM) ) as sock: conn = sock.connect_ex(('localhost', port)) try: if conn == 0: log.debug('Port %s is connectable!', port) connectable_ports.add(port) sock.shutdown(socket.SHUT_RDWR) except OSError: continue return connectable_ports pytest-skip-markers-1.3.0/src/pytestskipmarkers/downgraded/utils/socket.py0000644000000000000000000000071514236250622025727 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Namespaced ``socket`` module. This module's sole purpose is to have the standard library :py:mod:`socket` module functions under a different namespace to be used in pytest-skip-markers so that projects using it, which need to mock :py:mod:`socket` functions, don't influence the pytest-skip-markers run time behavior. """ from __future__ import generator_stop from socket import * pytest-skip-markers-1.3.0/src/pytestskipmarkers/downgraded/utils/win_functions.py0000644000000000000000000000715214236250622027326 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Windows specific functions. .. PYTEST_DONT_REWRITE """ from __future__ import generator_stop from typing import List from typing import Union try: import pywintypes import win32api import win32net import win32security except ImportError: pass def is_admin(name: str) -> bool: """ Is the passed user a member of the Administrators group. Args: name (str): The name to check Returns: bool: True if user is a member of the Administrators group, False otherwise """ groups = get_user_groups(name, True) for group in groups: if group in ('S-1-5-32-544', 'S-1-5-18'): return True return False def get_user_groups(name: str, sid: bool = False) -> List[str]: """ Get the groups to which a user belongs. Args: name (str): The user name to query sid (bool): True will return a list of SIDs, False will return a list of group names Returns: list: A list of group names or sids """ groups = [] if name.upper() == 'SYSTEM': groups = ['SYSTEM'] else: try: groups = win32net.NetUserGetLocalGroups(None, name) except (win32net.error, pywintypes.error) as exc: if exc.winerror in (5, 1722, 2453, 1927, 1355): groups = win32net.NetUserGetLocalGroups(None, name, 0) else: try: groups = win32net.NetUserGetGroups(None, name) except win32net.error as exc: if exc.winerror in (5, 1722, 2453, 1927, 1355): groups = win32net.NetUserGetLocalGroups(None, name, 0) except pywintypes.error as exc: if exc.winerror in (5, 1722, 2453, 1927, 1355): groups = win32net.NetUserGetLocalGroups(None, name, 1) else: raise if not sid: return groups ret_groups = [] for group in groups: ret_groups.append(get_sid_from_name(group)) return ret_groups def get_sid_from_name(name: str) -> str: """ This is a tool for getting a sid from a name. The name can be any object. Usually a user or a group. Args: name (str): The name of the user or group for which to get the sid Returns: str: The corresponding SID """ if name is None: name = 'NULL SID' try: sid = win32security.LookupAccountName(None, name)[0] except pywintypes.error as exc: raise Exception('User {} not found: {}'.format(name, exc)) from exc sidstr = win32security.ConvertSidToStringSid(sid) return sidstr def get_current_user(with_domain: bool = True) -> Union[str, bool]: """ Gets the user executing the process. Args: with_domain (bool): ``True`` will prepend the user name with the machine name or domain separated by a backslash Returns: str: The user name """ try: user_name = win32api.GetUserNameEx(win32api.NameSamCompatible) if user_name[-1] == '$': test_user = win32api.GetUserName() if test_user == 'SYSTEM': user_name = 'SYSTEM' elif get_sid_from_name(test_user) == 'S-1-5-18': user_name = 'SYSTEM' elif not with_domain: user_name = win32api.GetUserName() except pywintypes.error as exc: raise Exception('Failed to get current user: {}'.format(exc)) from exc if not user_name: return False return user_name pytest-skip-markers-1.3.0/src/pytestskipmarkers/plugin.py0000644000000000000000000001464714236250622022470 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Pytest plugin hooks. """ from typing import TYPE_CHECKING import pytest import pytestskipmarkers.utils.markers if TYPE_CHECKING: from _pytest.config import Config from _pytest.config.argparsing import Parser from _pytest.nodes import Item def pytest_addoption(parser: "Parser") -> None: """ Register argparse-style options and ini-style config values. """ test_selection_group = parser.getgroup("Tests Selection") test_selection_group.addoption( "--run-destructive", action="store_true", default=False, help="Run destructive tests. These tests can include adding " "or removing users from your system for example. " "Default: False", ) test_selection_group.addoption( "--run-expensive", action="store_true", default=False, help="Run expensive tests. These tests usually involve costs " "like for example bootstrapping a cloud VM. " "Default: False", ) @pytest.hookimpl(tryfirst=True) # type: ignore[misc] def pytest_runtest_setup(item: "Item") -> None: """ Fixtures injection based on markers or test skips based on CLI arguments. """ __tracebackhide__ = True pytestskipmarkers.utils.markers.evaluate_markers(item) @pytest.mark.trylast # type: ignore[misc] def pytest_configure(config: "Config") -> None: """ Configure the plugin. called after command line options have been parsed and all plugins and initial conftest files been loaded. """ # Expose the markers we use to pytest CLI config.addinivalue_line( "markers", "destructive_test: Run destructive tests. These tests can include adding " "or removing users from your system for example.", ) config.addinivalue_line( "markers", "expensive_test: Run expensive tests. These tests can include starting resources " "which cost money, like VMs, for example.", ) config.addinivalue_line( "markers", "skip_if_not_root: Skip if the current user is not root on non windows platforms or not " "Administrator on windows platforms", ) config.addinivalue_line("markers", "skip_if_not_root: Skip if the current user is not `root`.") config.addinivalue_line( "markers", "skip_if_binaries_missing(*binaries, check_all=True, message=None):" "If 'check_all' is True, all binaries must exist." "If 'check_all' is False, then only one the passed binaries needs to be found. Usefull when, " "for example, passing a list of python interpreter names(python3.5, python3, python), where " "only one needs to exist.", ) config.addinivalue_line( "markers", "requires_network(only_local_network=False): Skip if no networking is set up. " "If 'only_local_network' is 'True', only the local network is checked.", ) # Platform Skip Markers config.addinivalue_line( "markers", "skip_on_windows: Skip test on Windows", ) config.addinivalue_line( "markers", "skip_unless_on_windows: Skip test unless on Windows", ) config.addinivalue_line( "markers", "skip_on_linux: Skip test on Linux", ) config.addinivalue_line( "markers", "skip_unless_on_linux: Skip test unless on Linux", ) config.addinivalue_line( "markers", "skip_on_darwin: Skip test on Darwin", ) config.addinivalue_line( "markers", "skip_unless_on_darwin: Skip test unless on Darwin", ) config.addinivalue_line( "markers", "skip_on_sunos: Skip test on SunOS", ) config.addinivalue_line( "markers", "skip_unless_on_sunos: Skip test unless on SunOS", ) config.addinivalue_line( "markers", "skip_on_smartos: Skip test on SmartOS", ) config.addinivalue_line( "markers", "skip_unless_on_smartos: Skip test unless on SmartOS", ) config.addinivalue_line( "markers", "skip_on_freebsd: Skip test on FreeBSD", ) config.addinivalue_line( "markers", "skip_unless_on_freebsd: Skip test unless on FreeBSD", ) config.addinivalue_line( "markers", "skip_on_netbsd: Skip test on NetBSD", ) config.addinivalue_line( "markers", "skip_unless_on_netbsd: Skip test unless on NetBSD", ) config.addinivalue_line( "markers", "skip_on_openbsd: Skip test on OpenBSD", ) config.addinivalue_line( "markers", "skip_unless_on_openbsd: Skip test unless on OpenBSD", ) config.addinivalue_line( "markers", "skip_on_aix: Skip test on AIX", ) config.addinivalue_line( "markers", "skip_unless_on_aix: Skip test unless on AIX", ) config.addinivalue_line( "markers", "skip_on_aarch64: Skip test on AArch64", ) config.addinivalue_line( "markers", "skip_unless_on_aarch64: Skip test unless on AArch64", ) config.addinivalue_line( "markers", "skip_on_photonos: Skip test on PhotonOS", ) config.addinivalue_line( "markers", "skip_unless_on_photonos: Skip test unless on PhotonOS", ) config.addinivalue_line( "markers", "skip_on_spawning_platform: Skip test on spawning platforms", ) config.addinivalue_line( "markers", "skip_unless_on_spawning_platform: Skip test unless on spawning platforms", ) config.addinivalue_line( "markers", "skip_on_platforms(windows=False, linux=False, darwin=False, sunos=False, smartos=False, freebsd=False, " "netbsd=False, openbsd=False, aix=False, aarch64=False, spawning=False, photonos=False): Pass True to " "one or more keywords to get the test skipped.", ) config.addinivalue_line( "markers", "skip_unless_on_platforms(windows=False, linux=False, darwin=False, sunos=False, smartos=False, freebsd=False, " "netbsd=False, openbsd=False, aix=False, aarch64=False, spawning=False, photonos=False): Pass True to " "one or more keywords to get the test skipped unless matched.", ) config.addinivalue_line( "markers", "skip_on_env(envvar, present=True, eq=None, ne=None): Skip test based on environment variables presence " "and contents.", ) pytest-skip-markers-1.3.0/src/pytestskipmarkers/py.typed0000644000000000000000000000000014236250622022271 0ustar00rootrootpytest-skip-markers-1.3.0/src/pytestskipmarkers/utils/0000755000000000000000000000000014236250622021744 5ustar00rootrootpytest-skip-markers-1.3.0/src/pytestskipmarkers/utils/__init__.py0000644000000000000000000000000014236250622024043 0ustar00rootrootpytest-skip-markers-1.3.0/src/pytestskipmarkers/utils/markers.py0000644000000000000000000010071514236250622023766 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ PyTest Markers related utilities. .. PYTEST_DONT_REWRITE """ import contextlib import logging import os import shutil from typing import Any from typing import cast from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import TYPE_CHECKING from typing import Union import _pytest._version import pytest import pytestskipmarkers.utils.platform import pytestskipmarkers.utils.ports as ports import pytestskipmarkers.utils.socket as socket if TYPE_CHECKING: from _pytest.nodes import Item PYTEST_GE_7 = getattr(_pytest._version, "version_tuple", (-1, -1)) >= (7, 0) log = logging.getLogger(__name__) def skip_if_not_root() -> Optional[str]: """ Helper function to check for root/Administrator privileges. Returns: str: The reason of the skip """ if not pytestskipmarkers.utils.platform.is_windows(): if os.getuid() != 0: return "You must be logged in as root to run this test" else: from pytestskipmarkers.utils import win_functions current_user = win_functions.get_current_user() if TYPE_CHECKING: assert current_user if current_user != "SYSTEM": if not win_functions.is_admin(cast(str, current_user)): return "You must be logged in as an Administrator to run this test" return None def skip_if_binaries_missing( binaries: Union[List[str], Tuple[str, ...]], check_all: bool = True, reason: Optional[str] = None, ) -> Optional[str]: """ Helper function to check for existing binaries. Args: binaries (list or tuple): Iterator of binaries to check check_all (bool): If ``check_all`` is ``True``, the default, all binaries must exist. If ``check_all`` is ``False``, then only one the passed binaries needs to be found. Useful when, for example, passing a list of python interpreter names(python3.5, python3, python), where only one needs to exist. reason (str): The skip reason. Returns: str: The reason for the skip. None: Should not be skipped. """ if check_all is False: # We only need one of the passed binaries to exist for binary in binaries: if shutil.which(binary) is not None: break else: if reason is not None: return reason return "None of the following binaries was found: {}".format(", ".join(binaries)) else: for binary in binaries: if shutil.which(binary) is None: if reason is not None: return reason return "The '{}' binary was not found".format(binary) log.debug("All binaries found. Searched for: %s", ", ".join(binaries)) return None def skip_if_no_local_network() -> Optional[str]: """ Helper function to check for existing local network. Returns: str: The reason for the skip. None: Should not be skipped. """ check_port = ports.get_unused_localhost_port() has_local_network = False try: with contextlib.closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as pubsock: pubsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) pubsock.bind(("", check_port)) has_local_network = True except OSError: # I wonder if we just have IPV6 support? try: with contextlib.closing(socket.socket(socket.AF_INET6, socket.SOCK_STREAM)) as pubsock: pubsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) pubsock.bind(("", check_port)) has_local_network = True except OSError: # Let's continue pass if has_local_network is False: return "No local network was detected" return None def skip_if_no_remote_network() -> Optional[str]: """ Helper function to check for existing remote network(internet). Returns: str: The reason for the skip. None: Should not be skipped. """ if os.environ.get("NO_INTERNET"): return "Environment variable NO_INTERNET is set" # We are using the google.com DNS records as numerical IPs to avoid # DNS look ups which could greatly slow down this check has_remote_network = False for addr in ( "172.217.17.14", "172.217.16.238", "173.194.41.198", "173.194.41.199", "173.194.41.200", "173.194.41.201", "173.194.41.206", "173.194.41.192", "173.194.41.193", "173.194.41.194", "173.194.41.195", "173.194.41.196", "173.194.41.197", "216.58.201.174", ): try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(0.25) sock.connect((addr, 80)) sock.close() # We connected? Stop the loop has_remote_network = True break except OSError: # Let's check the next IP continue if has_remote_network is False: return "No internet network connection was detected" return None def skip_on_env( varname: str, present: bool = True, eq: Optional[str] = None, ne: Optional[str] = None, reason: Optional[str] = None, ) -> Optional[str]: """ Helper function to check for environment variables. If any of the checks match, return the skip reason. Args: varname(str): The environment variable to check present(bool): When ``True``, skip if variable is present in the environment. When ``False``, skip if variable is not present in the environment. eq(str): Skips when the variable is present in the environment and matches this value. ne(str): Skips when the variable is present in the environment and does not match this value. reason(str): The custom reason message to use. Returns: str: The skip reason None: Should not be skipped. """ if eq and ne: raise pytest.UsageError("Cannot pass both `eq` and `ne`.") if present is False and (eq or ne): raise pytest.UsageError("Cannot pass `present=False` and either `eq` or `ne`.") if present is False and varname not in os.environ: if not reason: reason = f"The variable '{varname}' is not present in the environ." return reason elif present is True and varname in os.environ: varname_value = os.environ[varname] if eq: if varname_value == eq: if not reason: reason = f"'{varname}' present in environ and '{varname}=={eq}'" elif ne: if varname_value != ne: if not reason: reason = f"'{varname}' present in environ and '{varname}!={eq}'" elif not reason: reason = f"The variable '{varname}' is present in the environ." return reason return None def evaluate_markers(item: "Item") -> None: """ Fixtures injection based on markers or test skips based on CLI arguments. """ exc_kwargs = {} if PYTEST_GE_7: exc_kwargs["_use_item_location"] = True destructive_tests_marker = item.get_closest_marker("destructive_test") if destructive_tests_marker is not None: if destructive_tests_marker.args or destructive_tests_marker.kwargs: raise pytest.UsageError( "The 'destructive_test' marker does not accept any arguments or keyword arguments" ) if item.config.getoption("--run-destructive") is False: raise pytest.skip.Exception("Destructive tests are disabled", **exc_kwargs) expensive_tests_marker = item.get_closest_marker("expensive_test") if expensive_tests_marker is not None: if expensive_tests_marker.args or expensive_tests_marker.kwargs: raise pytest.UsageError( "The 'expensive_test' marker does not accept any arguments or keyword arguments" ) if item.config.getoption("--run-expensive") is False: raise pytest.skip.Exception("Expensive tests are disabled", **exc_kwargs) skip_if_not_root_marker = item.get_closest_marker("skip_if_not_root") if skip_if_not_root_marker is not None: if skip_if_not_root_marker.args or skip_if_not_root_marker.kwargs: raise pytest.UsageError( "The 'skip_if_not_root' marker does not accept any arguments or keyword arguments" ) skip_reason = skip_if_not_root() if skip_reason: raise pytest.skip.Exception(skip_reason, **exc_kwargs) skip_if_binaries_missing_marker = item.get_closest_marker("skip_if_binaries_missing") if skip_if_binaries_missing_marker is not None: binaries = skip_if_binaries_missing_marker.args if not binaries: raise pytest.UsageError( "The 'skip_if_binaries_missing' marker needs at least one binary name to be passed" ) for arg in binaries: if not isinstance(arg, str): raise pytest.UsageError( "The 'skip_if_binaries_missing' marker only accepts strings as arguments. If you are " "trying to pass multiple binaries, each binary should be an separate argument." ) message = cast(Dict[str, Any], skip_if_binaries_missing_marker.kwargs).pop("message", None) if message: item.warn( pytest.PytestWarning( """Please stop passing 'message="{0}"' and instead pass 'reason="{0}"'""".format( message ) ) ) cast(Dict[str, Any], skip_if_binaries_missing_marker.kwargs)["reason"] = message skip_reason = skip_if_binaries_missing(binaries, **skip_if_binaries_missing_marker.kwargs) if skip_reason: raise pytest.skip.Exception(skip_reason, **exc_kwargs) requires_network_marker = item.get_closest_marker("requires_network") if requires_network_marker is not None: only_local_network = requires_network_marker.kwargs.get("only_local_network", False) local_skip_reason = skip_if_no_local_network() if local_skip_reason: # Since we're only supposed to check local network, and no # local network was detected, skip the test raise pytest.skip.Exception(local_skip_reason, **exc_kwargs) if only_local_network is False: remote_skip_reason = skip_if_no_remote_network() if remote_skip_reason: raise pytest.skip.Exception(remote_skip_reason, **exc_kwargs) # Platform Skip Markers skip_on_windows_marker = item.get_closest_marker("skip_on_windows") if skip_on_windows_marker is not None: if skip_on_windows_marker.args: raise pytest.UsageError("The skip_on_windows marker does not accept any arguments") reason = cast(Dict[str, Any], skip_on_windows_marker.kwargs).pop("reason", None) if skip_on_windows_marker.kwargs: raise pytest.UsageError( "The skip_on_windows marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Skipped on Windows" if pytestskipmarkers.utils.platform.is_windows(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_windows_marker = item.get_closest_marker("skip_unless_on_windows") if skip_unless_on_windows_marker is not None: if skip_unless_on_windows_marker.args: raise pytest.UsageError( "The skip_unless_on_windows marker does not accept any arguments" ) reason = cast(Dict[str, Any], skip_unless_on_windows_marker.kwargs).pop("reason", None) if skip_unless_on_windows_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_windows marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Platform is not Windows, skipped" if not pytestskipmarkers.utils.platform.is_windows(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_linux_marker = item.get_closest_marker("skip_on_linux") if skip_on_linux_marker is not None: if skip_on_linux_marker.args: raise pytest.UsageError("The skip_on_linux marker does not accept any arguments") reason = cast(Dict[str, Any], skip_on_linux_marker.kwargs).pop("reason", None) if skip_on_linux_marker.kwargs: raise pytest.UsageError( "The skip_on_linux marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Skipped on Linux" if pytestskipmarkers.utils.platform.is_linux(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_linux_marker = item.get_closest_marker("skip_unless_on_linux") if skip_unless_on_linux_marker is not None: if skip_unless_on_linux_marker.args: raise pytest.UsageError("The skip_unless_on_linux marker does not accept any arguments") reason = cast(Dict[str, Any], skip_unless_on_linux_marker.kwargs).pop("reason", None) if skip_unless_on_linux_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_linux marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Platform is not Linux, skipped" if not pytestskipmarkers.utils.platform.is_linux(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_darwin_marker = item.get_closest_marker("skip_on_darwin") if skip_on_darwin_marker is not None: if skip_on_darwin_marker.args: raise pytest.UsageError("The skip_on_darwin marker does not accept any arguments") reason = cast(Dict[str, Any], skip_on_darwin_marker.kwargs).pop("reason", None) if skip_on_darwin_marker.kwargs: raise pytest.UsageError( "The skip_on_darwin marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Skipped on Darwin" if pytestskipmarkers.utils.platform.is_darwin(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_darwin_marker = item.get_closest_marker("skip_unless_on_darwin") if skip_unless_on_darwin_marker is not None: if skip_unless_on_darwin_marker.args: raise pytest.UsageError( "The skip_unless_on_darwin marker does not accept any arguments" ) reason = cast(Dict[str, Any], skip_unless_on_darwin_marker.kwargs).pop("reason", None) if skip_unless_on_darwin_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_darwin marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Platform is not Darwin, skipped" if not pytestskipmarkers.utils.platform.is_darwin(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_sunos_marker = item.get_closest_marker("skip_on_sunos") if skip_on_sunos_marker is not None: if skip_on_sunos_marker.args: raise pytest.UsageError("The skip_on_sunos marker does not accept any arguments") reason = cast(Dict[str, Any], skip_on_sunos_marker.kwargs).pop("reason", None) if skip_on_sunos_marker.kwargs: raise pytest.UsageError( "The skip_on_sunos marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Skipped on SunOS" if pytestskipmarkers.utils.platform.is_sunos(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_sunos_marker = item.get_closest_marker("skip_unless_on_sunos") if skip_unless_on_sunos_marker is not None: if skip_unless_on_sunos_marker.args: raise pytest.UsageError("The skip_unless_on_sunos marker does not accept any arguments") reason = cast(Dict[str, Any], skip_unless_on_sunos_marker.kwargs).pop("reason", None) if skip_unless_on_sunos_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_sunos marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Platform is not SunOS, skipped" if not pytestskipmarkers.utils.platform.is_sunos(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_smartos_marker = item.get_closest_marker("skip_on_smartos") if skip_on_smartos_marker is not None: if skip_on_smartos_marker.args: raise pytest.UsageError("The skip_on_smartos marker does not accept any arguments") reason = cast(Dict[str, Any], skip_on_smartos_marker.kwargs).pop("reason", None) if skip_on_smartos_marker.kwargs: raise pytest.UsageError( "The skip_on_smartos marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Skipped on SmartOS" if pytestskipmarkers.utils.platform.is_smartos(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_smartos_marker = item.get_closest_marker("skip_unless_on_smartos") if skip_unless_on_smartos_marker is not None: if skip_unless_on_smartos_marker.args: raise pytest.UsageError( "The skip_unless_on_smartos marker does not accept any arguments" ) reason = cast(Dict[str, Any], skip_unless_on_smartos_marker.kwargs).pop("reason", None) if skip_unless_on_smartos_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_smartos marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Platform is not SmartOS, skipped" if not pytestskipmarkers.utils.platform.is_smartos(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_freebsd_marker = item.get_closest_marker("skip_on_freebsd") if skip_on_freebsd_marker is not None: if skip_on_freebsd_marker.args: raise pytest.UsageError("The skip_on_freebsd marker does not accept any arguments") reason = cast(Dict[str, Any], skip_on_freebsd_marker.kwargs).pop("reason", None) if skip_on_freebsd_marker.kwargs: raise pytest.UsageError( "The skip_on_freebsd marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Skipped on FreeBSD" if pytestskipmarkers.utils.platform.is_freebsd(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_freebsd_marker = item.get_closest_marker("skip_unless_on_freebsd") if skip_unless_on_freebsd_marker is not None: if skip_unless_on_freebsd_marker.args: raise pytest.UsageError( "The skip_unless_on_freebsd marker does not accept any arguments" ) reason = cast(Dict[str, Any], skip_unless_on_freebsd_marker.kwargs).pop("reason", None) if skip_unless_on_freebsd_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_freebsd marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Platform is not FreeBSD, skipped" if not pytestskipmarkers.utils.platform.is_freebsd(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_netbsd_marker = item.get_closest_marker("skip_on_netbsd") if skip_on_netbsd_marker is not None: if skip_on_netbsd_marker.args: raise pytest.UsageError("The skip_on_netbsd marker does not accept any arguments") reason = cast(Dict[str, Any], skip_on_netbsd_marker.kwargs).pop("reason", None) if skip_on_netbsd_marker.kwargs: raise pytest.UsageError( "The skip_on_netbsd marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Skipped on NetBSD" if pytestskipmarkers.utils.platform.is_netbsd(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_netbsd_marker = item.get_closest_marker("skip_unless_on_netbsd") if skip_unless_on_netbsd_marker is not None: if skip_unless_on_netbsd_marker.args: raise pytest.UsageError( "The skip_unless_on_netbsd marker does not accept any arguments" ) reason = cast(Dict[str, Any], skip_unless_on_netbsd_marker.kwargs).pop("reason", None) if skip_unless_on_netbsd_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_netbsd marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Platform is not NetBSD, skipped" if not pytestskipmarkers.utils.platform.is_netbsd(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_openbsd_marker = item.get_closest_marker("skip_on_openbsd") if skip_on_openbsd_marker is not None: if skip_on_openbsd_marker.args: raise pytest.UsageError("The skip_on_openbsd marker does not accept any arguments") reason = cast(Dict[str, Any], skip_on_openbsd_marker.kwargs).pop("reason", None) if skip_on_openbsd_marker.kwargs: raise pytest.UsageError( "The skip_on_openbsd marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Skipped on OpenBSD" if pytestskipmarkers.utils.platform.is_openbsd(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_openbsd_marker = item.get_closest_marker("skip_unless_on_openbsd") if skip_unless_on_openbsd_marker is not None: if skip_unless_on_openbsd_marker.args: raise pytest.UsageError( "The skip_unless_on_openbsd marker does not accept any arguments" ) reason = cast(Dict[str, Any], skip_unless_on_openbsd_marker.kwargs).pop("reason", None) if skip_unless_on_openbsd_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_openbsd marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Platform is not OpenBSD, skipped" if not pytestskipmarkers.utils.platform.is_openbsd(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_aix_marker = item.get_closest_marker("skip_on_aix") if skip_on_aix_marker is not None: if skip_on_aix_marker.args: raise pytest.UsageError("The skip_on_aix marker does not accept any arguments") reason = cast(Dict[str, Any], skip_on_aix_marker.kwargs).pop("reason", None) if skip_on_aix_marker.kwargs: raise pytest.UsageError( "The skip_on_aix marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Skipped on AIX" if pytestskipmarkers.utils.platform.is_aix(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_aix_marker = item.get_closest_marker("skip_unless_on_aix") if skip_unless_on_aix_marker is not None: if skip_unless_on_aix_marker.args: raise pytest.UsageError("The skip_unless_on_aix marker does not accept any arguments") reason = cast(Dict[str, Any], skip_unless_on_aix_marker.kwargs).pop("reason", None) if skip_unless_on_aix_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_aix marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Platform is not AIX, skipped" if not pytestskipmarkers.utils.platform.is_aix(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_aarch64_marker = item.get_closest_marker("skip_on_aarch64") if skip_on_aarch64_marker is not None: if skip_on_aarch64_marker.args: raise pytest.UsageError("The skip_on_aarch64 marker does not accept any arguments") reason = cast(Dict[str, Any], skip_on_aarch64_marker.kwargs).pop("reason", None) if skip_on_aarch64_marker.kwargs: raise pytest.UsageError( "The skip_on_aarch64 marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Skipped on AArch64" if pytestskipmarkers.utils.platform.is_aarch64(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_aarch64_marker = item.get_closest_marker("skip_unless_on_aarch64") if skip_unless_on_aarch64_marker is not None: if skip_unless_on_aarch64_marker.args: raise pytest.UsageError( "The skip_unless_on_aarch64 marker does not accept any arguments" ) reason = cast(Dict[str, Any], skip_unless_on_aarch64_marker.kwargs).pop("reason", None) if skip_unless_on_aarch64_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_aarch64 marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Platform is not AArch64, skipped" if not pytestskipmarkers.utils.platform.is_aarch64(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_spawning_platform_marker = item.get_closest_marker("skip_on_spawning_platform") if skip_on_spawning_platform_marker is not None: if skip_on_spawning_platform_marker.args: raise pytest.UsageError( "The skip_on_spawning_platform marker does not accept any arguments" ) reason = cast(Dict[str, Any], skip_on_spawning_platform_marker.kwargs).pop("reason", None) if skip_on_spawning_platform_marker.kwargs: raise pytest.UsageError( "The skip_on_spawning_platform marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Skipped on spawning platforms" if pytestskipmarkers.utils.platform.is_spawning_platform(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_spawning_platform_marker = item.get_closest_marker( "skip_unless_on_spawning_platform" ) if skip_unless_on_spawning_platform_marker is not None: if skip_unless_on_spawning_platform_marker.args: raise pytest.UsageError( "The skip_unless_on_spawning_platform marker does not accept any arguments" ) reason = cast(Dict[str, Any], skip_unless_on_spawning_platform_marker.kwargs).pop( "reason", None ) if skip_unless_on_spawning_platform_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_spawning_platform marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Platform does not default multiprocessing to spawn, skipped" if not pytestskipmarkers.utils.platform.is_spawning_platform(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_photonos_marker = item.get_closest_marker("skip_on_photonos") if skip_on_photonos_marker is not None: if skip_on_photonos_marker.args: raise pytest.UsageError("The skip_on_photonos marker does not accept any arguments") reason = cast(Dict[str, Any], skip_on_photonos_marker.kwargs).pop("reason", None) if skip_on_photonos_marker.kwargs: raise pytest.UsageError( "The skip_on_photonos marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Skipped on PhotonOS" if pytestskipmarkers.utils.platform.is_photonos(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_unless_on_photonos_marker = item.get_closest_marker("skip_unless_on_photonos") if skip_unless_on_photonos_marker is not None: if skip_unless_on_photonos_marker.args: raise pytest.UsageError( "The skip_unless_on_photonos marker does not accept any arguments" ) reason = cast(Dict[str, Any], skip_unless_on_photonos_marker.kwargs).pop("reason", None) if skip_unless_on_photonos_marker.kwargs: raise pytest.UsageError( "The skip_unless_on_photonos marker only accepts 'reason' as a keyword argument." ) if reason is None: reason = "Platform is not PhotonOS, skipped" if not pytestskipmarkers.utils.platform.is_photonos(): raise pytest.skip.Exception(reason, **exc_kwargs) skip_on_platforms_marker = item.get_closest_marker("skip_on_platforms") if skip_on_platforms_marker is not None: if skip_on_platforms_marker.args: raise pytest.UsageError("The skip_on_platforms marker does not accept any arguments") reason = cast(Dict[str, Any], skip_on_platforms_marker.kwargs).pop("reason", None) if not skip_on_platforms_marker.kwargs: raise pytest.UsageError( "Pass at least one platform to skip_on_platforms as a keyword argument" ) if not any(skip_on_platforms_marker.kwargs.values()): raise pytest.UsageError( "Pass at least one platform with a True value to skip_on_platforms as a keyword argument" ) if reason is None: reason = "Skipped on platform match" try: if pytestskipmarkers.utils.platform.on_platforms(**skip_on_platforms_marker.kwargs): raise pytest.skip.Exception(reason, **exc_kwargs) except TypeError as exc: raise pytest.UsageError( "Passed an invalid platform to skip_on_platforms: {}".format(exc) ) skip_unless_on_platforms_marker = item.get_closest_marker("skip_unless_on_platforms") if skip_unless_on_platforms_marker is not None: if skip_unless_on_platforms_marker.args: raise pytest.UsageError( "The skip_unless_on_platforms marker does not accept any arguments" ) reason = cast(Dict[str, Any], skip_unless_on_platforms_marker.kwargs).pop("reason", None) if not skip_unless_on_platforms_marker.kwargs: raise pytest.UsageError( "Pass at least one platform to skip_unless_on_platforms as a keyword argument" ) if not any(skip_unless_on_platforms_marker.kwargs.values()): raise pytest.UsageError( "Pass at least one platform with a True value to skip_unless_on_platforms as a keyword argument" ) if reason is None: reason = "Platform(s) do not match, skipped" try: if not pytestskipmarkers.utils.platform.on_platforms( **skip_unless_on_platforms_marker.kwargs ): raise pytest.skip.Exception(reason, **exc_kwargs) except TypeError as exc: raise pytest.UsageError( "Passed an invalid platform to skip_unless_on_platforms: {}".format(exc) ) skip_on_env_marker = item.get_closest_marker("skip_on_env") if skip_on_env_marker is not None: args = list(skip_on_env_marker.args) if not args: raise pytest.UsageError( "The 'skip_on_env' marker needs at least one argument to be passed, the environment " "variable name." ) envvar = args.pop(0) if args: raise pytest.UsageError( "The 'skip_on_env' only accepts one argument, the environment variable name." ) if not isinstance(envvar, str): raise pytest.UsageError("The environment variable argument must be a string.") kwargs = cast(Dict[str, Any], skip_on_env_marker.kwargs).copy() present = kwargs.pop("present", True) eq = kwargs.pop("eq", None) ne = kwargs.pop("ne", None) reason = kwargs.pop("reason", None) if kwargs: raise pytest.UsageError( "The 'skip_on_env' marker only accepts 'present', 'eq', 'ne' and 'reason' as " "keyword arguments." ) skip_reason = skip_on_env(envvar, present=present, eq=eq, ne=ne, reason=reason) if skip_reason: raise pytest.skip.Exception(skip_reason, **exc_kwargs) pytest-skip-markers-1.3.0/src/pytestskipmarkers/utils/platform.py0000644000000000000000000001364014236250622024146 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Platform related utilities. .. PYTEST_DONT_REWRITE """ import multiprocessing import os import pathlib import platform import shutil import subprocess import sys from functools import lru_cache from typing import cast import distro @lru_cache(maxsize=None) def is_windows() -> bool: """ Simple function to return if a host is Windows or not. :return bool: Return true on Windows """ return sys.platform.startswith("win") @lru_cache(maxsize=None) def is_linux() -> bool: """ Simple function to return if a host is Linux or not. Note for a proxy minion, we need to return something else :return bool: Return true on Linux """ return sys.platform.startswith("linux") @lru_cache(maxsize=None) def is_darwin() -> bool: """ Simple function to return if a host is Darwin (macOS) or not. :return bool: Return true on Darwin(macOS) """ return sys.platform.startswith("darwin") @lru_cache(maxsize=None) def is_sunos() -> bool: """ Simple function to return if host is SunOS or not. :return bool: Return true on SunOS """ return sys.platform.startswith("sunos") @lru_cache(maxsize=None) def is_smartos() -> bool: """ Simple function to return if host is SmartOS (Illumos) or not. :return bool: Return true on SmartOS (Illumos) """ if is_sunos(): return os.uname()[3].startswith("joyent_") return False @lru_cache(maxsize=None) def is_freebsd() -> bool: """ Simple function to return if host is FreeBSD or not. :return bool: Return true on FreeBSD """ return sys.platform.startswith("freebsd") @lru_cache(maxsize=None) def is_netbsd() -> bool: """ Simple function to return if host is NetBSD or not. :return bool: Return true on NetBSD """ return sys.platform.startswith("netbsd") @lru_cache(maxsize=None) def is_openbsd() -> bool: """ Simple function to return if host is OpenBSD or not. :return bool: Return true on OpenBSD """ return sys.platform.startswith("openbsd") @lru_cache(maxsize=None) def is_aix() -> bool: """ Simple function to return if host is AIX or not. :return bool: Return true on AIX """ return sys.platform.startswith("aix") @lru_cache(maxsize=None) def is_aarch64() -> bool: """ Simple function to return if host is AArch64 or not. """ return platform.machine().startswith("aarch64") @lru_cache(maxsize=None) def is_photonos() -> bool: """ Simple function to return if host is Photon OS or not. """ osname, _, _ = (x.strip('"').strip("'") for x in distro.linux_distribution()) return cast(bool, osname == "VMware Photon OS") def is_spawning_platform() -> bool: """ Returns ``True`` if running on a platform which defaults multiprocessing to spawn. """ return multiprocessing.get_start_method(allow_none=False) == "spawn" def on_platforms( windows: bool = False, linux: bool = False, darwin: bool = False, sunos: bool = False, smartos: bool = False, freebsd: bool = False, netbsd: bool = False, openbsd: bool = False, aix: bool = False, aarch64: bool = False, spawning: bool = False, photonos: bool = False, ) -> bool: """ Check to see if we're on one of the provided platforms. :keyword bool windows: When :py:const:`True`, check if running on Windows. :keyword bool linux: When :py:const:`True`, check if running on Linux. :keyword bool darwin: When :py:const:`True`, check if running on Darwin. :keyword bool sunos: When :py:const:`True`, check if running on SunOS. :keyword bool smartos: When :py:const:`True`, check if running on SmartOS. :keyword bool freebsd: When :py:const:`True`, check if running on FreeBSD. :keyword bool netbsd: When :py:const:`True`, check if running on NetBSD. :keyword bool openbsd: When :py:const:`True`, check if running on OpenBSD. :keyword bool aix: When :py:const:`True`, check if running on AIX. :keyword bool aarch64: When :py:const:`True`, check if running on AArch64. :keyword bool spawning: When :py:const:`True`, check if running on a platform which defaults multiprocessing to spawn """ if windows and is_windows(): return True if linux and is_linux(): return True if darwin and is_darwin(): return True if sunos and is_sunos(): return True if smartos and is_smartos(): return True if freebsd and is_freebsd(): return True if netbsd and is_netbsd(): return True if openbsd and is_openbsd(): return True if aix and is_aix(): return True if aarch64 and is_aarch64(): return True if spawning and is_spawning_platform(): return True if photonos and is_photonos(): return True return False def is_fips_enabled() -> bool: """ Check is FIPS is enabled. :return bool: Return true when enabled """ if pathlib.Path("/etc/system-fips").exists(): return True kernel_fips_enabled_path = pathlib.Path("/proc/sys/crypto/fips_enabled") if ( kernel_fips_enabled_path.exists() and kernel_fips_enabled_path.read_text(encoding="utf-8").strip() == "1" ): return True sysctl_path = shutil.which("sysctl") if not sysctl_path: return False ret = subprocess.run( [sysctl_path, "crypto.fips_enabled"], check=False, shell=False, stdout=subprocess.PIPE, universal_newlines=True, ) if ret.returncode == 0: stripped_output = ret.stdout.strip() if not stripped_output: # No output? return False if "=" not in stripped_output: # Don't know how to parse this return False if stripped_output.split("=")[-1].strip() == "1": return True return False pytest-skip-markers-1.3.0/src/pytestskipmarkers/utils/ports.py0000644000000000000000000000414014236250622023464 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Ports related utility functions. """ import contextlib import logging from typing import Set import pytest from pytestskipmarkers.utils import socket log = logging.getLogger(__name__) def get_unused_localhost_port(use_cache: bool = False) -> int: """ Return a random unused port on localhost. :keyword bool use_cache: If ``use_cache`` is ``True``, consecutive calls to this function will never return the cached port. """ if not isinstance(use_cache, bool): raise pytest.UsageError( "The value of 'use_cache' needs to be an boolean, not {}".format(type(use_cache)) ) with contextlib.closing(socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM)) as usock: usock.bind(("127.0.0.1", 0)) port: int = usock.getsockname()[1] if use_cache: try: cached_ports = get_unused_localhost_port.__cached_ports__ # type: ignore[attr-defined] except AttributeError: cached_ports = get_unused_localhost_port.__cached_ports__ = set() # type: ignore[attr-defined] if port in cached_ports: return get_unused_localhost_port(use_cache=use_cache) cached_ports.add(port) return port def get_connectable_ports(ports: Set[int]) -> Set[int]: """ Returns a set of the ports where connection was successful. :param ~collections.abc.Iterable ports: An iterable of ports to try and connect to :rtype: set :return: Returns a set of the ports where connection was successful """ connectable_ports = set() ports = set(ports) for port in set(ports): with contextlib.closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock: conn = sock.connect_ex(("localhost", port)) try: if conn == 0: log.debug("Port %s is connectable!", port) connectable_ports.add(port) sock.shutdown(socket.SHUT_RDWR) except OSError: continue return connectable_ports pytest-skip-markers-1.3.0/src/pytestskipmarkers/utils/socket.py0000644000000000000000000000074114236250622023610 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Namespaced ``socket`` module. This module's sole purpose is to have the standard library :py:mod:`socket` module functions under a different namespace to be used in pytest-skip-markers so that projects using it, which need to mock :py:mod:`socket` functions, don't influence the pytest-skip-markers run time behavior. """ from socket import * # pylint: disable=wildcard-import,unused-wildcard-import pytest-skip-markers-1.3.0/src/pytestskipmarkers/utils/socket.pyi0000644000000000000000000000002514236250622023754 0ustar00rootrootfrom socket import * pytest-skip-markers-1.3.0/src/pytestskipmarkers/utils/win_functions.py0000644000000000000000000001104614236250622025205 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Windows specific functions. .. PYTEST_DONT_REWRITE """ from typing import List from typing import Union try: import pywintypes import win32api import win32net import win32security except ImportError: # pragma: no cover # This is not windows pass def is_admin(name: str) -> bool: """ Is the passed user a member of the Administrators group. Args: name (str): The name to check Returns: bool: True if user is a member of the Administrators group, False otherwise """ groups = get_user_groups(name, True) for group in groups: if group in ("S-1-5-32-544", "S-1-5-18"): return True return False def get_user_groups(name: str, sid: bool = False) -> List[str]: """ Get the groups to which a user belongs. Args: name (str): The user name to query sid (bool): True will return a list of SIDs, False will return a list of group names Returns: list: A list of group names or sids """ groups = [] if name.upper() == "SYSTEM": # 'win32net.NetUserGetLocalGroups' will fail if you pass in 'SYSTEM'. groups = ["SYSTEM"] else: try: groups = win32net.NetUserGetLocalGroups(None, name) except (win32net.error, pywintypes.error) as exc: # ERROR_ACCESS_DENIED, NERR_DCNotFound, RPC_S_SERVER_UNAVAILABLE if exc.winerror in (5, 1722, 2453, 1927, 1355): # Try without LG_INCLUDE_INDIRECT flag, because the user might # not have permissions for it or something is wrong with DC groups = win32net.NetUserGetLocalGroups(None, name, 0) else: # If this fails, try once more but instead with global groups. try: groups = win32net.NetUserGetGroups(None, name) except win32net.error as exc: if exc.winerror in (5, 1722, 2453, 1927, 1355): # Try without LG_INCLUDE_INDIRECT flag, because the user might # not have permissions for it or something is wrong with DC groups = win32net.NetUserGetLocalGroups(None, name, 0) except pywintypes.error as exc: if exc.winerror in (5, 1722, 2453, 1927, 1355): # Try with LG_INCLUDE_INDIRECT flag, because the user might # not have permissions for it or something is wrong with DC groups = win32net.NetUserGetLocalGroups(None, name, 1) else: raise if not sid: return groups ret_groups = [] for group in groups: ret_groups.append(get_sid_from_name(group)) return ret_groups def get_sid_from_name(name: str) -> str: """ This is a tool for getting a sid from a name. The name can be any object. Usually a user or a group. Args: name (str): The name of the user or group for which to get the sid Returns: str: The corresponding SID """ # If None is passed, use the Universal Well-known SID "Null SID" if name is None: name = "NULL SID" try: sid = win32security.LookupAccountName(None, name)[0] except pywintypes.error as exc: raise Exception("User {} not found: {}".format(name, exc)) from exc sidstr: str = win32security.ConvertSidToStringSid(sid) return sidstr def get_current_user(with_domain: bool = True) -> Union[str, bool]: """ Gets the user executing the process. Args: with_domain (bool): ``True`` will prepend the user name with the machine name or domain separated by a backslash Returns: str: The user name """ try: user_name: str = win32api.GetUserNameEx(win32api.NameSamCompatible) if user_name[-1] == "$": # Make the system account easier to identify. # Fetch sid so as to handle other language than English test_user: str = win32api.GetUserName() if test_user == "SYSTEM": user_name = "SYSTEM" elif get_sid_from_name(test_user) == "S-1-5-18": user_name = "SYSTEM" elif not with_domain: user_name = win32api.GetUserName() except pywintypes.error as exc: raise Exception("Failed to get current user: {}".format(exc)) from exc if not user_name: return False return user_name pytest-skip-markers-1.3.0/src/pytestskipmarkers/version.py0000644000000000000000000000005314236250622022641 0ustar00rootroot# pylint: skip-file __version__ = "1.3.0" pytest-skip-markers-1.3.0/tests/0000755000000000000000000000000014236250622015353 5ustar00rootrootpytest-skip-markers-1.3.0/tests/__init__.py0000644000000000000000000000000014236250622017452 0ustar00rootrootpytest-skip-markers-1.3.0/tests/conftest.py0000644000000000000000000000147114236250622017555 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # import pytest try: # pragma: no cover import importlib.metadata pkg_version = importlib.metadata.version except ImportError: # pragma: no cover try: import importlib_metadata pkg_version = importlib_metadata.version except ImportError: # pragma: no cover import pkg_resources def pkg_version(package): return pkg_resources.get_distribution(package).version def pkg_version_info(package): return tuple(int(part) for part in pkg_version(package).split(".") if part.isdigit()) if pkg_version_info("pytest") >= (6, 2): pytest_plugins = ["pytester"] else: @pytest.fixture def pytester(): pytest.skip("The pytester fixture is not available in Pytest < 6.2.0") pytest-skip-markers-1.3.0/tests/functional/0000755000000000000000000000000014236250622017515 5ustar00rootrootpytest-skip-markers-1.3.0/tests/functional/markers/0000755000000000000000000000000014236250622021161 5ustar00rootrootpytest-skip-markers-1.3.0/tests/functional/markers/__init__.py0000644000000000000000000000000014236250622023260 0ustar00rootrootpytest-skip-markers-1.3.0/tests/functional/test_destructive_test.py0000644000000000000000000000266114236250622024533 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.destructive_test`` marker. """ def test_run_destructive_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.destructive_test def test_one(): assert True """ ) res = pytester.runpytest() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_run_destructive_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.destructive_test def test_one(): assert True """ ) res = pytester.runpytest("--run-destructive") res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_error_on_args_or_kwargs(pytester): pytester.makepyfile( """ import pytest @pytest.mark.destructive_test("arg") def test_one(): assert True @pytest.mark.destructive_test(kwarg="arg") def test_two(): assert True """ ) res = pytester.runpytest("--run-destructive") res.assert_outcomes(errors=2) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") res.stdout.fnmatch_lines( [ "*UsageError: The 'destructive_test' marker does not accept any arguments or keyword arguments*" ] ) pytest-skip-markers-1.3.0/tests/functional/test_expensive_test.py0000644000000000000000000000263514236250622024201 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.expensive_test`` marker. """ def test_run_expensive_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.expensive_test def test_one(): assert True """ ) res = pytester.runpytest() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_run_expensive_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.expensive_test def test_one(): assert True """ ) res = pytester.runpytest("--run-expensive") res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_error_on_args_or_kwargs(pytester): pytester.makepyfile( """ import pytest @pytest.mark.expensive_test("arg") def test_one(): assert True @pytest.mark.expensive_test(kwarg="arg") def test_two(): assert True """ ) res = pytester.runpytest("--run-expensive") res.assert_outcomes(errors=2) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") res.stdout.fnmatch_lines( [ "*UsageError: The 'expensive_test' marker does not accept any arguments or keyword arguments*" ] ) pytest-skip-markers-1.3.0/tests/functional/test_requires_network.py0000644000000000000000000000351314236250622024540 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.requires_network`` marker. """ import sys from unittest import mock import pytest from pytestskipmarkers.utils import ports from pytestskipmarkers.utils import socket pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_has_local_network(pytester): pytester.makepyfile( """ import pytest @pytest.mark.requires_network def test_one(): assert True """ ) with mock.patch( "pytestskipmarkers.utils.ports.get_unused_localhost_port", side_effect=[ports.get_unused_localhost_port() for n in range(10)], ): with mock.patch("pytestskipmarkers.utils.markers.socket.socket"): res = pytester.runpytest() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_no_local_network(pytester): pytester.makepyfile( """ import pytest @pytest.mark.requires_network def test_one(): assert True """ ) mock_socket = mock.MagicMock() mock_socket.bind = mock.MagicMock(side_effect=socket.error) with mock.patch( "pytestskipmarkers.utils.ports.get_unused_localhost_port", side_effect=[ports.get_unused_localhost_port() for n in range(10)], ): with mock.patch("pytestskipmarkers.utils.markers.socket.socket", return_value=mock_socket): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") pytest-skip-markers-1.3.0/tests/functional/test_skip_if_binaries_missing.py0000644000000000000000000000347214236250622026165 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_if_binaries_missing`` marker. """ import os import sys import pytest @pytest.fixture def python_binary(): return os.path.basename(sys.executable) def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_if_binaries_missing("python9") def test_one(): assert True """ ) res = pytester.runpytest() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skipped_multiple_binaries(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_if_binaries_missing("python", "python9", check_all=True) def test_one(): assert True """ ) res = pytester.runpytest() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester, python_binary): pytester.makepyfile( """ import pytest @pytest.mark.skip_if_binaries_missing("{}") def test_one(): assert True """.format( python_binary ) ) res = pytester.runpytest_subprocess("-ra", "-vv") res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped_multiple_binaries(pytester, python_binary): pytester.makepyfile( """ import pytest @pytest.mark.skip_if_binaries_missing("{}", "pip") def test_one(): assert True """.format( python_binary ) ) res = pytester.runpytest_subprocess("-ra", "-vv") res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") pytest-skip-markers-1.3.0/tests/functional/test_skip_if_not_root.py0000644000000000000000000000441514236250622024501 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_if_not_root`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skip_if_not_root_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_if_not_root def test_one(): assert True """ ) if not sys.platform.startswith("win"): mocked_func = mock.patch("os.getuid", return_value=1000) else: mocked_func = mock.patch( "pytestskipmarkers.utils.win_functions.is_admin", return_value=False ) with mocked_func: res = pytester.runpytest() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_if_not_root_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_if_not_root def test_one(): assert True """ ) if not sys.platform.startswith("win"): mocked_func = mock.patch("os.getuid", return_value=0) else: mocked_func = mock.patch( "pytestskipmarkers.utils.win_functions.is_admin", return_value=True ) with mocked_func: res = pytester.runpytest_inprocess("-ra", "-vv") res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_error_on_args_or_kwargs(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_if_not_root("arg") def test_one(): assert True @pytest.mark.skip_if_not_root(kwarg="arg") def test_two(): assert True """ ) res = pytester.runpytest() res.assert_outcomes(errors=2) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") res.stdout.fnmatch_lines( [ "*UsageError: The 'skip_if_not_root' marker does not accept any arguments or keyword arguments*" ] ) pytest-skip-markers-1.3.0/tests/functional/test_skip_on_aarch64.py0000644000000000000000000000340614236250622024103 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_on_aarch64`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_aarch64 def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_aarch64", return_value=True): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_aarch64 def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_aarch64", return_value=False): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_aarch64(reason='Because!') def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_aarch64", return_value=True): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_on_aix.py0000644000000000000000000000351314236250622023433 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_on_aix`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_aix def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_aix", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_aix def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_aix", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_aix(reason='Because!') def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_aix", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_on_darwin.py0000644000000000000000000000353714236250622024144 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_on_darwin`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_darwin def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_darwin", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_darwin def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_darwin", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_darwin(reason='Because!') def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_darwin", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_on_env.py0000644000000000000000000000236414236250622023445 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_on_env`` marker. """ import os import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_env("FOOBAR") def test_one(): assert True """ ) with mock.patch.dict(os.environ, FOOBAR="1"): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_env("FOOBAR", eq="2") def test_one(): assert True """ ) with mock.patch.dict(os.environ, FOOBAR="1"): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") pytest-skip-markers-1.3.0/tests/functional/test_skip_on_freebsd.py0000644000000000000000000000354614236250622024272 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_on_freebsd`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_freebsd def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_freebsd", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_freebsd def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_freebsd", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_freebsd(reason='Because!') def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_freebsd", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_on_linux.py0000644000000000000000000000353014236250622024010 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_on_linux`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_linux def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_linux", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_linux def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_linux", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_linux(reason='Because!') def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_linux", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_on_netbsd.py0000644000000000000000000000353714236250622024137 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_on_netbsd`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_netbsd def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_netbsd", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_netbsd def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_netbsd", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_netbsd(reason='Because!') def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_netbsd", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_on_openbsd.py0000644000000000000000000000354614236250622024312 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_on_openbsd`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_openbsd def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_openbsd", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_openbsd def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_openbsd", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_openbsd(reason='Because!') def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_openbsd", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_on_photonos.py0000644000000000000000000000341514236250622024524 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_on_photonos`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_photonos def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_photonos", return_value=True): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_photonos def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_photonos", return_value=False): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_photonos(reason='Because!') def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_photonos", return_value=True): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_on_platforms.py0000644000000000000000000000737514236250622024673 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_on_platforms`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] @pytest.mark.parametrize( "platform", [ "windows", "linux", "darwin", "sunos", "smartos", "freebsd", "netbsd", "openbsd", "aix", "photonos", ], ) def test_skipped(pytester, platform): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_platforms({}=True) def test_one(): assert True """.format( platform ) ) return_value = True with mock.patch( "pytestskipmarkers.utils.platform.is_{}".format(platform), return_value=return_value ): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") @pytest.mark.parametrize( "platform", [ "windows", "linux", "darwin", "sunos", "smartos", "freebsd", "netbsd", "openbsd", "aix", "photonos", ], ) def test_not_skipped(pytester, platform): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_platforms({}=True) def test_one(): assert True """.format( platform ) ) return_value = False with mock.patch( "pytestskipmarkers.utils.platform.is_{}".format(platform), return_value=return_value ): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_platforms(windows=True, reason='Because!') def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_windows", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) def test_no_platforms(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_platforms def test_one(): assert True """ ) res = pytester.runpytest_inprocess() res.stdout.fnmatch_lines( ["*UsageError: Pass at least one platform to skip_on_platforms as a keyword argument"] ) def test_all_platforms_false(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_platforms(windows=False, linux=False) def test_one(): assert True """ ) res = pytester.runpytest_inprocess() res.stdout.fnmatch_lines( [ "*UsageError: Pass at least one platform with a True value to skip_on_platforms as a keyword argument" ] ) def test_unknown_platform(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_platforms(car=True) def test_one(): assert True """ ) res = pytester.runpytest_inprocess() res.stdout.fnmatch_lines( [ "*UsageError: Passed an invalid platform to skip_on_platforms: " "on_platforms() got an unexpected keyword argument 'car'" ] ) pytest-skip-markers-1.3.0/tests/functional/test_skip_on_smartos.py0000644000000000000000000000354614236250622024350 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_on_smartos`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_smartos def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_smartos", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_smartos def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_smartos", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_smartos(reason='Because!') def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_smartos", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_on_spawning_platform.py0000644000000000000000000000351414236250622026405 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_on_spawning_platform`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_spawning_platform def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_spawning_platform", return_value=True): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_spawning_platform def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_spawning_platform", return_value=False): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_spawning_platform(reason='Because!') def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_spawning_platform", return_value=True): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_on_sunos.py0000644000000000000000000000353014236250622024020 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_on_sunos`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_sunos def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_sunos", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_sunos def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_sunos", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_sunos(reason='Because!') def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_sunos", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_on_windows.py0000644000000000000000000000354614236250622024352 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_on_windows`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_windows def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_windows", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_windows def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_windows", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_on_windows(reason='Because!') def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_windows", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_unless_on_aarch64.py0000644000000000000000000000344314236250622025475 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_unless_on_aarch64`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_aarch64 def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_aarch64", return_value=False): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_aarch64 def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_aarch64", return_value=True): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_aarch64(reason='Because!') def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_aarch64", return_value=False): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_unless_on_aix.py0000644000000000000000000000354714236250622025033 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_unless_on_aix`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_aix def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_aix", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_aix def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_aix", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_aix(reason='Because!') def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_aix", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_unless_on_darwin.py0000644000000000000000000000357414236250622025536 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_unless_on_darwin`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_darwin def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_darwin", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_darwin def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_darwin", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_darwin(reason='Because!') def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_darwin", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_unless_on_freebsd.py0000644000000000000000000000360314236250622025655 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_unless_on_freebsd`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_freebsd def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_freebsd", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_freebsd def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_freebsd", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_freebsd(reason='Because!') def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_freebsd", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_unless_on_linux.py0000644000000000000000000000356514236250622025411 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_unless_on_linux`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_linux def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_linux", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_linux def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_linux", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_linux(reason='Because!') def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_linux", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_unless_on_netbsd.py0000644000000000000000000000357414236250622025531 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_unless_on_netbsd`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_netbsd def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_netbsd", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_netbsd def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_netbsd", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_netbsd(reason='Because!') def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_netbsd", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_unless_on_openbsd.py0000644000000000000000000000360314236250622025675 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_unless_on_openbsd`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_openbsd def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_openbsd", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_openbsd def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_openbsd", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_openbsd(reason='Because!') def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_openbsd", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_unless_on_photonos.py0000644000000000000000000000345214236250622026116 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_unless_on_photonos`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_photonos def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_photonos", return_value=False): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_photonos def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_photonos", return_value=True): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_photonos(reason='Because!') def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_photonos", return_value=False): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_unless_on_platforms.py0000644000000000000000000001030114236250622026243 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_unless_on_platforms`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] @pytest.mark.parametrize( "platform", [ "windows", "linux", "darwin", "sunos", "smartos", "freebsd", "netbsd", "openbsd", "aix", "aarch64", "spawning", ], ) def test_skipped(pytester, platform): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_platforms({}=True) def test_one(): assert True """.format( platform ) ) return_value = False if platform == "spawning": patch_target = "pytestskipmarkers.utils.platform.is_{}_platform".format(platform) else: patch_target = "pytestskipmarkers.utils.platform.is_{}".format(platform) with mock.patch(patch_target, return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") @pytest.mark.parametrize( "platform", [ "windows", "linux", "darwin", "sunos", "smartos", "freebsd", "netbsd", "openbsd", "aix", "aarch64", "spawning", ], ) def test_not_skipped(pytester, platform): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_platforms({}=True) def test_one(): assert True """.format( platform ) ) return_value = True if platform == "spawning": patch_target = "pytestskipmarkers.utils.platform.is_{}_platform".format(platform) else: patch_target = "pytestskipmarkers.utils.platform.is_{}".format(platform) with mock.patch(patch_target, return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_platforms(windows=True, reason='Because!') def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_windows", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) def test_no_platforms(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_platforms def test_one(): assert True """ ) res = pytester.runpytest_inprocess() res.stdout.fnmatch_lines( [ "*UsageError: Pass at least one platform to skip_unless_on_platforms as a keyword argument" ] ) def test_all_platforms_false(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_platforms(windows=False, linux=False) def test_one(): assert True """ ) res = pytester.runpytest_inprocess() res.stdout.fnmatch_lines( [ "*UsageError: Pass at least one platform with a True value to " "skip_unless_on_platforms as a keyword argument" ] ) def test_unknown_platform(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_platforms(car=True) def test_one(): assert True """ ) res = pytester.runpytest_inprocess() res.stdout.fnmatch_lines( [ "*UsageError: Passed an invalid platform to skip_unless_on_platforms: " "on_platforms() got an unexpected keyword argument 'car'" ] ) pytest-skip-markers-1.3.0/tests/functional/test_skip_unless_on_smartos.py0000644000000000000000000000360314236250622025733 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_unless_on_smartos`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_smartos def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_smartos", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_smartos def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_smartos", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_smartos(reason='Because!') def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_smartos", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_unless_on_spawning_platform.py0000644000000000000000000000355114236250622027777 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_unless_on_spawning_platform`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_spawning_platform def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_spawning_platform", return_value=False): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_spawning_platform def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_spawning_platform", return_value=True): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_spawning_platform(reason='Because!') def test_one(): assert True """ ) with mock.patch("pytestskipmarkers.utils.platform.is_spawning_platform", return_value=False): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_unless_on_sunos.py0000644000000000000000000000356514236250622025421 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_unless_on_sunos`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_sunos def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_sunos", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_sunos def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_sunos", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_sunos(reason='Because!') def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_sunos", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/functional/test_skip_unless_on_windows.py0000644000000000000000000000360314236250622025735 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the ``@pytest.mark.skip_unless_on_windows`` marker. """ import sys from unittest import mock import pytest pytestmark = [ pytest.mark.skipif( sys.platform.startswith("win") and sys.version_info >= (3, 8) and sys.version_info < (3, 10), reason="PyTest's capture and pytester.runpytest_inprocess looks broken on Windows and Py(>3.8,<3.10)", ), ] def test_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_windows def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_windows", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(skipped=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_not_skipped(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_windows def test_one(): assert True """ ) return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_windows", return_value=return_value): res = pytester.runpytest_inprocess() res.assert_outcomes(passed=1) res.stdout.no_fnmatch_line("*PytestUnknownMarkWarning*") def test_skip_reason(pytester): pytester.makepyfile( """ import pytest @pytest.mark.skip_unless_on_windows(reason='Because!') def test_one(): assert True """ ) return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_windows", return_value=return_value): res = pytester.runpytest_inprocess("-ra", "-s", "-vv") res.assert_outcomes(skipped=1) res.stdout.fnmatch_lines(["SKIPPED * test_skip_reason.py:*: Because!"]) pytest-skip-markers-1.3.0/tests/unit/0000755000000000000000000000000014236250622016332 5ustar00rootrootpytest-skip-markers-1.3.0/tests/unit/__init__.py0000644000000000000000000000000014236250622020431 0ustar00rootrootpytest-skip-markers-1.3.0/tests/unit/utils/0000755000000000000000000000000014236250622017472 5ustar00rootrootpytest-skip-markers-1.3.0/tests/unit/utils/__init__.py0000644000000000000000000000000014236250622021571 0ustar00rootrootpytest-skip-markers-1.3.0/tests/unit/utils/markers/0000755000000000000000000000000014236250622021136 5ustar00rootrootpytest-skip-markers-1.3.0/tests/unit/utils/markers/__init__.py0000644000000000000000000000000014236250622023235 0ustar00rootrootpytest-skip-markers-1.3.0/tests/unit/utils/markers/test_skip_if_binaries_missing.py0000644000000000000000000000437414236250622027610 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the "skip_if_binaries_missing" marker helper. """ import os import sys import pytest import pytestskipmarkers.utils.markers as markers @pytest.fixture def python_binary(): return os.path.basename(sys.executable) def test_single_existing(python_binary): assert markers.skip_if_binaries_missing([python_binary]) is None def test_multiple_existing(python_binary): assert markers.skip_if_binaries_missing([python_binary, "pip"]) is None def test_single_non_existing_with_message(): reason = markers.skip_if_binaries_missing(["python9"], reason="Dam!") assert reason is not None assert reason == "Dam!" def test_multiple_one_missing(python_binary): reason = markers.skip_if_binaries_missing([python_binary, "pip9"]) assert reason is not None assert reason == "The 'pip9' binary was not found" def test_multiple_all_missing(): reason = markers.skip_if_binaries_missing(["python9", "pip9"]) assert reason is not None assert reason == "The 'python9' binary was not found" def test_multiple_one_missing_check_all_false(python_binary): reason = markers.skip_if_binaries_missing([python_binary, "pip9"], check_all=False) # We should get no message back because the python binary is found assert reason is None, reason reason = markers.skip_if_binaries_missing(["python9", "pip"], check_all=False) # We should get no message back because the pip binary is found assert reason is None, reason def test_multiple_one_missing_check_all_false_with_message(python_binary): reason = markers.skip_if_binaries_missing( [python_binary, "pip9"], reason="Dam!", check_all=False ) # We should get no message back because the python binary is found assert reason is None def test_multiple_missing_check_all_false(): reason = markers.skip_if_binaries_missing(["python9", "pip9"], check_all=False) assert reason is not None assert reason == "None of the following binaries was found: python9, pip9" def test_multiple_missing_check_all_false_with_message(): reason = markers.skip_if_binaries_missing(["python9", "pip9"], reason="Dam!", check_all=False) assert reason is not None assert reason == "Dam!" pytest-skip-markers-1.3.0/tests/unit/utils/markers/test_skip_if_no_local_network.py0000644000000000000000000000167114236250622027617 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the "skip_if_no_local_network" marker helper. """ from unittest import mock import pytestskipmarkers.utils.markers as markers from pytestskipmarkers.utils import ports from pytestskipmarkers.utils import socket def test_has_local_network(): assert markers.skip_if_no_local_network() is None def test_no_local_network(): mock_socket = mock.MagicMock() mock_socket.bind = mock.MagicMock(side_effect=socket.error) with mock.patch( "pytestskipmarkers.utils.ports.get_unused_localhost_port", side_effect=[ports.get_unused_localhost_port() for n in range(10)], ): with mock.patch("pytestskipmarkers.utils.markers.socket.socket", return_value=mock_socket): skip_reason = markers.skip_if_no_local_network() assert skip_reason is not None assert skip_reason == "No local network was detected" pytest-skip-markers-1.3.0/tests/unit/utils/markers/test_skip_if_no_remote_network.py0000644000000000000000000000213614236250622030015 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the "skip_if_no_remote_network" marker helper. """ import os from unittest import mock import pytestskipmarkers.utils.markers as markers from pytestskipmarkers.utils import socket def test_has_remote_network(): with mock.patch("pytestskipmarkers.utils.markers.socket.socket"): assert markers.skip_if_no_remote_network() is None def test_no_remote_network(): mock_socket = mock.MagicMock() mock_socket.connect = mock.MagicMock(side_effect=socket.error) with mock.patch("pytestskipmarkers.utils.markers.socket.socket", return_value=mock_socket): skip_reason = markers.skip_if_no_remote_network() assert skip_reason is not None assert skip_reason == "No internet network connection was detected" def test_remote_network_with_no_internet_env_variable(): with mock.patch.dict(os.environ, {"NO_INTERNET": "1"}): skip_reason = markers.skip_if_no_remote_network() assert skip_reason is not None assert skip_reason == "Environment variable NO_INTERNET is set" pytest-skip-markers-1.3.0/tests/unit/utils/markers/test_skip_if_not_root.py0000644000000000000000000000171214236250622026117 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the "skip_if_not_root" marker helper. """ import sys from unittest import mock import pytestskipmarkers.utils.markers def test_when_root(): if sys.platform.startswith("win"): with mock.patch("pytestskipmarkers.utils.win_functions.is_admin", return_value=True): assert pytestskipmarkers.utils.markers.skip_if_not_root() is None else: with mock.patch("os.getuid", return_value=0): assert pytestskipmarkers.utils.markers.skip_if_not_root() is None def test_when_not_root(): if sys.platform.startswith("win"): with mock.patch("pytestskipmarkers.utils.win_functions.is_admin", return_value=False): assert pytestskipmarkers.utils.markers.skip_if_not_root() is not None else: with mock.patch("os.getuid", return_value=1): assert pytestskipmarkers.utils.markers.skip_if_not_root() is not None pytest-skip-markers-1.3.0/tests/unit/utils/markers/test_skip_on_env.py0000644000000000000000000000244214236250622025063 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the "skip_on_env" marker helper. """ import logging import os from unittest import mock import pytest import pytestskipmarkers.utils.markers as markers log = logging.getLogger(__name__) def test_not_present_and_eq(): with pytest.raises(pytest.UsageError): markers.skip_on_env("FOOBAR", present=False, eq="1") def test_not_present_and_ne(): with pytest.raises(pytest.UsageError): markers.skip_on_env("FOOBAR", present=False, ne="1") def test_present_and_eq_and_ne(): with pytest.raises(pytest.UsageError): markers.skip_on_env("FOOBAR", eq="1", ne="1") def test_present_true(): with mock.patch.dict(os.environ, FOO="1"): assert markers.skip_on_env("FOO") is not None def test_present_false(): assert markers.skip_on_env(__name__.upper(), present=False) is not None def test_present_true_and_eq(): with mock.patch.dict(os.environ, FOO="1"): assert markers.skip_on_env("FOO", eq="1") is not None assert markers.skip_on_env("FOO", eq="2") is None def test_present_true_and_ne(): with mock.patch.dict(os.environ, FOO="1"): assert markers.skip_on_env("FOO", ne="2") is not None assert markers.skip_on_env("FOO", ne="1") is None pytest-skip-markers-1.3.0/tests/unit/utils/test_platform.py0000644000000000000000000001743614236250622022742 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Tests for pytestskipmarkers.utils.platform. """ import logging import subprocess from unittest import mock import pytest import pytestskipmarkers.utils.platform log = logging.getLogger(__name__) @pytest.fixture(autouse=True) def reset_lru_cache(): for name in dir(pytestskipmarkers.utils.platform): if not name.startswith("is_"): continue func = getattr(pytestskipmarkers.utils.platform, name, None) if func: try: func.cache_clear() log.debug("Called %s.cache_clear()", func.__qualname__) except AttributeError: pass try: yield finally: for name in dir(pytestskipmarkers.utils.platform): if not name.startswith("is_"): continue func = getattr(pytestskipmarkers.utils.platform, name, None) if func: try: func.cache_clear() log.debug("Called %s.cache_clear()", func.__qualname__) except AttributeError: pass def test_is_linux(): return_value = True with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="linux")): assert pytestskipmarkers.utils.platform.is_linux() is return_value def test_is_not_linux(): return_value = False with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="win32")): assert pytestskipmarkers.utils.platform.is_linux() is return_value def test_is_darwin(): return_value = True with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="darwin")): assert pytestskipmarkers.utils.platform.is_darwin() is return_value def test_is_not_darwin(): return_value = False with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="linux")): assert pytestskipmarkers.utils.platform.is_darwin() is return_value def test_is_windows(): return_value = True with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="win32")): assert pytestskipmarkers.utils.platform.is_windows() is return_value def test_is_not_windows(): return_value = False with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="linux")): assert pytestskipmarkers.utils.platform.is_windows() is return_value def test_is_sunos(): return_value = True with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="sunos")): assert pytestskipmarkers.utils.platform.is_sunos() is return_value def test_is_not_sunos(): return_value = False with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="linux")): assert pytestskipmarkers.utils.platform.is_sunos() is return_value @pytest.mark.skip_on_windows(reason="Windows does not have `os.uname()`") def test_is_smartos(): return_value = True with mock.patch("pytestskipmarkers.utils.platform.is_sunos", return_value=True), mock.patch( "os.uname", return_value=(None, None, None, "joyent_") ): assert pytestskipmarkers.utils.platform.is_smartos() is return_value def is_sunos_ids(value): return "is_sunos={}".format(value) @pytest.mark.skip_on_windows(reason="Windows does not have `os.uname()`") @pytest.mark.parametrize("is_sunos", [True, False], ids=is_sunos_ids) def test_is_not_smartos(is_sunos): return_value = False with mock.patch("pytestskipmarkers.utils.platform.is_sunos", return_value=is_sunos), mock.patch( "os.uname", return_value=(None, None, None, "joy") ): assert pytestskipmarkers.utils.platform.is_smartos() is return_value def test_is_freebsd(): return_value = True with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="freebsd")): assert pytestskipmarkers.utils.platform.is_freebsd() is return_value def test_is_not_freebsd(): return_value = False with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="linux")): assert pytestskipmarkers.utils.platform.is_freebsd() is return_value def test_is_netbsd(): return_value = True with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="netbsd")): assert pytestskipmarkers.utils.platform.is_netbsd() is return_value def test_is_not_netbsd(): return_value = False with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="linux")): assert pytestskipmarkers.utils.platform.is_netbsd() is return_value def test_is_openbsd(): return_value = True with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="openbsd")): assert pytestskipmarkers.utils.platform.is_openbsd() is return_value def test_is_not_openbsd(): return_value = False with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="freebsd")): assert pytestskipmarkers.utils.platform.is_openbsd() is return_value def test_is_aix(): return_value = True with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="aix")): assert pytestskipmarkers.utils.platform.is_aix() is return_value def test_is_not_aix(): return_value = False with mock.patch("sys.platform", new_callable=mock.PropertyMock(return_value="linux")): assert pytestskipmarkers.utils.platform.is_aix() is return_value def test_is_aarch64(): return_value = True with mock.patch("platform.machine", return_value="aarch64"): assert pytestskipmarkers.utils.platform.is_aarch64() is return_value def test_is_not_aarch64(): return_value = False with mock.patch("platform.machine", return_value="not_aarch64"): assert pytestskipmarkers.utils.platform.is_aarch64() is return_value def test_is_fips_enabled_etc_system_fips(fs): fs.create_file("/etc/system-fips") assert pytestskipmarkers.utils.platform.is_fips_enabled() is True @pytest.mark.parametrize("value, expected", [("0", False), ("1", True)]) def test_is_fips_enabled_procfs(fs, value, expected): fs.create_file("/proc/sys/crypto/fips_enabled", contents=value) assert pytestskipmarkers.utils.platform.is_fips_enabled() is expected @pytest.mark.parametrize( "output, expected", ( ("", False), ("crypto.fips_enabled", False), ("crypto.fips_enabled =", False), ("crypto.fips_enabled = 0", False), ("crypto.fips_enabled=1", True), ("crypto.fips_enabled = 1", True), ("crypto.fips_enabled = 1", True), ), ) def test_is_fips_enabled_sysctl(output, expected): subprocess_run_return_value = subprocess.CompletedProcess( # type: ignore[var-annotated] args=(), returncode=0, stdout=output, stderr=None ) with mock.patch("shutil.which", return_value="sysctl"), mock.patch( "subprocess.run", return_value=subprocess_run_return_value ): assert pytestskipmarkers.utils.platform.is_fips_enabled() is expected def test_is_spawning_platform(): with mock.patch("multiprocessing.get_start_method", return_value="spawn"): assert pytestskipmarkers.utils.platform.is_spawning_platform() is True def test_is_not_spawning_platform(): with mock.patch("multiprocessing.get_start_method", return_value="fork"): assert pytestskipmarkers.utils.platform.is_spawning_platform() is False def test_is_photonos(): return_value = True with mock.patch("distro.linux_distribution", return_value=("VMware Photon OS", "", "")): assert pytestskipmarkers.utils.platform.is_photonos() is return_value def test_is_not_photonos(): return_value = False with mock.patch("distro.linux_distribution", return_value=("NOT VMware Photon OS", "", "")): assert pytestskipmarkers.utils.platform.is_photonos() is return_value pytest-skip-markers-1.3.0/tests/unit/utils/test_ports.py0000644000000000000000000000540014236250622022251 0ustar00rootroot# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # """ Test the port related utilities. """ import functools from unittest import mock import pytest import pytestskipmarkers.utils.ports as ports_utils class MockedCreateSocket: """ This class just mocks the `socket.socket(...)` call so that we return the ports we want. """ def __init__(self, ports): self.ports = list(ports) + list(ports) def __call__(self, *args, **kwargs): port = self.ports.pop(0) # Return a MockedSocket instance return MockedSocket(port) class MockedSocket: """ This class is used so that we can return the known port in the getsockname call. """ def __init__(self, port): self.port = port def bind(self, *args, **kwargs): pass def getsockname(self): return None, self.port def close(self): pass def test_get_unused_localhost_port_cached(): """ Tests that test_get_unused_localhost_port only returns unique ports on consecutive calls. """ num_calls = 10 start_port = 1000 # The ports we're gonna get back ports = [] for port in range(start_port, start_port + num_calls): for _ in range(num_calls): # We make sure each port is repeated consecutively ports.append(port) # Hold a reference to the list of unique ports unique = set(ports) # This list will hold all ports that the function returns got_ports = [] # We'll get the unique ports with mock.patch( "pytestskipmarkers.utils.socket.socket", new_callable=functools.partial(MockedCreateSocket, ports), ): for _ in range(num_calls): got_ports.append(ports_utils.get_unused_localhost_port(use_cache=True)) assert len(got_ports) == num_calls assert set(got_ports) == unique with mock.patch( "pytestskipmarkers.utils.socket.socket", new_callable=functools.partial(MockedCreateSocket, ports + ports), ): for _ in range(num_calls): with pytest.raises(IndexError): # we won't have enough ports got_ports.append(ports_utils.get_unused_localhost_port(use_cache=True)) # Since we couldn't get repeated ports, got_ports remains as it was assert len(got_ports) == num_calls assert set(got_ports) == unique # If we don't cache the port, we'll get repeated ports with mock.patch( "pytestskipmarkers.utils.socket.socket", new_callable=functools.partial(MockedCreateSocket, ports), ): for _ in range(num_calls): got_ports.append(ports_utils.get_unused_localhost_port()) assert len(got_ports) == 2 * len(unique) assert set(got_ports) == unique