Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try tests without tox #185

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,11 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Conda w/ Python 3.11
- name: Install Conda w/ Python 3.12
uses: conda-incubator/setup-miniconda@v2
with:
auto-activate-base: false
python-version: '3.11'
channels: conda-forge
python-version: '3.12'
- name: Install Dependencies
shell: bash -el {0}
run: |
pip install tox-conda flake8
run: pip install Flake8-pyproject
- name: Check Code Style
shell: bash -el {0}
run: |
tox -e codestyle
run: flake8 .
27 changes: 11 additions & 16 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
branches: [ master ]

env:
COBAYA_PACKAGES_PATH: ./cobaya_packages
SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: True

jobs:
test:
name: ${{ matrix.name }}
Expand All @@ -18,43 +22,34 @@ jobs:
- name: latest supported versions
os: ubuntu-latest
python-version: '3.11'
toxenv: py311-test-all-latest-cov

- name: oldest supported versions
os: ubuntu-latest
python-version: '3.8'
toxenv: py38-test-oldest

- name: macOS latest
os: macos-latest
python-version: '3.11'
toxenv: py311-test-latest

- name: Windows latest
os: windows-latest
python-version: '3.11'
toxenv: py311-test-latest
env:
PYTHONIOENCODING: utf-8
PYTHONUTF8: 1
python-version: '3.12'

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Conda w/ Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: false
activate-environment: soliket-tests
auto-activate-base: False
python-version: ${{ matrix.python-version }}
channels: conda-forge
- name: Install Dependencies
shell: bash -el {0}
run: |
pip install tox-conda
environment-file: soliket-tests.yml

- name: Run Tests
shell: bash -el {0}
run: |
tox -e ${{ matrix.toxenv }} ${{ matrix.toxargs }} -- ${{ matrix.toxposargs }}
- if: contains(matrix.toxenv, '-cov')
run: pip install -e . && pytest --cov=./ --cov-report=xml .
- if: matrix.os == 'ubuntu-latest'
name: Report Coverage
uses: codecov/codecov-action@v3
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = [
]
description = "Likelihood and Theory codes for the Simons Observatory."
readme = "README.rst"
requires-python = ">=3.8, <3.12"
requires-python = ">=3.8"
license = {text = "MIT"}
dependencies = [
"requests",
Expand All @@ -20,7 +20,7 @@ dependencies = [
"pyccl >= 3.0; platform_system!='Windows'",
"pyhalomodel",
"scikit-learn",
"camb",
"camb >= 1.5.0",
"getdist",
"syslibrary>=0.2.0",
]
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
numpy
scipy>=1.6
pandas
scikit-learn
pyyaml
py-bobyqa
packaging
tqdm
tensorflow<2.14
portalocker
dill
fuzzywuzzy
Expand Down
2 changes: 1 addition & 1 deletion soliket-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- nodefaults
dependencies:
- python>=3.8,<3.12
- python>=3.8
- pip
- pytest-cov
- compilers
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
3 changes: 1 addition & 2 deletions soliket/tests/test_cosmopower.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_cosmopower_import(request):
def test_cosmopower_theory(request):
info_dict['theory']['soliket.CosmoPower']['network_path'] = \
os.path.join(request.config.rootdir, 'soliket/cosmopower/data/CP_paper')
model_fiducial = get_model(info_dict) # noqa F841
model_fiducial = get_model(info_dict) # noqa F841


@pytest.mark.skipif(not HAS_COSMOPOWER, reason='test requires cosmopower')
Expand All @@ -91,7 +91,6 @@ def test_cosmopower_loglike(request):

@pytest.mark.skipif(not HAS_COSMOPOWER, reason='test requires cosmopower')
def test_cosmopower_against_camb(request):

info_dict['theory'] = {'camb': {'stop_at_error': True}}
model_camb = get_model(info_dict)
logL_camb = float(model_camb.loglikes({})[0])
Expand Down
14 changes: 4 additions & 10 deletions soliket/tests/test_mflike.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,10 @@
}


if Version(camb.__version__) >= Version('1.4'):
chi2s = {"tt": 544.9017,
"te": 136.6051,
"ee": 166.1897,
"tt-te-et-ee": 787.9529}
else:
chi2s = {"tt": 544.8797,
"te-et": 151.8197,
"ee": 166.2835,
"tt-te-et-ee": 787.9843}
chi2s = {"tt": 544.9017,
"te": 136.6051,
"ee": 166.1897,
"tt-te-et-ee": 787.9529}

pre = "test_data_sacc_"

Expand Down
75 changes: 0 additions & 75 deletions tox.ini

This file was deleted.

Loading