diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29b..f96edf0e 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,7 @@ +- bump: minor + changes: + added: + - pyproject.toml, transforming from setup.py + - testing for pyproject.toml + changed: + - edited dependencies in setup.py to avoid overwriting \ No newline at end of file diff --git a/test_toml.py b/test_toml.py index 7d60111b..5df94b7c 100644 --- a/test_toml.py +++ b/test_toml.py @@ -4,6 +4,7 @@ import pytest from packaging import version + @pytest.fixture(scope="module") def toml_data(): file_path = "pyproject.toml" @@ -12,6 +13,7 @@ def toml_data(): with open(file_path, "rb") as f: return tomli.load(f) + def test_toml_syntax(): file_path = "pyproject.toml" try: @@ -20,15 +22,22 @@ def test_toml_syntax(): except tomli.TOMLDecodeError as e: pytest.fail(f"TOML syntax error: {e}") + def test_required_fields(toml_data): required_fields = ["name", "version", "description"] for field in required_fields: - assert field in toml_data.get("project", {}), f"Missing required field: {field}" + assert field in toml_data.get( + "project", {} + ), f"Missing required field: {field}" + def test_build_system(toml_data): build_system = toml_data.get("build-system", {}) assert "requires" in build_system, "Build system 'requires' is missing." - assert "build-backend" in build_system, "Build system 'build-backend' is missing." + assert ( + "build-backend" in build_system + ), "Build system 'build-backend' is missing." + def test_package_build(): try: @@ -36,16 +45,20 @@ def test_package_build(): except subprocess.CalledProcessError: pytest.fail("Failed to build package.") + def test_package_installation(): try: subprocess.run(["pip", "install", "."], check=True) except subprocess.CalledProcessError: pytest.fail("Failed to install package.") + def test_run_tests(): try: subprocess.run(["pytest"], check=True) except subprocess.CalledProcessError: pytest.fail("Some tests failed.") except FileNotFoundError: - pytest.skip("pytest not found. Make sure it's installed and in your PATH.") \ No newline at end of file + pytest.skip( + "pytest not found. Make sure it's installed and in your PATH." + )