diff --git a/.github/ISSUE_TEMPLATE/bug.yaml b/.github/ISSUE_TEMPLATE/bug.yaml new file mode 100644 index 0000000..883fb8d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yaml @@ -0,0 +1,44 @@ +name: ๐Ÿ› Bug Report +description: Report a bug or unexpected behavior in โš’๏ธ Object Mother Pattern. +labels: [bug, pending] + +body: + - type: markdown + attributes: + value: Thank you for interest! Please fill out the form below to report a bug. ๐Ÿ’ฅ + + - type: textarea + id: description + validations: + required: true + attributes: + label: Description + description: | + Please explain what you are seeing and what you would expect to see. + + Please provide as much detail as possible to make understanding and solving your problem as quick as possible. ๐Ÿ™ + + - type: textarea + id: example + attributes: + label: Example Code + render: Python + description: > + If applicable, please add a self-contained, + [minimal, reproducible, example](https://stackoverflow.com/help/minimal-reproducible-example) + demonstrating the bug. + + placeholder: | + import object_mother_pattern + + ... + + - type: textarea + id: version + validations: + required: true + attributes: + label: Python, Object Mother Pattern & OS Version + render: Text + description: | + Which version of Python & CObject Mother Pattern are you using, and which Operating System? diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml new file mode 100644 index 0000000..cab3d96 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -0,0 +1,22 @@ +name: โœจ Feature Request +description: Suggest a new feature for โš’๏ธ Object Mother Pattern. +labels: [enhancement, pending] + +body: + - type: markdown + attributes: + value: Thank you for interest! Please fill out the form below to suggest a new feature. ๐Ÿš€ + + - type: textarea + id: description + validations: + required: true + attributes: + label: Description + description: | + Please give as much detail as possible about the feature you would like to suggest. ๐Ÿ™ + + You might like to add: + * A demo of how code might look when using the feature + * Your use case(s) for the feature + * Why the feature should be added to object mother pattern (as opposed to another library or just implemented in your code) diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..a7bd539 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,16 @@ +version: 2 + +updates: + - package-ecosystem: github-actions + directory: '/' + schedule: + interval: daily + commit-message: + prefix: '๐Ÿ‘ท๐Ÿป ci:' + + - package-ecosystem: pip + directory: '/' + schedule: + interval: daily + commit-message: + prefix: '๐Ÿ“ฆ build:' diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml new file mode 100644 index 0000000..8e6958d --- /dev/null +++ b/.github/workflows/codeql.yaml @@ -0,0 +1,40 @@ +name: Code Quality Pipeline + +on: + push: + branches: [master] + pull_request: + branches: [master] + types: [opened, synchronize] + schedule: + - cron: '0 0 * * 1' # Every Monday at 00:00 UTC + +permissions: + security-events: write + +jobs: + analyze: + name: Code Quality Pipeline - ${{ matrix.language }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + language: [python] + build-mode: [none] + + steps: + - name: ๐Ÿ“ฅ Checkout the repository + uses: actions/checkout@v4.2.2 + + - name: โ–ถ๏ธ CodeQL Initialization + uses: github/codeql-action/init@v3.27.9 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + queries: security-extended, security-and-quality + + - name: ๐Ÿ”ฌ CodeQL Analysis + uses: github/codeql-action/analyze@v3.27.9 + with: + category: '/language:${{matrix.language}}' diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml new file mode 100644 index 0000000..7b0e8c5 --- /dev/null +++ b/.github/workflows/coverage.yaml @@ -0,0 +1,48 @@ +name: Smokeshow Pipeline + +on: + workflow_run: + workflows: [Test Pipeline] + types: [completed] + +permissions: + statuses: write + +jobs: + smokeshow: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python-version: [3.13] + + name: Smokeshow Pipeline + timeout-minutes: 5 + steps: + - name: ๐Ÿ Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5.3.0 + with: + python-version: ${{ matrix.python-version }} + + - name: ๐Ÿ“ฆ Install dependencies + run: pip install smokeshow + + - name: ๐Ÿ“ฅ Download coverage files + uses: actions/download-artifact@v4.1.8 + with: + name: coverage-html + path: htmlcov + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + + - name: ๐Ÿ“Š Upload coverage report + run: smokeshow upload htmlcov + env: + SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage} + SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 100 + SMOKESHOW_GITHUB_CONTEXT: coverage + SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.workflow_run.head_sha }} + SMOKESHOW_AUTH_KEY: ${{ secrets.SMOKESHOW_AUTH_KEY }} diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml new file mode 100644 index 0000000..889f017 --- /dev/null +++ b/.github/workflows/format.yaml @@ -0,0 +1,54 @@ +name: Format Pipeline + +on: + push: + branches: [master] + pull_request: + branches: [master] + types: [opened, synchronize] + +permissions: + contents: write + +jobs: + format: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python-version: [3.13] + + name: Format Pipeline - Python ${{ matrix.python-version }} on ${{ matrix.os }} + timeout-minutes: 5 + steps: + - name: ๐Ÿ“ฅ Checkout the repository + uses: actions/checkout@v4.2.2 + + - name: ๐Ÿ Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5.3.0 + with: + python-version: ${{ matrix.python-version }} + + - id: cache + name: ๐Ÿ“ฆ Create cache + uses: actions/cache@v4.2.0 + with: + path: ${{ env.pythonLocation }} + key: ${{ matrix.os }}-python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements*') }} + restore-keys: ${{ matrix.os }}-python-${{ matrix.python-version }}- + + - name: ๐Ÿ“ฆ Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: make install-dev + + - name: ๐Ÿƒ Run Formatter + run: make format + + - name: ๐Ÿ“ค Commit & Push Changes + uses: EndBug/add-and-commit@v9.1.4 + with: + add: . + message: '๐Ÿ”จ refactor: run automatic formatter' + commit: --signoff + default_author: github_actions diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..4077fb4 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,50 @@ +name: Lint Pipeline + +on: + push: + branches: [master] + pull_request: + branches: [master] + types: [opened, synchronize] + +jobs: + lint: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python-version: [3.13] + + name: Lint Pipeline - Python ${{ matrix.python-version }} on ${{ matrix.os }} + timeout-minutes: 10 + steps: + - name: ๐Ÿ“ฅ Checkout the repository + uses: actions/checkout@v4.2.2 + + - name: ๐Ÿ Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5.3.0 + with: + python-version: ${{ matrix.python-version }} + + - id: cache + name: ๐Ÿ“ฆ Create cache + uses: actions/cache@v4.2.0 + with: + path: ${{ env.pythonLocation }} + key: ${{ matrix.os }}-python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements*') }} + restore-keys: ${{ matrix.os }}-python-${{ matrix.python-version }}- + + - name: ๐Ÿ“ฆ Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: make install-dev + + - name: ๐Ÿƒ Run Linter + run: make lint + + - name: ๐Ÿซ™ Store type coverage + uses: actions/upload-artifact@v4.5.0 + if: always() + with: + name: type_coverage_report_${{ matrix.os }}_${{ matrix.python-version }} + path: index.txt diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..25d5c65 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,47 @@ +name: Publish Pipeline + +on: + release: + types: [created] + +jobs: + publish: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python-version: [3.13] + + environment: + name: pypi + url: https://pypi.org/p/object-mother-pattern/ + + permissions: + id-token: write + + name: Publish Pipeline + timeout-minutes: 5 + steps: + - name: ๐Ÿ“ฅ Checkout the repository + uses: actions/checkout@v4.2.2 + + - name: ๐Ÿ Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5.3.0 + with: + python-version: ${{ matrix.python-version }} + + - name: ๐Ÿ“ฆ Install dependencies + run: pip install build + + - name: ๐Ÿ› ๏ธ Build distribution + run: python -m build + + - name: ๐Ÿซ™ Store distribution package + uses: actions/upload-artifact@v4.5.0 + with: + name: python-package-distributions + path: dist/ + + - name: ๐Ÿš€ Publish + uses: pypa/gh-action-pypi-publish@v1.12.3 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..3441511 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,129 @@ +name: Test Pipeline + +on: + push: + branches: [master] + pull_request: + branches: [master] + types: [opened, synchronize] + schedule: + - cron: '0 0 * * 1' # Every Monday at 00:00 UTC + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + python-version: [3.11, 3.12, 3.13] + + name: Test Pipeline - Python ${{ matrix.python-version }} on ${{ matrix.os }} + timeout-minutes: 15 + steps: + - name: ๐Ÿ“ฅ Checkout the repository + uses: actions/checkout@v4.2.2 + + - name: ๐Ÿ Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5.3.0 + with: + python-version: ${{ matrix.python-version }} + + - id: cache + name: ๐Ÿ“ฆ Create cache + uses: actions/cache@v4.2.0 + with: + path: ${{ env.pythonLocation }} + key: ${{ matrix.os }}-python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements*') }} + restore-keys: ${{ matrix.os }}-python-${{ matrix.python-version }}- + + - name: ๐Ÿ“ฆ Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: make install-dev + + - name: ๐Ÿ“‚ Create coverage directory + run: mkdir coverage + + - name: ๐Ÿƒ Run Tests + run: make coverage + env: + COVERAGE_FILE: coverage/.coverage_${{ matrix.os }}_python_${{ matrix.python-version }} + CONTEXT: ${{ matrix.os }}-python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements*') }} + + - name: ๐Ÿซ™ Store tests coverage + uses: actions/upload-artifact@v4.5.0 + if: always() + with: + name: coverage_${{ matrix.os }}_python_${{ matrix.python-version }} + path: coverage + include-hidden-files: true + + coverage-combine: + needs: [test] + if: always() + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python-version: [3.13] + + steps: + - name: ๐Ÿ“ฅ Checkout the repository + uses: actions/checkout@v4.2.2 + + - name: ๐Ÿ Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5.3.0 + with: + python-version: ${{ matrix.python-version }} + + - id: cache + name: ๐Ÿ“ฆ Create cache + uses: actions/cache@v4.2.0 + with: + path: ${{ env.pythonLocation }} + key: ${{ matrix.os }}-python-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'requirements*') }} + restore-keys: ${{ matrix.os }}-python-${{ matrix.python-version }}- + + - name: ๐Ÿ“ฆ Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: make install-dev + + - name: ๐Ÿ“ฅ Download coverage files + uses: actions/download-artifact@v4.1.8 + with: + merge-multiple: true + pattern: coverage_* + path: coverage + + - name: ๐Ÿƒ Combine coverage files + run: | + ls -la coverage + coverage combine coverage/.coverage_* + + - name: ๐Ÿ“Š Generate coverage report + run: | + coverage report + coverage html --show-contexts --title "Coverage for ${{ github.sha }}" + + - name: ๐Ÿซ™ Store coverage report + uses: actions/upload-artifact@v4.5.0 + with: + name: coverage-html + path: htmlcov + + # This job does nothing and is only used for the branch protection + check-all: + needs: [test] + if: always() + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + + steps: + - name: โœ… All tests passed + uses: re-actors/alls-green@v1.2.2 + with: + jobs: ${{ toJSON(needs) }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0485b20 --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +#################### Files to exclude #################### +# Log files +*.log + +# Environment files +**.env** + +# Lintting files +.coverage +index.txt + +################### Folders to exclude ################### +# all IDE folders +**vscode** +**idea** + +# all cache folders +**cache** + +# all environment folders +**env** + +# all logs folders +**logs** + +# all files/folders with "___" (3 underscores) in the name +**___** + +# all files inside dist folder +dist/** + +################## Files not to exclude ################## +!.env.example + +################# Folders not to exclude ################# diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..15ad7c3 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,61 @@ +# Documentation: https://pre-commit.com + +# General flags +fail_fast: true # If there is an error it will fail the test + +default_language_version: + python: python3.13 + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: no-commit-to-branch + name: ๐Ÿ›ก๏ธ Protected Branches Checker + args: + - --branch=master + pass_filenames: false + stages: + - pre-commit + - pre-push + + - id: check-added-large-files + name: ๐Ÿ“ฆ Large Files Checker + args: + - --maxkb=100 + stages: + - pre-commit + + - id: check-case-conflict + name: ๐Ÿ”  Case Conflict Checker + stages: + - pre-commit + + - id: check-json + name: ๐Ÿ“„ JSON Files Checker + files: '.*\.json' + stages: + - pre-commit + + - id: check-toml + name: ๐Ÿ“„ TOML Files Checker + files: '.*\.toml' + stages: + - pre-commit + + - id: check-yaml + name: ๐Ÿ“„ YAML Files Checker + files: '.*\.ya?ml' + args: + - --unsafe + stages: + - pre-commit + + - repo: https://github.com/gitleaks/gitleaks + rev: v8.20.1 + hooks: + - id: gitleaks + name: ๐Ÿ” Secrets Checker + stages: + - pre-commit + - pre-push diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..8f80931 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) (2024-2025) adriamontoto + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2611e73 --- /dev/null +++ b/Makefile @@ -0,0 +1,68 @@ +FULL_SOURCES = object_mother_pattern tests +SOURCES = object_mother_pattern +CONFIGURATION_FILE = pyproject.toml + + +.PHONY: help +help: # Display this help + @echo "Usage: make [COMMAND] [OPTIONS]..." + @awk 'BEGIN {FS = ":.*#"; printf "\nCommands:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?#/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + + +.PHONY: install +install: # Install dependencies + @make install-dev + + +.PHONY: install-dev +install-dev: # Install development dependencies + @pip install --requirement requirements_dev.txt + + +.PHONY: install-prod +install-prod: # Install production dependencies + @pip install --requirement requirements.txt + + +.PHONY: format +format: # Automatically format python code + @ruff check $(FULL_SOURCES) --fix-only --config $(CONFIGURATION_FILE) + @ruff format $(FULL_SOURCES) --config $(CONFIGURATION_FILE) + + +.PHONY: lint +lint: # Lint python code + @set -e; \ + mypy $(FULL_SOURCES) --txt-report . --config-file $(CONFIGURATION_FILE) || mypy_exit=$$?; \ + bandit $(SOURCES) --recursive --configfile $(CONFIGURATION_FILE) || bandit_exit=$$?; \ + ruff check $(FULL_SOURCES) || ruff_exit=$$?; \ + exit $$(( mypy_exit || bandit_exit || ruff_exit )) + + +.PHONY: test +test: # Run all tests + @pytest --config-file $(CONFIGURATION_FILE) + + +.PHONY: coverage +coverage: # Get coverage report + @set -e; \ + coverage erase; \ + coverage run --module pytest --config-file $(CONFIGURATION_FILE) || coverage_exit=$$?; \ + coverage combine; \ + coverage report; \ + exit $$coverage_exit + + +.PHONY: clean +clean: # Remove all generated files + @rm --force --recursive `find . -type f -name '*.py[co]'` + @rm --force --recursive `find . -name __pycache__` + @rm --force --recursive `find . -name .ruff_cache` + @rm --force --recursive `find . -name .mypy_cache` + @rm --force --recursive `find . -name index.txt` + @rm --force --recursive `find . -name .pytest_cache` + @rm --force --recursive .coverage + @rm --force --recursive .coverage.* + @rm --force --recursive coverage.xml + @rm --force --recursive htmlcov diff --git a/README.md b/README.md new file mode 100644 index 0000000..d039480 --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ + + +# โš’๏ธ Object Mother Pattern + +

+ + Test Pipeline + + + Lint Pipeline + + + Coverage Pipeline + + + Package Version + + + Supported Python Versions + +

+ +The **Object Mother Pattern** is a Python ๐Ÿ package that simplifies and standardizes the creation of test ๐Ÿงช objects. This pattern is especially helpful in testing scenarios where you need to generate multiple instances of complex objects quickly and consistently. By providing a set of prebuilt ๐Ÿ› ๏ธ object mothers, you can drop these into your existing test suite and skip the boilerplate setup yourself. + +Easy to install and integrate, the **Object Mother Pattern** is a must-have for any Python developer looking to simplify their testing workflow, ensure design uniformity, and leverage the full potential of reusable test objects in their projects ๐Ÿš€. +

+ +## Table of Contents + +- [๐Ÿ“ฅ Installation](#installation) +- [๐Ÿ”‘ License](#license) +

+ ๐Ÿ”ผ Back to top +



+ + + +## ๐Ÿ“ฅ Installation + +You can install **Object Mother Pattern** using `pip`: + +```bash +pip install object-mother-pattern +``` + +

+ ๐Ÿ”ผ Back to top +



+ + + +## ๐Ÿ”‘ License + +This project is licensed under the terms of the [`MIT license`](LICENSE.md). + +

+ ๐Ÿ”ผ Back to top +

diff --git a/object_mother_pattern/__init__.py b/object_mother_pattern/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/object_mother_pattern/py.typed b/object_mother_pattern/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..39cf154 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,180 @@ +[build-system] +requires = ['hatchling'] +build-backend = 'hatchling.build' + + +[tool.hatch.version] +path = 'object_mother_pattern/__init__.py' + +[tool.hatch.build.targets.sdist] +include = ['object_mother_pattern/', 'tests/', 'requirements*.txt'] + + +[project] +name = 'object-mother-pattern' +description = 'The Object Mother Pattern is a Python package that simplifies and standardizes the creation of test objects.' +readme = './README.md' +authors = [{ name = 'Adria Montoto' }] +license = 'MIT' +classifiers = [ + 'License :: OSI Approved :: MIT License', + 'Intended Audience :: Developers', + 'Operating System :: OS Independent', + 'Typing :: Typed', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', +] +keywords = [ + 'python', + 'development', + 'tools', + 'utilities', + 'object-mother', + 'pattern', + 'testing', + 'validation', +] +requires-python = '>=3.11' +dependencies = ['Faker>=28.0.0,<34.0.0'] +dynamic = ['version'] + +[project.optional-dependencies] +tests = [ + 'pytest>=8.0.0,<9.0.0', + 'pytest-asyncio>=0.0.0,<1.0.0', + 'pytest-randomly>=3.0.0,<4.0.0', + 'coverage[toml]>=7.0.0,<8.0.0', + 'ruff>=0.0.0,<1.0.0', + 'mypy[reports]>=1.0.0,<2.0.0', + 'pre-commit>=3.0.0,<5.0.0', +] + + +[project.urls] +Homepage = 'https://github.com/adriamontoto/object-mother-pattern' +Repository = 'https://github.com/adriamontoto/object-mother-pattern' +Issues = 'https://github.com/adriamontoto/object-mother-pattern/issues' + + +[tool.pytest.ini_options] +pythonpath = '.' +addopts = [ + '--strict-config', # fail if an unregistered option is used + '--strict-markers', # fail if an unregistered marker is used + '--color=yes', # color the output +] +markers = [ + 'unit_testing: Check a unique funtionality', + 'integration_testing: Check the integration between two or more functions', + 'e2e_testing: Check the end to end functionality of the application', + 'performance_testing: Check the performance of the application', + 'security_testing: Check the security of the application', +] +xfail_strict = true + + +[tool.coverage.run] +source = ['object_mother_pattern'] +parallel = true +branch = true +relative_files = true + +[tool.coverage.report] +show_missing = true +skip_covered = true +precision = 2 +exclude_lines = [ + 'pragma: no cover', + 'raise NotImplementedError', + 'if TYPE_CHECKING:', + 'if typing.TYPE_CHECKING:', + '@overload', + '@typing.overload', + 'typing.assert_never', + 'assert_never', +] + +[tool.coverage.paths] +source = ['object_mother_pattern'] + + +[tool.ruff] +fix = true +indent-width = 4 +line-length = 120 +target-version = 'py313' + +[tool.ruff.format] +docstring-code-format = true +docstring-code-line-length = 120 +indent-style = 'space' +quote-style = 'single' +skip-magic-trailing-comma = false + +[tool.ruff.lint] +select = [ + 'F', # pyflakes + 'E', # pycodestyle + 'W', # pycodestyle + 'D', # pydocstyle + 'C90', # mccabe + 'I', # isort + 'N', # pep8-naming + 'UP', # pyupgrade + 'B', # flake8-bugbear + 'C4', # flake8-comprehensions + 'DTZ', # flake8-datetimez + 'SIM', # flake8-simplify + 'RUF', # ruff +] +ignore = [ + 'UP035', # Checks for uses of deprecated imports based on the minimum supported Python version. + 'UP036', # Checks for conditional blocks gated on sys.version_info comparisons that are outdated for the minimum supported Python version. + 'E111', # Checks for indentation with a non-multiple of 4 spaces. + 'E114', # Checks for indentation of comments with a non-multiple of 4 spaces. + 'E117', # Checks for over-indented code. + 'W191', # Checks for indentation that uses tabs. + 'D200', # Checks for single-line docstrings that are broken across multiple lines. + 'D205', # 1 blank line required between summary line and description. + 'D206', # Checks for docstrings that are indented with tabs. + 'D212', # Checks for docstring summary lines that are not positioned on the first physical line of the docstring. + 'D401', # First line of docstring should be in imperative mood. + 'D300', # Checks for docstrings that use '''triple single quotes''' instead of 'triple double quotes'. +] + +[tool.ruff.lint.per-file-ignores] +'__init__.py' = [ + 'F401', # Checks for unused imports. + 'D104', # Checks for undocumented public package definitions. +] +'database.py' = [ + 'F401', # Checks for unused imports. +] +'**test**.py' = [ + 'S101', # Use of `assert` detected. +] + +[tool.ruff.lint.mccabe] +max-complexity = 10 + +[tool.ruff.lint.pydocstyle] +convention = 'pep257' + +[tool.ruff.lint.isort] +case-sensitive = true +known-first-party = ['object_mother_pattern'] +combine-as-imports = true + + +[tool.mypy] +strict = true +warn_unreachable = true +enable_error_code = [ + 'redundant-expr', + 'possibly-undefined', + 'truthy-bool', + 'explicit-override', +] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..ac56039 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +# Remember to add the package, its single version and the documentation page + +Faker>=29.0.0,<34.0.0 # https://faker.readthedocs.io/en/master diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 0000000..439d748 --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1,13 @@ +# Remember to add the package, its single version and the documentation page + +# Install packages from requirements.txt +-r requirements.txt + +pytest>=8.0.0,<9.0.0 # https://docs.pytest.org +pytest-asyncio>=0.0.0,<1.0.0 # https://pytest-asyncio.readthedocs.io +pytest-xdist[psutil]>=3.6.1,<4.0.0 # https://pytest-xdist.readthedocs.io/en +pytest-randomly>=3.0.0,<4.0.0 # https://github.com/pytest-dev/pytest-randomly +coverage[toml]>=7.0.0,<8.0.0 # https://coverage.readthedocs.io +ruff>=0.0.0,<1.0.0 # https://docs.astral.sh/ruff +mypy[reports]>=1.0.0,<2.0.0 # https://mypy.readthedocs.io +pre-commit>=3.0.0,<5.0.0 # https://pre-commit.com diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29