Skip to content

Commit

Permalink
Merge pull request #120 from CosmoStat/fix/black-test-failure
Browse files Browse the repository at this point in the history
Fix black test failure in CI
  • Loading branch information
jeipollack authored Mar 4, 2024
2 parents 384f6d9 + d3b3619 commit 478aed1
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 18 deletions.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@
- [ ] All changed files have been checked and comments provided to the developer
- [ ] All of the reviewer's comments have been satisfactorily addressed by the developer
- [ ] All Validation tests for the reported error are passing
- [ ] I have reviewed the CI log to verify if any files require formatting with Black. If any files are found to be improperly formatted, I have provided comments indicating the need for formatting.
25 changes: 19 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# This workflow will install Python dependencies, run tests, and lint with multiple versions of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: CI
Expand All @@ -11,19 +11,32 @@ on:

jobs:
test-full:
runs-on: [ubuntu-latest]
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.9", "3.10"]

steps:
- name:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python 3.10.5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: "3.10.5"
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: python -m pip install ".[test]"

- name: Test with pytest
run: python -m pytest

# Add Black formatter
- name: Install Black formatter
run: python -m pip install black

- name: Check code formatting with Black
run: black . --check --diff


3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ release = [

test = [
"pytest",
"pytest-black",
"pytest-cases",
"pytest-cov",
"pytest-emoji",
"pytest-raises",
Expand All @@ -77,7 +75,6 @@ convention = "numpy"
[tool.pytest.ini_options]
addopts = [
"--verbose",
"--black",
"--emoji",
"--cov=wf_psf",
"--cov-report=term-missing",
Expand Down
1 change: 1 addition & 0 deletions src/wf_psf/data/training_preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:Authors: Jennifer Pollack <[email protected]> and Tobias Liaudat <[email protected]>
"""

import numpy as np
import wf_psf.utils.utils as utils
import tensorflow as tf
Expand Down
1 change: 1 addition & 0 deletions src/wf_psf/psf_models/zernikes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:Author: Tobias Liaudat <[email protected]> and Jennifer Pollack <[email protected]>
"""

import numpy as np
import zernike as zk
import tensorflow as tf
Expand Down
1 change: 1 addition & 0 deletions src/wf_psf/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:Author: Jennifer Pollack <[email protected]>
"""

import argparse
from wf_psf.utils.read_config import read_stream
from wf_psf.utils.io import FileIOHandler
Expand Down
1 change: 1 addition & 0 deletions src/wf_psf/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"""

import pytest
from wf_psf.utils.read_config import RecursiveNamespace
from wf_psf.training.train import TrainingParamsHandler
Expand Down
1 change: 1 addition & 0 deletions src/wf_psf/tests/metrics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:Author: Jennifer Pollack <[email protected]>
"""

import pytest
from wf_psf.utils.read_config import RecursiveNamespace
from wf_psf.training import train
Expand Down
1 change: 1 addition & 0 deletions src/wf_psf/tests/test_utils/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"""

import pytest
import os

Expand Down
12 changes: 6 additions & 6 deletions src/wf_psf/training/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,13 @@ def train(

# Save optimisation history in the saving dict
if psf_model.save_optim_history_param:
saving_optim_hist[
"param_cycle{}".format(current_cycle)
] = hist_param.history
saving_optim_hist["param_cycle{}".format(current_cycle)] = (
hist_param.history
)
if psf_model.save_optim_history_nonparam:
saving_optim_hist[
"nonparam_cycle{}".format(current_cycle)
] = hist_non_param.history
saving_optim_hist["nonparam_cycle{}".format(current_cycle)] = (
hist_non_param.history
)

# Save last cycle if no cycles were saved
if not training_handler.multi_cycle_params.save_all_cycles:
Expand Down
7 changes: 4 additions & 3 deletions src/wf_psf/utils/configs_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:Authors: Jennifer Pollack <[email protected]>
"""

import numpy as np
from wf_psf.utils.read_config import read_conf
from wf_psf.data.training_preprocessing import TrainingDataHandler, TestDataHandler
Expand Down Expand Up @@ -412,9 +413,9 @@ def call_plot_config_handler_run(self, model_metrics):
)

# Update metrics_confs dict with latest result
plots_config_handler.metrics_confs[
self._file_handler.workdir
] = self.metrics_conf
plots_config_handler.metrics_confs[self._file_handler.workdir] = (
self.metrics_conf
)

# Update metric results dict with latest result
plots_config_handler.list_of_metrics_dict[self._file_handler.workdir] = [
Expand Down

0 comments on commit 478aed1

Please sign in to comment.