Skip to content

Commit

Permalink
Deprecate python3.6 (#976)
Browse files Browse the repository at this point in the history
Deprecate python3.6 and fix test coverage issues

Co-authored-by: Adrien Berchet <adrien.berchet@epfl.ch>

Co-authored-by: Adrien Berchet <adrien.berchet@epfl.ch>
  • Loading branch information
eleftherioszisis and adrien-berchet committed Dec 7, 2021
1 parent 5a48859 commit 59b9589
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/run-tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.7, 3.8]

steps:
- uses: actions/checkout@v2
Expand All @@ -28,10 +28,10 @@ jobs:
run: |
tox
- name: Upload to codecov
if: ${{matrix.python-version == '3.6'}}
if: ${{matrix.python-version == '3.8'}}
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: false
files: ./coverage.xml
flags: pytest
name: "neurom-py36"
name: "neurom-py38"
3 changes: 2 additions & 1 deletion neurom/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ def get_test(stest):
"""Returns the correct stat test."""
sts = {StatTests.ks: 'ks_2samp', StatTests.wilcoxon: 'wilcoxon', StatTests.ttest: 'ttest_ind'}

if stest in StatTests:
if stest in sts:
return sts[stest]

raise TypeError('Statistical test not recognized. Choose from ks, wilcoxon, ttest.')


Expand Down
13 changes: 13 additions & 0 deletions tests/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ def test_optimal_distribution_uniform():
assert optimal.type == 'uniform'


def test_get_test():

stat_test_enums = (st.StatTests.ks, st.StatTests.wilcoxon, st.StatTests.ttest)
expected_stat_test_strings = ("ks_2samp", "wilcoxon", "ttest_ind")

for i, stat_test in enumerate(stat_test_enums):
assert st.get_test(stest=stat_test) == expected_stat_test_strings[i]

# stest does not exist in the available tests defined within the function
with pytest.raises(TypeError):
st.get_test(stest="UNKNOWN")


def test_fit_results_dict_uniform():
a = st.FitResults(params=[1, 2], errs=[3,4], type='uniform')
d = st.fit_results_to_dict(a)
Expand Down
15 changes: 7 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ testdeps =

[tox]
envlist =
{py36,py37,py38}
py36-lint
py36-coverage
py36-docs
{py37,py38}
py38-lint
py38-coverage
py38-docs

[testenv]
deps = {[base]testdeps}
extras = plotly
commands = pytest tests

[testenv:py36-lint]
[testenv:py38-lint]
deps =
pycodestyle
pydocstyle
Expand All @@ -27,7 +27,7 @@ commands =
pydocstyle --match-dir='(?!test).*' {toxinidir}/neurom
pylint --rcfile=pylintrc --extension-pkg-whitelist=numpy --ignore=tests neurom

[testenv:py36-coverage]
[testenv:py38-coverage]
deps =
{[base]testdeps}
pytest-cov
Expand All @@ -38,7 +38,7 @@ commands =
--cov-fail-under=100 \
--cov-report=xml

[testenv:py36-docs]
[testenv:py38-docs]
changedir = doc
extras = docs
commands =
Expand All @@ -58,6 +58,5 @@ convention = google

[gh-actions]
python =
3.6: py36, py36-plotly, py36-lint, py36-docs, py36-coverage
3.7: py37
3.8: py38

0 comments on commit 59b9589

Please sign in to comment.