File: __init__.py

package info (click to toggle)
exhale 0.3.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,616 kB
  • sloc: python: 9,057; cpp: 1,260; javascript: 915; f90: 29; ansic: 18; makefile: 16
file content (40 lines) | stat: -rw-r--r-- 1,612 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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf8 -*-
########################################################################################
# This file is part of exhale.  Copyright (c) 2017-2024, Stephen McDowell.             #
# Full BSD 3-Clause license available here:                                            #
#                                                                                      #
#                https://github.com/svenevs/exhale/blob/master/LICENSE                 #
########################################################################################
"""
The testing package for Exhale.
"""

from __future__ import unicode_literals
import os


TEST_PROJECTS_ROOT = os.path.abspath(os.path.join(
    os.path.dirname(__file__), "projects"
))
"""
The global ``projects`` folder that individual test cases use.

Each test case indexes into this folder with their specified ``test_project``.
See also :data:`testing.base.ExhaleTestCase.test_project`.
"""


def get_exhale_root(test):
    """
    Return the finalized :class:`exhale.graph.ExhaleRoot` object for the specified test.

    .. todo:: document better / this gets updated in v1.0.0
    """
    # Get the finalized exhale.graph.ExhaleRoot object
    # TODO: in future this app.exhale_root will *NOT* be set, but instead it will be
    # something else depending on how the multi-project setup works, AKA if you are
    # reading this `app.exhale_root` is *NOT* a feature you can rely on!!!
    app = getattr(test, "app", None)
    if app is None:
        raise RuntimeError("Critical failure: the test_root.app was 'None'.")
    return app.exhale_root