File: conftest.py

package info (click to toggle)
sqlfluff 3.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,000 kB
  • sloc: python: 106,131; sql: 34,188; makefile: 52; sh: 8
file content (41 lines) | stat: -rw-r--r-- 949 bytes parent folder | download | duplicates (2)
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
41
"""Common fixtures for segment tests."""

import pytest

from sqlfluff.core.parser import BaseSegment


@pytest.fixture(scope="module")
def raw_segments(generate_test_segments):
    """Construct a list of raw segments as a fixture."""
    return generate_test_segments(["foobar", ".barfoo"])


@pytest.fixture(scope="module")
def raw_seg(raw_segments):
    """Construct a raw segment as a fixture."""
    return raw_segments[0]


@pytest.fixture(scope="session")
def DummySegment():
    """Construct a raw segment as a fixture."""

    class DummySegment(BaseSegment):
        """A dummy segment for testing with no grammar."""

        type = "dummy"

    return DummySegment


@pytest.fixture(scope="session")
def DummyAuxSegment():
    """Construct a raw segment as a fixture."""

    class DummyAuxSegment(BaseSegment):
        """A different dummy segment for testing with no grammar."""

        type = "dummy_aux"

    return DummyAuxSegment