Skip to content

Commit

Permalink
fix: Coverage config for source
Browse files Browse the repository at this point in the history
  • Loading branch information
dashmug committed May 17, 2024
1 parent 928ac9d commit f5532d8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
# Glue ETL supports only Python 3.10.
python-version: ["3.9", "3.10"]
steps:
- uses: actions/checkout@v4.1.5
- uses: actions/checkout@v4.1.6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5.1.0
with:
Expand Down Expand Up @@ -49,28 +49,25 @@ jobs:
run: poetry export --with=dev --output docker/requirements.txt && git diff --exit-code
- name: Build python packages
run: poetry build
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
tests:
name: Run tests in Glue container
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.5
- uses: actions/checkout@v4.1.6
with:
fetch-depth: 0
- name: Build container and run tests
run: USER_ID=$(id -u) docker compose --file docker/docker-compose.yml run --rm --remove-orphans --build glue-utils -c pytest
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
pip-audit:
name: Audit requirements
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.5
- uses: actions/checkout@v4.1.6
- name: Audit requirements using pip-audit
uses: pypa/gh-action-pip-audit@v1.0.8
with:
Expand All @@ -79,7 +76,7 @@ jobs:
name: Check Dockerfile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.5
- uses: actions/checkout@v4.1.6
- name: Validate Dockerfile using hadolint
uses: hadolint/hadolint-action@v3.1.0
with:
Expand All @@ -88,6 +85,6 @@ jobs:
name: Check Makefile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.5
- uses: actions/checkout@v4.1.6
- name: Check Makefile for errors
uses: Uno-Takashi/checkmake-action@main
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,14 @@ disallow_incomplete_defs = false
disallow_untyped_defs = false

[tool.pytest.ini_options]
addopts = "--cov=glue_utils --cov-branch --cov-report=term --cov-report=html --cov-report=xml"
addopts = "--cov=glue_utils --cov-report=term --cov-report=html --cov-report=xml"
filterwarnings = [
"ignore::FutureWarning:pyspark.sql.context",
]

[tool.coverage.run]
relative_files = true
branch = true
omit = ["**/test_*.py"]

[tool.coverage.paths]
Expand Down
3 changes: 3 additions & 0 deletions test/pyspark/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ def test_init_with_spark_conf(self, mock_get_resolved_options):
"JOB_NAME": "test-job",
}

# Make sure existing context is stopped.
SparkContext.getOrCreate().stop()

spark_conf = SparkConf()
spark_conf.set("test.key", "test.value")

Expand Down

0 comments on commit f5532d8

Please sign in to comment.