Skip to content

Commit

Permalink
Tests fail after #178 merged (#184)
Browse files Browse the repository at this point in the history
* add setuptools_scm to tox requires

* try specify pip ver

* pip ver in workflow

* setuptools and wheel installed in workflow

* try remove pip require

* pin setuptools in workflow

* pin setuptools in workflow lower

* strip out tox-conda

* point to env yaml

* allowlist pytest

* check conda

* allowlist conda

* allowlist in correct section

* correct tox formatting

* activate env in tox

* pytest cov in reqs

* remove vestigial tox-conda comments

* fix docstrings

* update envlist

---------

Co-authored-by: Antony Lewis <[email protected]>
  • Loading branch information
itrharrison and cmbant authored Aug 1, 2024
1 parent a53b922 commit 1513440
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install Dependencies
shell: bash -el {0}
run: |
pip install tox-conda flake8
pip install tox flake8
- name: Check Code Style
shell: bash -el {0}
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ jobs:
uses: conda-incubator/setup-miniconda@v2
with:
auto-activate-base: false
activate-environment: soliket-tests
environment-file: soliket-tests.yml
python-version: ${{ matrix.python-version }}
channels: conda-forge
- name: Install Dependencies
shell: bash -el {0}
run: |
pip install tox-conda
pip install tox
- name: Run Tests
shell: bash -el {0}
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ jobs:
uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: false
activate-environment: soliket-tests
environment-file: soliket-tests.yml
python-version: ${{ matrix.python-version }}
channels: conda-forge
- name: Install Dependencies
shell: bash -el {0}
run: |
pip install tox-conda
pip install tox
- name: Run Tests
shell: bash -el {0}
run: |
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies = [
"numpy",
"scipy>=1.6",
"pandas", # to remove
"pytest-cov",
"astropy",
"cobaya",
"sacc",
Expand Down Expand Up @@ -65,7 +66,6 @@ version_file = "soliket/_version.py"
[project.optional-dependencies]
all = [
"cosmopower",
"pyccl",
"tensorflow_probability<0.22",
]
docs = [
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
numpy
scipy>=1.6
pandas
pytest-cov
scikit-learn
pyyaml
py-bobyqa
Expand Down
1 change: 1 addition & 0 deletions soliket-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ channels:
dependencies:
- python>=3.8,<3.12
- pip
- pytest
- pytest-cov
- compilers
- make
Expand Down
2 changes: 1 addition & 1 deletion soliket/bias/bias.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def get_Pk_gm_grid(self) -> dict:


class Linear_bias(Bias):
"""
r"""
:Synopsis: Linear bias model.
Has one free parameter, :math:`b_\mathrm{lin}` (``b_lin``).
Expand Down
2 changes: 1 addition & 1 deletion soliket/cosmopower/cosmopower.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def get_Cl(self, ell_factor: bool = False, units: str = "FIRASmuK2") -> dict:
return cls

def ell_factor(self, ls: np.ndarray, spectra: str) -> np.ndarray:
"""
r"""
Calculate the ell factor for a specific spectrum.
These prefactors are used to convert from Cell to Dell and vice-versa.
Expand Down
6 changes: 3 additions & 3 deletions soliket/mflike/mflike.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def logp(self, **params_values):
return self.loglike(cmbfg_dict)

def loglike(self, cmbfg_dict):
"""
r"""
Computes the gaussian log-likelihood
:param cmbfg_dict: the dictionary of theory + foregrounds
Expand Down Expand Up @@ -215,7 +215,7 @@ def get_cl_meta(spec):
return exp_1, exp_2, pols, scls, symm

def get_sacc_names(pol, exp_1, exp_2):
"""
r"""
Lower-level function of `prepare_data`.
Translates the polarization combination and channel
name of a given entry in the `spectra`
Expand Down Expand Up @@ -388,7 +388,7 @@ def get_sacc_names(pol, exp_1, exp_2):
self.data = GaussianData("mflike", self.ell_vec, self.data_vec, self.cov)

def _get_power_spectra(self, cmbfg):
"""
r"""
Get :math:`D_{\ell}` from the theory component
already modified by ``theoryforge_MFLike``
Expand Down
18 changes: 8 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
[tox]
requires =
tox-conda
setuptools >= 30.3.0
setuptools >= 64
setuptools_scm >= 8
pip >= 19.3.1
envlist =
py{38,39,310}-test{,-all}{,-latest,-oldest}{,-cov}
py{38,39,310,311}-test{,-all}{,-latest,-oldest}{,-cov}
codestyle

[testenv]
conda_env = soliket-tests.yml
conda_setup_args=
--override-channels
conda_install_args=
--override-channels
allowlist_externals =
conda
pytest

setenv =
COBAYA_PACKAGES_PATH = ./cobaya_packages
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL = True

# Pass through the following environment variables which may be needed for the CI
passenv = HOME WINDIR LC_ALL LC_CTYPE CI TRAVIS
passenv = HOME, WINDIR, LC_ALL, LC_CTYPE, CI, TRAVIS

# Run the tests in a temporary directory to make sure that we don't import
# this package from the source tree
Expand All @@ -44,14 +42,14 @@ extras =
all: all

commands =
conda info
pip freeze
all: cobaya-install planck_2018_highl_plik.TTTEEE_lite_native --no-set-global
!cov: pytest -vv --rootdir={toxinidir} --pyargs {toxinidir}/soliket/ {posargs}
cov: pytest -vv --rootdir={toxinidir} --pyargs {toxinidir}/soliket/ --cov soliket --cov-report=xml --cov-config={toxinidir}/pyproject.toml {posargs}

[testenv:codestyle]
skip_install = true
conda_env =
changedir = .
description = check code style, e.g. with flake8
deps = flake8
Expand Down

0 comments on commit 1513440

Please sign in to comment.