File: conftest.py

package info (click to toggle)
python-munch 4.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 264 kB
  • sloc: python: 761; makefile: 20
file content (22 lines) | stat: -rw-r--r-- 596 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import pytest
import munch


@pytest.fixture(name='yaml')
def yaml_module():
    try:
        import yaml  # pylint: disable=import-outside-toplevel
        return yaml
    except ImportError:
        pass
    pytest.skip("Module 'PyYAML' is required")


@pytest.fixture(params=[munch.Munch, munch.AutoMunch, munch.DefaultMunch, munch.DefaultFactoryMunch,
                        munch.RecursiveMunch])
def munch_obj(request):
    cls = request.param
    args = tuple()
    if cls == munch.DefaultFactoryMunch:
        args = args + (lambda: None,)
    return cls(*args, hello="world", number=5)