File: test_validate_test_source_dir.py

package info (click to toggle)
python-briefcase 0.3.22-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,300 kB
  • sloc: python: 59,405; makefile: 57
file content (27 lines) | stat: -rw-r--r-- 933 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
import pytest

from ...utils import create_file


def test_valid_test_source_dir(convert_command):
    """Valid test_source_dir raises no errors and returns True."""
    app_name = "newtarget"
    test_source_dir = "tests"

    full_test_source_dir = convert_command.base_path / test_source_dir
    full_test_source_dir.mkdir(parents=True)

    assert convert_command.validate_test_source_dir(app_name, test_source_dir)


def test_test_source_dir_shouldnt_contain_test_entry_script(convert_command):
    """If `convert_command.base_path/test_source_dir` already contains a test entry
    script, a ValueError is raised."""
    app_name = "newtarget"
    test_source_dir = "tests"

    test_entry_path = convert_command.base_path / test_source_dir / f"{app_name}.py"
    create_file(test_entry_path, "TEST ENTRY SCRIPT")

    with pytest.raises(ValueError):
        convert_command.validate_test_source_dir(app_name, test_source_dir)