# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['python_fixturify_project']

package_data = \
{'': ['*']}

install_requires = \
['deepdiff>=5.8.1,<6.0.0', 'dict-path>=1.0.1,<2.0.0', 'wcmatch>=8.4.1,<9.0.0']

extras_require = \
{':python_version < "3.8"': ['importlib_metadata>=4.5.0,<5.0.0']}

setup_kwargs = {
    'name': 'python-fixturify-project',
    'version': '1.0.0',
    'description': 'Dynamic fixture creation for your tests',
    'long_description': '# python-fixturify-project\n\n[![Build status](https://github.com/scalvert/python-fixturify-project/workflows/build/badge.svg?branch=main&event=push)](https://github.com/scalvert/python-fixturify-project/actions?query=workflow%3Abuild)\n[![Python Version](https://img.shields.io/pypi/pyversions/python-fixturify-project.svg)](https://pypi.org/project/python-fixturify-project/)\n[![Dependencies Status](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)](https://github.com/scalvert/python-fixturify-project/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Aapp%2Fdependabot)\n\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Security: bandit](https://img.shields.io/badge/security-bandit-green.svg)](https://github.com/PyCQA/bandit)\n[![Pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/scalvert/python-fixturify-project/blob/master/.pre-commit-config.yaml)\n[![Semantic Versions](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--versions-e10079.svg)](https://github.com/scalvert/python-fixturify-project/releases)\n[![License](https://img.shields.io/github/license/scalvert/python-fixturify-project)](https://github.com/scalvert/python-fixturify-project/blob/master/LICENSE)\n![Coverage Report](assets/images/coverage.svg)\n\n> Dynamic fixture creation for your tests\n\n_A Python port of [node-fixturify-project](https://github.com/stefanpenner/node-fixturify-project)_\n\n## Installation\n\n```bash\npip install -U python-fixturify-project\n```\n\nor install with `Poetry`\n\n```bash\npoetry add python-fixturify-project --dev\n```\n\n## Usage\n\n`python-fixturify-project` is a Python package that provides a way to create dynamic fixtures for your tests. Fixtures are real directories and files, written to a temporary directory.\n\n```python\nfrom python_fixturify_project import Project\n\ndir_json = {\n    "valid_file.txt": "some text",\n    "nested_dir": {\n        "valid_empty_file.txt": "",\n        "another_nested_empty_dir": {},\n        "another_nested_dir": {\n            "last_nested_empty_dir": {},\n            "final_text_file.txt": "some text",\n        },\n    },\n}\n\n# create a new project with the given directory structure\nproject = Project(files=dir_json)\n# add new files to the project, merging with the existing directory structure\np.write({\n    "new_file.txt": "some text"\n})\n\n# read the actual contents on disc\nactual_dir_json = p.read()\n```\n\n### Ignore Files\n\nBy default, the `read()` function will ignore all hidden files and directories in your Project file structure. This can be overridden by using the `ignore_patterns` constructor argument, which\ntakes a list of glob pattern strings. Any patterns provided to the `ignore_patterns` argument will be used in an _exclusive_ manner. For example:\n\n```python\nfiles = {\n    ".git": {\n        "a_nested_dir": {}\n    },\n    ".github": {\n        "ignore_me": {},\n        "do_not_ignore_me": {\n            "a_file": "some text"\n        }\n    },\n    "ignore_me": "some text",\n    "do_not_ignore_me": "some text",\n}\n\n# Default ignore_patterns is ["**/.git", "**/.git/**"]\nproject = Project(ignore_patterns=["**/.git", "**/.git/**", "**/ignore_me"])\n\nproject.write(files)\n\nassert project.read() == {\n    \'.github\': {\n        \'do_not_ignore_me\': {\n            \'a_file\': \'some text\',\n        },\n    },\n    \'do_not_ignore_me\': \'some text\',\n}\n```\n\n### Recommended Usage Patterns\n\n`python-fixutrify-project` becomes even more useful when combining it with tools like `pytest` and something like [`syrupy`](https://github.com/tophat/syrupy), which uses `jest`-like snapshots for testing. The example below combines `python-fixturify-project` with `pytest`\'s fixtures, and  `syrupy` to create a snapshot test.\n\nFirst, we define a fixture to setup and teardown our `Project` instance:\n\n```python\n# conftest.py\nimport pytest\n\nfrom python_fixturify_project import Project\n\n\n@pytest.fixture\ndef project():\n    project = Project()\n\n    yield project\n\n    project.dispose()\n```\n\nThis fixture uses `pytest`\'s `yield` fixture pattern, which allows us to run some code after the test has completed. In this case, we use the `dispose()` method to remove the temporary directory created by `python-fixturify-project`.\n\n```python\nfrom python_fixturify_project import Project\n\n\ndef test_mutating_project(project, snapshot):\n    project.write({\n        "a_file.txt": "some text",\n        "a_dir": {\n            "another_file.txt": "some text",\n        },\n        "path": {\n            "to": {\n                "a_file.py": "# some python code",\n            },\n        },\n    })\n\n    mutate_files_for_some_reason(p.base_dir)\n\n    # ensure mutations were as expected\n    assert project.files == snapshot\n```\n\nOr you can use the `project.get` method to get the path to a file in the project.\n\n```python\nfrom python_fixturify_project import Project\n\ndef test_mutating_project(snapshot):\n    project.write({\n        "a_file.txt": "some text",\n        "a_dir": {\n            "another_file.txt": "some text",\n        },\n        "path": {\n            "to": {\n                "a_file.py": "# some python code",\n            },\n        },\n    })\n\n    mutate_files_for_some_reason(p.base_dir)\n\n    # ensure mutations were as  for single file\n    assert project.get(\'path/to/a_file.py\') == snapshot(name=\'path/to/a_file.py\')\n```\n\n## Skip Dispose (for debugging)\n\nIf you want to skip the `dispose()` call, you can set the `FIXTURIFY_SKIP_DISPOSE` environment variable to `1`.\n\n```bash\nFIXTURIFY_SKIP_DISPOSE=1 pytest\n```\n\nThis can be useful if you want to inspect the contents of the temporary directory after the test has completed.\n\n## 🛡 License\n\n[![License](https://img.shields.io/github/license/scalvert/python-fixturify-project)](https://github.com/scalvert/python-fixturify-project/blob/master/LICENSE)\n\nThis project is licensed under the terms of the `MIT` license. See [LICENSE](https://github.com/scalvert/python-fixturify-project/blob/master/LICENSE) for more details.\n',
    'author': 'python-fixturify-project',
    'author_email': 'steve.calvert@gmail.com',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'https://github.com/scalvert/python-fixturify-project',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'extras_require': extras_require,
    'python_requires': '>=3.8,<4.0',
}


setup(**setup_kwargs)
