File: test_validate_pyproject_file.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 (28 lines) | stat: -rw-r--r-- 977 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
import pytest

from briefcase.exceptions import BriefcaseCommandError


def test_no_pyproject_file(convert_command):
    """If there is no pyproject.toml file, a BriefcaseCommandError is raised."""
    with pytest.raises(BriefcaseCommandError):
        convert_command.validate_pyproject_file()


def test_briefcase_field_present(convert_command):
    """If the project is already set up for Briefcase, a BriefcaseCommandError is
    raised."""
    (convert_command.base_path / "pyproject.toml").write_text(
        "[tool.briefcase]\n", encoding="utf-8"
    )
    with pytest.raises(BriefcaseCommandError):
        convert_command.validate_pyproject_file()


def test_no_briefcase_field(convert_command):
    """If the project has a pyproject.toml file and is not already set up for Briefcase,
    no error is raised."""
    (convert_command.base_path / "pyproject.toml").write_text(
        "[project]\n", encoding="utf-8"
    )
    convert_command.validate_pyproject_file()