用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/microsoft/semantic-link-labs --skill run-tests命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Guide for the visual style, structure, and shared building blocks used by Semantic Link Labs interactive UI tools (HTML widgets and anywidget-based widgets). Use this when adding a new interactive UI, modifying an existing one, or adding shared visual components.
Methodology and an executable rule catalog for diagnosing and optimizing DAX query performance. Use this when analyzing a slow DAX query, interpreting trace timings / DAX query plans, reducing column cardinality, or extending the performance-analysis rules used by the interactive DAX test widget (sempy_labs.semantic_model.test).
Guide for the DAX query shape produced by the Query Builder in the DAX test widget. Use this when modifying how the Query Builder generates DAX, or when generating an EVALUATE query from columns, measures, filters and sorting.
正在显示 SKILL.md
基于 SOC 职业分类
| name | run-tests |
| description | Guide for running pytest tests locally. Use this when running tests to verify code changes. |
This skill covers running pytest tests for the Semantic Link Labs project.
Use this skill when you need to:
| Component | Details |
|---|---|
| Framework | pytest |
| Location | tests/ directory |
| Configuration | pyproject.toml |
# Install package in editable mode with test dependencies
pip install -e ".[test]"
Create conda environment from environment.yml:
conda env create -f environment.yml
conda activate fabric
pip install -e .
# Run all tests
pytest -s tests/
# Run with verbose output
pytest -sv tests/
# Run specific test file
pytest -s tests/test_example.py
# Run specific test by name pattern
pytest -s tests/ -k test_my_function
# Run multiple tests by pattern
pytest -s tests/ -k "test_list or test_create"
# Stop on first failure
pytest -sx tests/
pytest automatically discovers tests in:
test_*.py or *_test.pytest_*Test*# Show test names and results
pytest -v tests/
# Show test names with print statements
pytest -sv tests/
The -s flag captures stdout:
# Show print output during tests
pytest -s tests/
# Show slowest 10 tests
pytest --durations=10 tests/
# Run tests matching pattern
pytest -k "workspace" tests/
# Run tests NOT matching pattern
pytest -k "not slow" tests/
# Combine patterns
pytest -k "workspace and not admin" tests/
# Run specific test file
pytest tests/test_workspaces.py
# Run tests in directory
pytest tests/admin/
pytest -x tests/
pytest --pdb tests/
pytest -l tests/
pytest -vvv tests/
import pytest
import pandas as pd
def test_my_function_returns_dataframe():
"""Test that my_function returns a DataFrame."""
from sempy_labs import my_function
result = my_function()
assert isinstance(result, pd.DataFrame)
def test_my_function_with_parameter():
"""Test my_function with specific parameter."""
from sempy_labs import my_function
result = my_function(workspace="Test Workspace")
assert not result.empty
assert "Name" in result.columns
def test_my_function_raises_on_invalid_input():
"""Test that my_function raises ValueError on invalid input."""
from sempy_labs import my_function
with pytest.raises(ValueError, match="Invalid"):
my_function(invalid_param="bad value")
The project uses GitHub Actions for CI. See .github/workflows/build.yaml:
- name: Test with pytest
shell: bash -el {0}
run: |
pytest -s tests/
Before committing code changes:
# Run all tests
pytest -s tests/
# Run tests for modified area
pytest -s tests/ -k relevant_test_pattern
# Check for any failures
# If failures, fix code and re-run
If tests fail with import errors:
# Ensure package is installed in editable mode
pip install -e .
If tests fail with missing package:
# Install test dependencies
pip install -e ".[test]"
If tests behave unexpectedly:
# Recreate conda environment
conda env remove -n fabric
conda env create -f environment.yml
conda activate fabric
pip install -e .