|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | + |
| 3 | +import os |
| 4 | + |
| 5 | +import pytest |
| 6 | + |
| 7 | +from src.csvdiff2.csvdiff import MatchingKeyInfo |
| 8 | + |
| 9 | + |
| 10 | +@pytest.fixture(scope='function') |
| 11 | +def args(): |
| 12 | + return type("Arguments", (object,), { |
| 13 | + "lhs_file_name": "", |
| 14 | + "rhs_file_name": "", |
| 15 | + "encoding": "", |
| 16 | + "encoding_for_lhs": "utf8", |
| 17 | + "encoding_for_rhs": "utf8", |
| 18 | + "matching_keys": [MatchingKeyInfo('0')], |
| 19 | + "unique_key": False, |
| 20 | + "ignore_columns": [], |
| 21 | + "vertical_style": False, |
| 22 | + "show_count": False, |
| 23 | + "show_difference_only": False, |
| 24 | + "show_all_lines": False, |
| 25 | + "show_context_from_arguments": False, |
| 26 | + "sniffing_size": 4096, |
| 27 | + "force_individual_specs": False, |
| 28 | + "header": None, |
| 29 | + "column_separator": None, |
| 30 | + "line_separator": None, |
| 31 | + "quote_char": None, |
| 32 | + "no_skip_space_after_column_separator": "", |
| 33 | + "column_separator_for_lhs": "COMMA", |
| 34 | + "column_separator_for_rhs": "COMMA", |
| 35 | + "line_separator_for_lhs": "LF", |
| 36 | + "line_separator_for_rhs": "LF", |
| 37 | + "quote_char_for_lhs": '"', |
| 38 | + "quote_char_for_rhs": '"', |
| 39 | + "no_skip_space_after_column_separator_for_lhs": False, |
| 40 | + "no_skip_space_after_column_separator_for_rhs": False, |
| 41 | + }) |
| 42 | + |
| 43 | +@pytest.fixture(scope='function') |
| 44 | +def lhs(tmpdir): |
| 45 | + lhs = tmpdir.join("left.csv") |
| 46 | + return lhs |
| 47 | + |
| 48 | +@pytest.fixture(scope='function') |
| 49 | +def rhs(tmpdir): |
| 50 | + rhs = tmpdir.join("right.csv") |
| 51 | + return rhs |
| 52 | + |
| 53 | +@pytest.fixture(scope='function') |
| 54 | +def path_to_tests_dir(): |
| 55 | + return './' if current_folder_name() == 'tests' else 'tests' |
| 56 | + |
| 57 | +def current_folder_name(): |
| 58 | + return os.path.basename(os.getcwd()) |
| 59 | + |
| 60 | +@pytest.fixture(scope='function') |
| 61 | +def lhs_dir(tmpdir): |
| 62 | + lhs = tmpdir.mkdir("left_dir") |
| 63 | + return lhs |
| 64 | + |
| 65 | +@pytest.fixture(scope='function') |
| 66 | +def rhs_dir(tmpdir): |
| 67 | + rhs = tmpdir.mkdir("right_dir") |
| 68 | + return rhs |
| 69 | + |
| 70 | + |
| 71 | + |
0 commit comments