Skip to content

Commit

Permalink
WIP: add pyproject.toml, test_toml.py; deleted setup.py to avoid over…
Browse files Browse the repository at this point in the history
…writing with pyproject.toml

target to fix: issue PolicyEngine#256
  • Loading branch information
SylviaDu99 committed Sep 6, 2024
1 parent 50631bd commit 635aea0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 114 deletions.
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ dev = [
[project.urls]
Homepage = "https://github.com/policyengine/policyengine-core"

[tool.setuptools.packages.find]
exclude = ["tests*"]

[tool.setuptools]
include-package-data = true

Expand Down
83 changes: 0 additions & 83 deletions setup.py

This file was deleted.

30 changes: 2 additions & 28 deletions test_toml.py → tests/core/test_toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
import subprocess
import tomli
import pytest
from packaging import version


@pytest.fixture(scope="module")
def toml_data():
file_path = "pyproject.toml"
file_path = "../../pyproject.toml"
if not os.path.exists(file_path):
pytest.fail("pyproject.toml not found in the current directory.")
with open(file_path, "rb") as f:
return tomli.load(f)


def test_toml_syntax():
file_path = "pyproject.toml"
file_path = "../../pyproject.toml"
try:
with open(file_path, "rb") as f:
tomli.load(f)
Expand All @@ -37,28 +36,3 @@ def test_build_system(toml_data):
assert (
"build-backend" in build_system
), "Build system 'build-backend' is missing."


def test_package_build():
try:
subprocess.run(["python", "-m", "build"], check=True)
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."
)

0 comments on commit 635aea0

Please sign in to comment.