- Python 3.10 or higher
- pip package manager
- (Optional) Databricks workspace access for remote testing
- Clone the repository:
git clone https://github.com/yourusername/dbx_test.git
cd dbx_test- Install in editable mode:
pip install -e .- Install Nutter (required for local testing):
pip install nutter- Verify installation:
dbx_test --versionpip install dbx_test
pip install nutterFor contributors and developers:
# Clone repository
git clone https://github.com/yourusername/dbx_test.git
cd dbx_test
# Install with dev dependencies
pip install -e ".[dev]"Run the following commands to verify your installation:
# Check version
dbx_test --version
# Display help
dbx_test --help
# Test discovery (in a directory with tests)
dbx_test discover --tests-dir testsmkdir -p configCreate config/test_config.yml:
workspace:
host: "https://your-workspace.cloud.databricks.com"
token_env: "DATABRICKS_TOKEN"
cluster:
size: "M"
spark_version: "13.3.x-scala2.12"
execution:
timeout: 600
parallel: false
paths:
workspace_root: "/Workspace/Repos/production/tests"
test_pattern: "**/*_test.py"
reporting:
output_dir: ".dbx_test-results"
formats: ["junit", "console"]For local development:
# Linux/Mac
export DATABRICKS_TOKEN="your-token-here"
export DATABRICKS_HOST="https://your-workspace.cloud.databricks.com"
# Windows (PowerShell)
$env:DATABRICKS_TOKEN="your-token-here"
$env:DATABRICKS_HOST="https://your-workspace.cloud.databricks.com"For persistent configuration, add to your shell profile:
# ~/.bashrc or ~/.zshrc
export DATABRICKS_TOKEN="your-token-here"
export DATABRICKS_HOST="https://your-workspace.cloud.databricks.com"- Go to Databricks workspace
- Click on your user profile → User Settings
- Navigate to Access Tokens
- Click "Generate New Token"
- Copy the token and set as environment variable
For Azure Databricks with AAD:
workspace:
host: "https://adb-xxx.azuredatabricks.net"
# Use Azure CLI authentication
token_env: "DATABRICKS_TOKEN"Then authenticate:
az login
az account get-access-token --resource 2ff814a6-3304-4ab8-85cb-cd0e6f879c1dFor AWS Databricks:
workspace:
host: "https://xxx.cloud.databricks.com"
# Configure AWS credentials
token_env: "DATABRICKS_TOKEN"mkdir -p testsdbx_test scaffold my_first_notebookThis creates tests/my_first_notebook_test.py with a template.
dbx_test run --local --tests-dir testsdbx_test run --remote --tests-dir tests --config config/test_config.ymlSolution:
- Ensure installation completed successfully
- Check that Python scripts directory is in PATH
- Try:
python -m dbx_test.cli --help
Solution:
pip install nutterSolution:
# Use --user flag
pip install --user -e .
# Or use virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Linux/Mac
# or
venv\Scripts\activate # Windows
pip install -e .Solution:
- Verify
DATABRICKS_TOKENis set correctly - Check workspace URL format (should include https://)
- Verify token has not expired
- Check network connectivity
Solution:
pip install --upgrade databricks-sdk- Install Python extension
- Create
.vscode/settings.json:
{
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.formatting.provider": "black",
"python.testing.pytestEnabled": false,
"files.exclude": {
"**/__pycache__": true,
"**/*.pyc": true,
".dbx_test-results": true
}
}- Open project
- Configure Python interpreter (File → Settings → Project → Python Interpreter)
- Mark
testsdirectory as Test Sources Root - Configure code style to use Black formatter
For containerized testing:
Create Dockerfile:
FROM python:3.10-slim
WORKDIR /app
# Install dependencies
COPY pyproject.toml .
RUN pip install -e .
RUN pip install nutter
# Copy application
COPY . .
# Run tests
CMD ["dbx_test", "run", "--local", "--tests-dir", "tests"]Build and run:
docker build -t dbx_test .
docker run -e DATABRICKS_TOKEN=$DATABRICKS_TOKEN dbx_test- Read the Writing Tests Guide
- Configure your environment: Configuration Guide
- Set up CI/CD: CI/CD Integration Guide
- Explore Example Tests
- Check the FAQ
- Open an issue on GitHub
- Read the Troubleshooting Guide