diff --git a/pyproject.toml b/pyproject.toml index bca3f6a..cb00782 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,7 @@ build-backend = "hatchling.build" include= ["template_rocker"] [project.entry-points."rocker.extensions"] -pixi = "template_rocker.pixi:PixiExtension" +rocker_extension = "template_rocker.rocker_extension:NewRockerExtension" # Environments [tool.pixi.environments] diff --git a/template_rocker/pixi.py b/template_rocker/new_rocker_extension.py similarity index 85% rename from template_rocker/pixi.py rename to template_rocker/new_rocker_extension.py index 8357028..9e66626 100644 --- a/template_rocker/pixi.py +++ b/template_rocker/new_rocker_extension.py @@ -2,13 +2,13 @@ from rocker.extensions import RockerExtension -class PixiExtension(RockerExtension): +class NewRockerExtension(RockerExtension): @staticmethod def get_name(): return "pixi" def __init__(self): - self.name = PixiExtension.get_name() + self.name = NewRockerExtension.get_name() def get_snippet(self, cliargs): return pkgutil.get_data("template_rocker", "templates/curl_snippet.Dockerfile").decode( @@ -26,7 +26,7 @@ def register_arguments(parser, defaults=None): if defaults is None: defaults = {} parser.add_argument( - f"--{PixiExtension.get_name()}", + f"--{NewRockerExtension.get_name()}", action="store_true", default=defaults.get("pixi"), help="add pixi dependency manager to your environment", diff --git a/test/test_basic.py b/test/test_basic.py index 60491f5..5ab023c 100644 --- a/test/test_basic.py +++ b/test/test_basic.py @@ -2,26 +2,26 @@ import argparse import pytest from unittest.mock import patch -from template_rocker.pixi import PixiExtension +from template_rocker.new_rocker_extension import NewRockerExtension class TestPixiExtension: # Instantiating PixiExtension and verifying the name attribute is set correctly def test_name_attribute_initialization(self): - extension = PixiExtension() - assert extension.name == "pixi" + extension = NewRockerExtension() + assert extension.name == "new_rocker_extension" def test_register_arguments(self): parser = argparse.ArgumentParser() - PixiExtension.register_arguments(parser) + NewRockerExtension.register_arguments(parser) args = parser.parse_args([]) assert "pixi" in vars(args) # Handling missing template files in get_snippet method def test_get_snippet_missing_template(self): - extension = PixiExtension() + extension = NewRockerExtension() with patch("pkgutil.get_data", return_value=None): with pytest.raises(AttributeError): extension.get_snippet({}) @@ -29,7 +29,7 @@ def test_get_snippet_missing_template(self): # Retrieving the default snippet using get_snippet method def test_retrieve_default_snippet(self): - extension = PixiExtension() + extension = NewRockerExtension() snippet = extension.get_snippet(None) assert snippet is not None @@ -37,7 +37,7 @@ def test_retrieve_default_snippet(self): # Retrieving the user-specific snippet using get_user_snippet method def test_retrieve_user_specific_snippet(self): - extension = PixiExtension() + extension = NewRockerExtension() snippet = extension.get_user_snippet(None) assert snippet is not None