Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Change the build backend to hatchling
Browse files Browse the repository at this point in the history
  • Loading branch information
rednafi committed Aug 1, 2022
1 parent 6ebb750 commit 320df6a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

14 changes: 9 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build-backend = "hatchling.build"

[project]
name = "rubric"
version = "0.6.5"
version = "0.6.6"
authors = [
{ name="rednafi", email="[email protected]" },
]
Expand Down Expand Up @@ -43,8 +43,8 @@ dev = [
"pre-commit",
"pip-tools",
"pytest",
"pytest-asyncio",
"twine",
"hatch",
"build",
"types-setuptools",
"types-pkg_resources",
Expand All @@ -57,6 +57,13 @@ dev = [
[project.scripts]
rubric = "rubric:cli"

[tool.hatch.build]
include = [
"rubric/*",
"/rubric/*/*",
"/tests/*",
]

##########################################
# Development configs
##########################################
Expand All @@ -80,6 +87,3 @@ pretty = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
exclude = ["build", "tests"]

[tool.pytest.ini_options]
asyncio_mode = "auto"
27 changes: 17 additions & 10 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def create_file(tmp_path, filename):
directory = tmp_path / "tmp"
directory.mkdir()
file = directory / filename # request.param is the filename to be created
yield directory, file
yield file


def test_filenames():
Expand All @@ -35,7 +35,8 @@ def test_filenames():

@pytest.mark.parametrize("filename", ["pyproject.toml"])
def test_copy_over(create_file):
directory, file = create_file
file = create_file
directory = file.parent

# Creates a file in the temporary directory and copies the contents
# of rubric/pyproject.toml file to it.
Expand All @@ -53,7 +54,8 @@ def test_copy_over(create_file):

@pytest.mark.parametrize("filename", ["pyproject.toml"])
def test_copy_over_overwrite(create_file):
directory, file = create_file
file = create_file
directory = file.parent

file.write_text("Lorem ipsum!")
assert "Lorem ipsum!" in file.read_text()
Expand All @@ -69,7 +71,9 @@ def test_copy_over_overwrite(create_file):

@pytest.mark.parametrize("filename", ["pyproject.toml"])
def test_copy_over_append(create_file):
directory, file = create_file
file = create_file
directory = file.parent

file.write_text("Lorem ipsum!")
assert "Lorem ipsum!" in file.read_text()

Expand All @@ -89,8 +93,9 @@ def test_copy_over_append(create_file):
"overwrite, append",
[(False, False), (True, False), (False, True), (True, True)],
)
async def test_orcherstrator(create_file, overwrite, append):
directory, file = create_file
def test_orcherstrator(create_file, overwrite, append):
file = create_file
directory = file.parent

# This should copy all the files from rubric/ to the temporary directory.
rubric.orchestrator(dst_dirname=str(directory), overwrite=overwrite, append=append)
Expand All @@ -113,13 +118,14 @@ async def test_orcherstrator(create_file, overwrite, append):
"filename", ["pyproject.toml", "README.md", "requirements-dev.in"]
)
@pytest.mark.parametrize("overwrite, append", [(True, False)])
async def test_orcherstrator_overwrite(
def test_orcherstrator_overwrite(
create_file,
overwrite,
append,
):

directory, file = create_file
file = create_file
directory = file.parent
file.write_text("Lorem ipsum!")

assert "Lorem ipsum!" in file.read_text()
Expand Down Expand Up @@ -151,8 +157,9 @@ async def test_orcherstrator_overwrite(
"filename", ["pyproject.toml", "README.md", "requirements-dev.in"]
)
@pytest.mark.parametrize("overwrite, append", [(False, True)])
async def test_orcherstrator_append(create_file, overwrite, append):
directory, file = create_file
def test_orcherstrator_append(create_file, overwrite, append):
file = create_file
directory = file.parent

file.write_text("Lorem ipsum!")

Expand Down

0 comments on commit 320df6a

Please sign in to comment.