https://github.com/fabienarcellier/fixtup
Test python application beyond the code boundaries !
https://github.com/fabienarcellier/fixtup
pytest python testing unittest
Last synced: about 1 year ago
JSON representation
Test python application beyond the code boundaries !
- Host: GitHub
- URL: https://github.com/fabienarcellier/fixtup
- Owner: FabienArcellier
- License: mit
- Created: 2022-02-21T15:22:34.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-08-15T07:13:09.000Z (almost 3 years ago)
- Last Synced: 2025-04-14T07:06:52.944Z (about 1 year ago)
- Topics: pytest, python, testing, unittest
- Language: Python
- Homepage: https://fixtup.readthedocs.io/en/latest/
- Size: 1.58 MB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Fixtup
Test your python application beyond your code !
[](https://pypi.org/project/fixtup/) [](https://github.com/FabienArcellier/fixtup/actions/workflows/ci.yml) [](LICENSE.md)

**write clear, robust and easy-to-execute system integration tests** with your favorite test framwork like ``pytest``, ``unittest`` or event BDD framework as ``robot framework`` or ``behave``.
* it starts the services needed to run your test
* it mount the longest fixtures only once whether you play a test or 100
* it cleans files and data between each test
* it runs on a developer's workstation without configuration
* it can be debugged step by step in your favorite IDE
## Benefits
* You can get up and running with Fixtup **in minutes**, even on legacy project, **no matter what your test framework is**.
* You will **stop wasting your time on boilerplate code**
* Fixtup provides an easy way to **run tests in debug in your favorite IDE like pycharm and vscode**.
* Fixtup is cross-platform which makes it easy to use it on Linux, Mac and Windows.
## Getting started
**write clear, robust and easy-to-execute system integration tests** in 5 minutes.
```bash
$ poetry init
$ poety add --dev fixtup
```
```bash
$ poetry run fixtup init
$ poetry run fixtup new
Choose a fixture identifier : thumbnail_context
Mount environment variables on this fixture (y/n) [n]
Mount docker container on this fixture (y/n) [n]
```
We will use this fixture to mount a directory with existing picture `file.png` and test
our `thumbnail` function is working well.
```python
def test_thumbnail_should_generate_thumbnail(self):
# Magic happens with the instruction fixtup.up
with fixtup.up('thumbnail_context') as f:
# Given
wd = os.getcwd()
original_file = os.directory.join(wd, 'file.png')
expected_thumbnail_file = os.directory.join(wd, 'file_t.png')
# Then
thumbnail(original_file, expected_thumbnail_file)
# Then
self.assertTrue(os.directory.isfile(expected_thumbnail_file)
```
Fixtup mount the fixture `thumbnail_context` in temporary directory. At the end of the test, it clean up everything for you
Want more ? [Fixtup even mount your containers, take a try](https://fixtup.readthedocs.io/en/latest/handbook.html#mount-a-postgresql-database-in-a-test).
[The complete example is available in the repo](https://github.com/FabienArcellier/fixtup/tree/master/examples)
## Contributing
[More information into CONTRIBUTING.md](https://github.com/FabienArcellier/fixtup/blob/master/CONTRIBUTING.md)