def test_data_dir(name):
    """
    Decorator allowing to customize test data directory for a test.

    The specified name will be used only as the last component of the path
    following the directory corresponding to the test class (by default
    test name itself is used for this purpose).

    Example::

        @test_data_dir('common_test_data')
        def test_scenario():
            ...
    """
    def decorator(f):
        f._test_data_dir = name
        return f

    return decorator