mirror of
https://github.com/apache/superset.git
synced 2026-05-29 20:29:34 +00:00
fix: Rename apache-superset-cli to apache-superset-extensions-cli (#34883)
This commit is contained in:
committed by
GitHub
parent
ebfb14c353
commit
bcf156c969
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@@ -34,7 +34,7 @@
|
||||
# Notify PMC members of changes to extension-related files
|
||||
|
||||
/superset-core/ @michael-s-molina @villebro
|
||||
/superset-cli/ @michael-s-molina @villebro
|
||||
/superset-extensions-cli/ @michael-s-molina @villebro
|
||||
/superset/core/ @michael-s-molina @villebro
|
||||
/superset/extensions/ @michael-s-molina @villebro
|
||||
/superset-frontend/src/packages/superset-core/ @michael-s-molina @villebro
|
||||
|
||||
6
.github/actions/change-detector/action.yml
vendored
6
.github/actions/change-detector/action.yml
vendored
@@ -17,9 +17,9 @@ outputs:
|
||||
docs:
|
||||
description: Whether docs-related files were changed
|
||||
value: ${{ steps.change-detector.outputs.docs }}
|
||||
superset-cli:
|
||||
description: Whether superset-cli package-related files were changed
|
||||
value: ${{ steps.change-detector.outputs.superset-cli }}
|
||||
superset-extensions-cli:
|
||||
description: Whether superset-extensions-cli package-related files were changed
|
||||
value: ${{ steps.change-detector.outputs.superset-extensions-cli }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Superset CLI Package Tests
|
||||
name: Superset Extensions CLI Package Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -14,14 +14,14 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test-superset-cli-package:
|
||||
test-superset-extensions-cli-package:
|
||||
runs-on: ubuntu-24.04
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["previous", "current", "next"]
|
||||
defaults:
|
||||
run:
|
||||
working-directory: superset-cli
|
||||
working-directory: superset-extensions-cli
|
||||
steps:
|
||||
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
|
||||
uses: actions/checkout@v4
|
||||
@@ -36,29 +36,29 @@ jobs:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Setup Python
|
||||
if: steps.check.outputs.superset-cli
|
||||
if: steps.check.outputs.superset-extensions-cli
|
||||
uses: ./.github/actions/setup-backend/
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
requirements-type: dev
|
||||
|
||||
- name: Run pytest with coverage
|
||||
if: steps.check.outputs.superset-cli
|
||||
if: steps.check.outputs.superset-extensions-cli
|
||||
run: |
|
||||
pytest --cov=superset_cli --cov-report=xml --cov-report=term-missing --cov-report=html -v --tb=short
|
||||
pytest --cov=superset_extensions_cli --cov-report=xml --cov-report=term-missing --cov-report=html -v --tb=short
|
||||
|
||||
- name: Upload coverage reports to Codecov
|
||||
if: steps.check.outputs.superset-cli
|
||||
if: steps.check.outputs.superset-extensions-cli
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
flags: superset-cli
|
||||
name: superset-cli-coverage
|
||||
flags: superset-extensions-cli
|
||||
name: superset-extensions-cli-coverage
|
||||
fail_ci_if_error: false
|
||||
|
||||
- name: Upload HTML coverage report
|
||||
if: steps.check.outputs.superset-cli
|
||||
if: steps.check.outputs.superset-extensions-cli
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: superset-cli-coverage-html
|
||||
name: superset-extensions-cli-coverage-html
|
||||
path: htmlcov/
|
||||
@@ -25,7 +25,7 @@ repos:
|
||||
- id: mypy
|
||||
name: mypy (main)
|
||||
args: [--check-untyped-defs]
|
||||
exclude: ^superset-cli/
|
||||
exclude: ^superset-extensions-cli/
|
||||
additional_dependencies: [
|
||||
types-simplejson,
|
||||
types-python-dateutil,
|
||||
@@ -41,9 +41,9 @@ repos:
|
||||
types-Markdown,
|
||||
]
|
||||
- id: mypy
|
||||
name: mypy (superset-cli)
|
||||
name: mypy (superset-extensions-cli)
|
||||
args: [--check-untyped-defs]
|
||||
files: ^superset-cli/
|
||||
files: ^superset-extensions-cli/
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
|
||||
@@ -261,7 +261,7 @@ COPY requirements/*.txt requirements/
|
||||
|
||||
# Copy local packages needed for editable installs in development.txt
|
||||
COPY superset-core superset-core
|
||||
COPY superset-cli superset-cli
|
||||
COPY superset-extensions-cli superset-extensions-cli
|
||||
|
||||
# Install Python dependencies using docker/pip-install.sh
|
||||
RUN --mount=type=cache,target=${SUPERSET_HOME}/.cache/uv \
|
||||
|
||||
@@ -35,7 +35,8 @@ classifiers = [
|
||||
"Programming Language :: Python :: 3.12",
|
||||
]
|
||||
dependencies = [
|
||||
"apache-superset-core>=0.0.1rc1, <0.2",
|
||||
# no bounds for apache-superset-core until a stable version
|
||||
"apache-superset-core",
|
||||
"backoff>=1.8.0",
|
||||
"celery>=5.3.6, <6.0.0",
|
||||
"click>=8.0.3",
|
||||
@@ -192,7 +193,8 @@ doris = ["pydoris>=1.0.0, <2.0.0"]
|
||||
oceanbase = ["oceanbase_py>=0.0.1"]
|
||||
ydb = ["ydb-sqlalchemy>=0.1.2"]
|
||||
development = [
|
||||
"apache-superset-cli>=0.0.1, <0.2",
|
||||
# no bounds for apache-superset-extensions-cli until a stable version
|
||||
"apache-superset-extensions-cli",
|
||||
"docker",
|
||||
"flask-testing",
|
||||
"freezegun",
|
||||
@@ -224,7 +226,7 @@ documentation = "https://superset.apache.org/docs/intro"
|
||||
combine_as_imports = true
|
||||
include_trailing_comma = true
|
||||
line_length = 88
|
||||
known_first_party = "superset, apache-superset-core, apache-superset-cli"
|
||||
known_first_party = "superset, apache-superset-core, apache-superset-extensions-cli"
|
||||
known_third_party = "alembic, apispec, backoff, celery, click, colorama, cron_descriptor, croniter, cryptography, dateutil, deprecation, flask, flask_appbuilder, flask_babel, flask_caching, flask_compress, flask_jwt_extended, flask_login, flask_migrate, flask_sqlalchemy, flask_talisman, flask_testing, flask_wtf, freezegun, geohash, geopy, holidays, humanize, isodate, jinja2, jwt, markdown, markupsafe, marshmallow, msgpack, nh3, numpy, pandas, parameterized, parsedatetime, pgsanity, polyline, prison, progress, pyarrow, sqlalchemy_bigquery, pyhive, pyparsing, pytest, pytest_mock, pytz, redis, requests, selenium, setuptools, shillelagh, simplejson, slack, sqlalchemy, sqlalchemy_utils, typing_extensions, urllib3, werkzeug, wtforms, wtforms_json, yaml"
|
||||
multi_line_output = 3
|
||||
order_by_type = false
|
||||
@@ -430,4 +432,4 @@ pyxlsb = "1" # GPL
|
||||
|
||||
[tool.uv.sources]
|
||||
apache-superset-core = { path = "./superset-core", editable = true }
|
||||
apache-superset-cli = { path = "./superset-cli", editable = true }
|
||||
apache-superset-extensions-cli = { path = "./superset-extensions-cli", editable = true }
|
||||
|
||||
@@ -13,9 +13,7 @@ apispec==6.6.1
|
||||
apsw==3.50.1.0
|
||||
# via shillelagh
|
||||
async-timeout==4.0.3
|
||||
# via
|
||||
# -r requirements/base.in
|
||||
# redis
|
||||
# via -r requirements/base.in
|
||||
attrs==25.3.0
|
||||
# via
|
||||
# cattrs
|
||||
@@ -160,7 +158,6 @@ greenlet==3.1.1
|
||||
# via
|
||||
# apache-superset (pyproject.toml)
|
||||
# shillelagh
|
||||
# sqlalchemy
|
||||
gunicorn==23.0.0
|
||||
# via apache-superset (pyproject.toml)
|
||||
h11==0.16.0
|
||||
@@ -405,11 +402,9 @@ typing-extensions==4.14.0
|
||||
# apache-superset (pyproject.toml)
|
||||
# alembic
|
||||
# cattrs
|
||||
# exceptiongroup
|
||||
# limits
|
||||
# pyopenssl
|
||||
# referencing
|
||||
# rich
|
||||
# selenium
|
||||
# shillelagh
|
||||
tzdata==2025.2
|
||||
|
||||
@@ -17,4 +17,4 @@
|
||||
# under the License.
|
||||
#
|
||||
-e .[development,bigquery,druid,duckdb,gevent,gsheets,mysql,postgres,presto,prophet,trino,thumbnails]
|
||||
-e ./superset-cli[test]
|
||||
-e ./superset-extensions-cli[test]
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
# uv pip compile requirements/development.in -c requirements/base-constraint.txt -o requirements/development.txt
|
||||
-e .
|
||||
# via -r requirements/development.in
|
||||
-e ./superset-cli
|
||||
# via
|
||||
# -r requirements/development.in
|
||||
# apache-superset
|
||||
-e ./superset-core
|
||||
# via
|
||||
# apache-superset
|
||||
# apache-superset-cli
|
||||
# apache-superset-extensions-cli
|
||||
-e ./superset-extensions-cli
|
||||
# via
|
||||
# -r requirements/development.in
|
||||
# apache-superset
|
||||
alembic==1.15.2
|
||||
# via
|
||||
# -c requirements/base-constraint.txt
|
||||
@@ -102,7 +102,7 @@ click==8.2.1
|
||||
# via
|
||||
# -c requirements/base-constraint.txt
|
||||
# apache-superset
|
||||
# apache-superset-cli
|
||||
# apache-superset-extensions-cli
|
||||
# celery
|
||||
# click-didyoumean
|
||||
# click-option-group
|
||||
@@ -327,7 +327,6 @@ greenlet==3.1.1
|
||||
# apache-superset
|
||||
# gevent
|
||||
# shillelagh
|
||||
# sqlalchemy
|
||||
grpcio==1.71.0
|
||||
# via
|
||||
# apache-superset
|
||||
@@ -383,7 +382,7 @@ itsdangerous==2.2.0
|
||||
jinja2==3.1.6
|
||||
# via
|
||||
# -c requirements/base-constraint.txt
|
||||
# apache-superset-cli
|
||||
# apache-superset-extensions-cli
|
||||
# flask
|
||||
# flask-babel
|
||||
jsonpath-ng==1.7.0
|
||||
@@ -670,17 +669,17 @@ pysocks==1.7.1
|
||||
pytest==7.4.4
|
||||
# via
|
||||
# apache-superset
|
||||
# apache-superset-cli
|
||||
# apache-superset-extensions-cli
|
||||
# pytest-cov
|
||||
# pytest-mock
|
||||
pytest-cov==6.0.0
|
||||
# via
|
||||
# apache-superset
|
||||
# apache-superset-cli
|
||||
# apache-superset-extensions-cli
|
||||
pytest-mock==3.10.0
|
||||
# via
|
||||
# apache-superset
|
||||
# apache-superset-cli
|
||||
# apache-superset-extensions-cli
|
||||
python-dateutil==2.9.0.post0
|
||||
# via
|
||||
# -c requirements/base-constraint.txt
|
||||
@@ -777,7 +776,7 @@ selenium==4.32.0
|
||||
# -c requirements/base-constraint.txt
|
||||
# apache-superset
|
||||
semver==3.0.4
|
||||
# via apache-superset-cli
|
||||
# via apache-superset-extensions-cli
|
||||
setuptools==80.7.1
|
||||
# via
|
||||
# nodeenv
|
||||
@@ -869,13 +868,10 @@ typing-extensions==4.14.0
|
||||
# -c requirements/base-constraint.txt
|
||||
# alembic
|
||||
# apache-superset
|
||||
# astroid
|
||||
# cattrs
|
||||
# exceptiongroup
|
||||
# limits
|
||||
# pyopenssl
|
||||
# referencing
|
||||
# rich
|
||||
# selenium
|
||||
# shillelagh
|
||||
tzdata==2025.2
|
||||
@@ -908,7 +904,7 @@ watchdog==6.0.0
|
||||
# via
|
||||
# -c requirements/base-constraint.txt
|
||||
# apache-superset
|
||||
# apache-superset-cli
|
||||
# apache-superset-extensions-cli
|
||||
wcwidth==0.2.13
|
||||
# via
|
||||
# -c requirements/base-constraint.txt
|
||||
|
||||
@@ -45,9 +45,9 @@ PATTERNS = {
|
||||
"docs": [
|
||||
r"^docs/",
|
||||
],
|
||||
"superset-cli": [
|
||||
r"^\.github/workflows/superset-cli\.yml",
|
||||
r"^superset-cli/",
|
||||
"superset-extensions-cli": [
|
||||
r"^\.github/workflows/superset-extensions-cli\.yml",
|
||||
r"^superset-extensions-cli/",
|
||||
r"^superset-core/",
|
||||
],
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
# apache-superset-cli
|
||||
# apache-superset-extensions-cli
|
||||
|
||||
[](https://badge.fury.io/py/apache-superset-cli)
|
||||
[](https://badge.fury.io/py/apache-superset-extensions-cli)
|
||||
[](https://opensource.org/licenses/Apache-2.0)
|
||||
[](https://www.python.org/downloads/)
|
||||
|
||||
@@ -35,7 +35,7 @@ Official command-line interface for building, bundling, and managing Apache Supe
|
||||
## 📦 Installation
|
||||
|
||||
```bash
|
||||
pip install apache-superset-cli
|
||||
pip install apache-superset-extensions-cli
|
||||
```
|
||||
|
||||
## 🛠️ Quick Start
|
||||
@@ -16,7 +16,7 @@
|
||||
# under the License.
|
||||
|
||||
[project]
|
||||
name = "apache-superset-cli"
|
||||
name = "apache-superset-extensions-cli"
|
||||
version = "0.0.1rc1"
|
||||
description = "Official command-line interface for building, bundling, and managing Apache Superset extensions"
|
||||
readme = "README.md"
|
||||
@@ -70,11 +70,11 @@ requires = ["setuptools>=76.0.0", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.setuptools]
|
||||
packages = ["superset_cli"]
|
||||
packages = ["superset_extensions_cli"]
|
||||
package-dir = { "" = "src" }
|
||||
|
||||
[project.scripts]
|
||||
superset-extensions = "superset_cli.cli:app"
|
||||
superset-extensions = "superset_extensions_cli.cli:app"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ["tests"]
|
||||
@@ -85,7 +85,7 @@ addopts = [
|
||||
"--strict-markers",
|
||||
"--strict-config",
|
||||
"--verbose",
|
||||
"--cov=superset_cli",
|
||||
"--cov=superset_extensions_cli",
|
||||
"--cov-report=term-missing",
|
||||
"--cov-report=html:htmlcov"
|
||||
]
|
||||
@@ -97,7 +97,7 @@ markers = [
|
||||
]
|
||||
|
||||
[tool.coverage.run]
|
||||
source = ["src/superset_cli"]
|
||||
source = ["src/superset_extensions_cli"]
|
||||
omit = ["*/tests/*", "*/test_*"]
|
||||
|
||||
[tool.coverage.report]
|
||||
@@ -115,4 +115,4 @@ exclude_lines = [
|
||||
]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"src/superset_cli/*" = ["TID251"]
|
||||
"src/superset_extensions_cli/*" = ["TID251"]
|
||||
@@ -32,8 +32,8 @@ from superset_core.extensions.types import Manifest, Metadata
|
||||
from watchdog.events import FileSystemEventHandler
|
||||
from watchdog.observers import Observer
|
||||
|
||||
from superset_cli.constants import MIN_NPM_VERSION
|
||||
from superset_cli.utils import read_json, read_toml
|
||||
from superset_extensions_cli.constants import MIN_NPM_VERSION
|
||||
from superset_extensions_cli.utils import read_json, read_toml
|
||||
|
||||
REMOTE_ENTRY_REGEX = re.compile(r"^remoteEntry\..+\.js$")
|
||||
FRONTEND_DIST_REGEX = re.compile(r"/frontend/dist")
|
||||
@@ -51,7 +51,7 @@ under the License.
|
||||
|
||||
# Superset CLI Tests
|
||||
|
||||
This directory contains tests for the superset-cli package, focusing on the `init` command and other CLI functionality.
|
||||
This directory contains tests for the superset-extensions-cli package, focusing on the `init` command and other CLI functionality.
|
||||
|
||||
## Test Structure
|
||||
|
||||
@@ -164,7 +164,7 @@ pytest -m cli # CLI tests only
|
||||
### With coverage
|
||||
|
||||
```bash
|
||||
pytest --cov=superset_cli --cov-report=html
|
||||
pytest --cov=superset_extensions_cli --cov-report=html
|
||||
```
|
||||
|
||||
### Specific test files
|
||||
@@ -21,7 +21,7 @@ import json
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
from superset_cli.cli import (
|
||||
from superset_extensions_cli.cli import (
|
||||
app,
|
||||
build_manifest,
|
||||
clean_dist,
|
||||
@@ -79,11 +79,11 @@ def extension_with_build_structure():
|
||||
|
||||
# Build Command Tests
|
||||
@pytest.mark.cli
|
||||
@patch("superset_cli.cli.validate_npm")
|
||||
@patch("superset_cli.cli.init_frontend_deps")
|
||||
@patch("superset_cli.cli.rebuild_frontend")
|
||||
@patch("superset_cli.cli.rebuild_backend")
|
||||
@patch("superset_cli.cli.read_toml")
|
||||
@patch("superset_extensions_cli.cli.validate_npm")
|
||||
@patch("superset_extensions_cli.cli.init_frontend_deps")
|
||||
@patch("superset_extensions_cli.cli.rebuild_frontend")
|
||||
@patch("superset_extensions_cli.cli.rebuild_backend")
|
||||
@patch("superset_extensions_cli.cli.read_toml")
|
||||
def test_build_command_success_flow(
|
||||
mock_read_toml,
|
||||
mock_rebuild_backend,
|
||||
@@ -115,9 +115,9 @@ def test_build_command_success_flow(
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
@patch("superset_cli.cli.validate_npm")
|
||||
@patch("superset_cli.cli.init_frontend_deps")
|
||||
@patch("superset_cli.cli.rebuild_frontend")
|
||||
@patch("superset_extensions_cli.cli.validate_npm")
|
||||
@patch("superset_extensions_cli.cli.init_frontend_deps")
|
||||
@patch("superset_extensions_cli.cli.rebuild_frontend")
|
||||
def test_build_command_handles_frontend_build_failure(
|
||||
mock_rebuild_frontend,
|
||||
mock_init_frontend_deps,
|
||||
@@ -187,7 +187,7 @@ def test_init_frontend_deps_skips_when_node_modules_exists(
|
||||
|
||||
@pytest.mark.unit
|
||||
@patch("subprocess.run")
|
||||
@patch("superset_cli.cli.validate_npm")
|
||||
@patch("superset_extensions_cli.cli.validate_npm")
|
||||
def test_init_frontend_deps_runs_npm_i_when_missing(
|
||||
mock_validate_npm, mock_run, isolated_filesystem
|
||||
):
|
||||
@@ -207,7 +207,7 @@ def test_init_frontend_deps_runs_npm_i_when_missing(
|
||||
|
||||
@pytest.mark.unit
|
||||
@patch("subprocess.run")
|
||||
@patch("superset_cli.cli.validate_npm")
|
||||
@patch("superset_extensions_cli.cli.validate_npm")
|
||||
def test_init_frontend_deps_exits_on_npm_ci_failure(
|
||||
mock_validate_npm, mock_run, isolated_filesystem
|
||||
):
|
||||
@@ -303,7 +303,7 @@ def test_build_manifest_exits_when_extension_json_missing(isolated_filesystem):
|
||||
@pytest.mark.unit
|
||||
def test_clean_dist_frontend_removes_frontend_dist(isolated_filesystem):
|
||||
"""Test clean_dist_frontend removes frontend/dist directory specifically."""
|
||||
from superset_cli.cli import clean_dist_frontend
|
||||
from superset_extensions_cli.cli import clean_dist_frontend
|
||||
|
||||
# Create dist/frontend structure
|
||||
dist_dir = isolated_filesystem / "dist"
|
||||
@@ -322,7 +322,7 @@ def test_clean_dist_frontend_removes_frontend_dist(isolated_filesystem):
|
||||
@pytest.mark.unit
|
||||
def test_clean_dist_frontend_handles_nonexistent_directory(isolated_filesystem):
|
||||
"""Test clean_dist_frontend handles case where frontend dist doesn't exist."""
|
||||
from superset_cli.cli import clean_dist_frontend
|
||||
from superset_extensions_cli.cli import clean_dist_frontend
|
||||
|
||||
# No dist directory exists
|
||||
clean_dist_frontend(isolated_filesystem)
|
||||
@@ -333,7 +333,7 @@ def test_clean_dist_frontend_handles_nonexistent_directory(isolated_filesystem):
|
||||
@pytest.mark.unit
|
||||
def test_run_frontend_build_with_output_messages(isolated_filesystem):
|
||||
"""Test run_frontend_build produces expected output messages."""
|
||||
from superset_cli.cli import run_frontend_build
|
||||
from superset_extensions_cli.cli import run_frontend_build
|
||||
|
||||
frontend_dir = isolated_filesystem / "frontend"
|
||||
frontend_dir.mkdir()
|
||||
@@ -362,7 +362,7 @@ def test_rebuild_frontend_handles_build_results(
|
||||
isolated_filesystem, return_code, expected_result
|
||||
):
|
||||
"""Test rebuild_frontend handles different build results."""
|
||||
from superset_cli.cli import rebuild_frontend
|
||||
from superset_extensions_cli.cli import rebuild_frontend
|
||||
|
||||
# Create frontend structure
|
||||
frontend_dir = isolated_filesystem / "frontend"
|
||||
@@ -378,7 +378,7 @@ def test_rebuild_frontend_handles_build_results(
|
||||
dist_dir = isolated_filesystem / "dist"
|
||||
dist_dir.mkdir()
|
||||
|
||||
with patch("superset_cli.cli.run_frontend_build") as mock_build:
|
||||
with patch("superset_extensions_cli.cli.run_frontend_build") as mock_build:
|
||||
mock_build.return_value = Mock(returncode=return_code)
|
||||
|
||||
result = rebuild_frontend(isolated_filesystem, frontend_dir)
|
||||
@@ -390,7 +390,7 @@ def test_rebuild_frontend_handles_build_results(
|
||||
@pytest.mark.unit
|
||||
def test_rebuild_backend_calls_copy_and_shows_message(isolated_filesystem):
|
||||
"""Test rebuild_backend calls copy_backend_files and shows success message."""
|
||||
from superset_cli.cli import rebuild_backend
|
||||
from superset_extensions_cli.cli import rebuild_backend
|
||||
|
||||
# Create extension.json
|
||||
extension_json = {
|
||||
@@ -401,7 +401,7 @@ def test_rebuild_backend_calls_copy_and_shows_message(isolated_filesystem):
|
||||
}
|
||||
(isolated_filesystem / "extension.json").write_text(json.dumps(extension_json))
|
||||
|
||||
with patch("superset_cli.cli.copy_backend_files") as mock_copy:
|
||||
with patch("superset_extensions_cli.cli.copy_backend_files") as mock_copy:
|
||||
rebuild_backend(isolated_filesystem)
|
||||
|
||||
mock_copy.assert_called_once_with(isolated_filesystem)
|
||||
@@ -22,14 +22,14 @@ import zipfile
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from superset_cli.cli import app
|
||||
from superset_extensions_cli.cli import app
|
||||
|
||||
from tests.utils import assert_file_exists
|
||||
|
||||
|
||||
# Bundle Command Tests
|
||||
@pytest.mark.cli
|
||||
@patch("superset_cli.cli.build")
|
||||
@patch("superset_extensions_cli.cli.build")
|
||||
def test_bundle_command_creates_zip_with_default_name(
|
||||
mock_build, cli_runner, isolated_filesystem, extension_setup_for_bundling
|
||||
):
|
||||
@@ -59,7 +59,7 @@ def test_bundle_command_creates_zip_with_default_name(
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
@patch("superset_cli.cli.build")
|
||||
@patch("superset_extensions_cli.cli.build")
|
||||
def test_bundle_command_with_custom_output_filename(
|
||||
mock_build, cli_runner, isolated_filesystem, extension_setup_for_bundling
|
||||
):
|
||||
@@ -81,7 +81,7 @@ def test_bundle_command_with_custom_output_filename(
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
@patch("superset_cli.cli.build")
|
||||
@patch("superset_extensions_cli.cli.build")
|
||||
def test_bundle_command_with_output_directory(
|
||||
mock_build, cli_runner, isolated_filesystem, extension_setup_for_bundling
|
||||
):
|
||||
@@ -106,7 +106,7 @@ def test_bundle_command_with_output_directory(
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
@patch("superset_cli.cli.build")
|
||||
@patch("superset_extensions_cli.cli.build")
|
||||
def test_bundle_command_fails_without_manifest(
|
||||
mock_build, cli_runner, isolated_filesystem
|
||||
):
|
||||
@@ -124,7 +124,7 @@ def test_bundle_command_fails_without_manifest(
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
@patch("superset_cli.cli.build")
|
||||
@patch("superset_extensions_cli.cli.build")
|
||||
def test_bundle_command_handles_zip_creation_error(
|
||||
mock_build, cli_runner, isolated_filesystem, extension_setup_for_bundling
|
||||
):
|
||||
@@ -145,7 +145,7 @@ def test_bundle_command_handles_zip_creation_error(
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
@patch("superset_cli.cli.build")
|
||||
@patch("superset_extensions_cli.cli.build")
|
||||
def test_bundle_includes_all_files_recursively(
|
||||
mock_build, cli_runner, isolated_filesystem
|
||||
):
|
||||
@@ -214,7 +214,7 @@ def test_bundle_includes_all_files_recursively(
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
@patch("superset_cli.cli.build")
|
||||
@patch("superset_extensions_cli.cli.build")
|
||||
def test_bundle_command_short_option(
|
||||
mock_build, cli_runner, isolated_filesystem, extension_setup_for_bundling
|
||||
):
|
||||
@@ -233,7 +233,7 @@ def test_bundle_command_short_option(
|
||||
|
||||
@pytest.mark.cli
|
||||
@pytest.mark.parametrize("output_option", ["--output", "-o"])
|
||||
@patch("superset_cli.cli.build")
|
||||
@patch("superset_extensions_cli.cli.build")
|
||||
def test_bundle_command_output_options(
|
||||
mock_build,
|
||||
output_option,
|
||||
@@ -23,17 +23,17 @@ import time
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
from superset_cli.cli import app, FrontendChangeHandler
|
||||
from superset_extensions_cli.cli import app, FrontendChangeHandler
|
||||
|
||||
|
||||
# Dev Command Tests
|
||||
@pytest.mark.cli
|
||||
@patch("superset_cli.cli.Observer")
|
||||
@patch("superset_cli.cli.init_frontend_deps")
|
||||
@patch("superset_cli.cli.rebuild_frontend")
|
||||
@patch("superset_cli.cli.rebuild_backend")
|
||||
@patch("superset_cli.cli.build_manifest")
|
||||
@patch("superset_cli.cli.write_manifest")
|
||||
@patch("superset_extensions_cli.cli.Observer")
|
||||
@patch("superset_extensions_cli.cli.init_frontend_deps")
|
||||
@patch("superset_extensions_cli.cli.rebuild_frontend")
|
||||
@patch("superset_extensions_cli.cli.rebuild_backend")
|
||||
@patch("superset_extensions_cli.cli.build_manifest")
|
||||
@patch("superset_extensions_cli.cli.write_manifest")
|
||||
def test_dev_command_starts_watchers(
|
||||
mock_write_manifest,
|
||||
mock_build_manifest,
|
||||
@@ -82,11 +82,11 @@ def test_dev_command_starts_watchers(
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
@patch("superset_cli.cli.init_frontend_deps")
|
||||
@patch("superset_cli.cli.rebuild_frontend")
|
||||
@patch("superset_cli.cli.rebuild_backend")
|
||||
@patch("superset_cli.cli.build_manifest")
|
||||
@patch("superset_cli.cli.write_manifest")
|
||||
@patch("superset_extensions_cli.cli.init_frontend_deps")
|
||||
@patch("superset_extensions_cli.cli.rebuild_frontend")
|
||||
@patch("superset_extensions_cli.cli.rebuild_backend")
|
||||
@patch("superset_extensions_cli.cli.build_manifest")
|
||||
@patch("superset_extensions_cli.cli.write_manifest")
|
||||
def test_dev_command_initial_build(
|
||||
mock_write_manifest,
|
||||
mock_build_manifest,
|
||||
@@ -104,7 +104,7 @@ def test_dev_command_initial_build(
|
||||
|
||||
extension_setup_for_dev(isolated_filesystem)
|
||||
|
||||
with patch("superset_cli.cli.Observer") as mock_observer_class:
|
||||
with patch("superset_extensions_cli.cli.Observer") as mock_observer_class:
|
||||
mock_observer = Mock()
|
||||
mock_observer_class.return_value = mock_observer
|
||||
|
||||
@@ -188,9 +188,9 @@ def test_frontend_watcher_function_coverage(isolated_filesystem):
|
||||
dist_dir = isolated_filesystem / "dist"
|
||||
dist_dir.mkdir()
|
||||
|
||||
with patch("superset_cli.cli.rebuild_frontend") as mock_rebuild:
|
||||
with patch("superset_cli.cli.build_manifest") as mock_build:
|
||||
with patch("superset_cli.cli.write_manifest") as mock_write:
|
||||
with patch("superset_extensions_cli.cli.rebuild_frontend") as mock_rebuild:
|
||||
with patch("superset_extensions_cli.cli.build_manifest") as mock_build:
|
||||
with patch("superset_extensions_cli.cli.write_manifest") as mock_write:
|
||||
mock_rebuild.return_value = "remoteEntry.abc123.js"
|
||||
mock_build.return_value = {"name": "test", "version": "1.0.0"}
|
||||
|
||||
@@ -224,8 +224,8 @@ def test_backend_watcher_function_coverage(isolated_filesystem):
|
||||
manifest_data = {"name": "test", "version": "1.0.0"}
|
||||
(dist_dir / "manifest.json").write_text(json.dumps(manifest_data))
|
||||
|
||||
with patch("superset_cli.cli.rebuild_backend") as mock_rebuild:
|
||||
with patch("superset_cli.cli.write_manifest") as mock_write:
|
||||
with patch("superset_extensions_cli.cli.rebuild_backend") as mock_rebuild:
|
||||
with patch("superset_extensions_cli.cli.write_manifest") as mock_write:
|
||||
# Simulate backend watcher function
|
||||
mock_rebuild(isolated_filesystem)
|
||||
|
||||
@@ -20,7 +20,7 @@ from __future__ import annotations
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from superset_cli.cli import app
|
||||
from superset_extensions_cli.cli import app
|
||||
|
||||
from tests.utils import (
|
||||
assert_directory_exists,
|
||||
@@ -20,14 +20,14 @@ from __future__ import annotations
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
from superset_cli.cli import app, validate_npm
|
||||
from superset_extensions_cli.cli import app, validate_npm
|
||||
|
||||
|
||||
# Validate Command Tests
|
||||
@pytest.mark.cli
|
||||
def test_validate_command_success(cli_runner):
|
||||
"""Test validate command succeeds when npm is available and valid."""
|
||||
with patch("superset_cli.cli.validate_npm") as mock_validate:
|
||||
with patch("superset_extensions_cli.cli.validate_npm") as mock_validate:
|
||||
result = cli_runner.invoke(app, ["validate"])
|
||||
|
||||
assert result.exit_code == 0
|
||||
@@ -38,7 +38,7 @@ def test_validate_command_success(cli_runner):
|
||||
@pytest.mark.cli
|
||||
def test_validate_command_calls_npm_validation(cli_runner):
|
||||
"""Test that validate command calls the npm validation function."""
|
||||
with patch("superset_cli.cli.validate_npm") as mock_validate:
|
||||
with patch("superset_extensions_cli.cli.validate_npm") as mock_validate:
|
||||
cli_runner.invoke(app, ["validate"])
|
||||
mock_validate.assert_called_once()
|
||||
|
||||
@@ -27,7 +27,9 @@ from jinja2 import Environment, FileSystemLoader
|
||||
@pytest.fixture
|
||||
def templates_dir():
|
||||
"""Get the templates directory path."""
|
||||
return Path(__file__).parent.parent / "src" / "superset_cli" / "templates"
|
||||
return (
|
||||
Path(__file__).parent.parent / "src" / "superset_extensions_cli" / "templates"
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -20,7 +20,7 @@ from __future__ import annotations
|
||||
import json
|
||||
|
||||
import pytest
|
||||
from superset_cli.utils import read_json, read_toml
|
||||
from superset_extensions_cli.utils import read_json, read_toml
|
||||
|
||||
|
||||
# Read JSON Tests
|
||||
Reference in New Issue
Block a user