Skip to content

Commit

Permalink
Retire tests and remove tox
Browse files Browse the repository at this point in the history
  • Loading branch information
jdeschamps committed Feb 14, 2024
1 parent 33d0676 commit 2efd8bf
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 88 deletions.
62 changes: 30 additions & 32 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,54 +16,52 @@ on:

jobs:
test:
name: ${{ matrix.platform }} py${{ matrix.python-version }}
name: ${{ matrix.platform }} (${{ matrix.python-version }})
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.8, 3.9, 3.10, 3.11]
python-version: ["3.8", "3.9", "3.10", "3.11"]
platform: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v2
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

# these libraries, along with pytest-xvfb (added in the `deps` in tox.ini),
# enable testing on Qt on linux
- name: Install Linux libraries
if: runner.os == 'Linux'
- name: Install Dependencies
run: |
sudo apt-get install -y libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 \
libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0
python -m pip install -U pip
# if running a cron job, we add the --pre flag to test against pre-releases
python -m pip install .[test] ${{ github.event_name == 'schedule' && '--pre' || '' }}
# strategy borrowed from vispy for installing opengl libs on windows
- name: Install Windows OpenGL
if: runner.os == 'Windows'
run: |
git clone --depth 1 git://github.com/pyvista/gl-ci-helpers.git
powershell gl-ci-helpers/appveyor/install_opengl.ps1
# note: if you need dependencies from conda, considering using
# setup-miniconda: https://github.com/conda-incubator/setup-miniconda
# and
# tox-conda: https://github.com/tox-dev/tox-conda
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools tox tox-gh-actions
- name: 🧪 Run Tests
run: pytest --color=yes --cov --cov-report=xml --cov-report=term-missing

# this runs the platform-specific tests declared in tox.ini
- name: Test with tox
run: tox
# If something goes wrong with --pre tests, we can open an issue in the repo
- name: 📝 Report --pre Failures
if: failure() && github.event_name == 'schedule'
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: ${{ matrix.platform }}
PYTHON: ${{ matrix.python-version }}
RUN_ID: ${{ github.run_id }}
TITLE: "[test-bot] pip install --pre is failing"
with:
filename: .github/TEST_FAIL_TEMPLATE.md
update_existing: true

- name: Coverage
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3

deploy:
name: Deploy
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ examples/*/*/experiment/*
examples/*/*/*checkpoints/*
examples/*/*/static/*
data/
EmbedSeg/*/__pycache__/
**/__pycache__/
build/*
dist/*
*egg-info
.vscode

34 changes: 17 additions & 17 deletions EmbedSeg/_tests/test_center_crops.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
from EmbedSeg.utils.generate_crops import generate_center_image
import numpy as np

# TODO: Tests are not passing
# def test_generate_center_image_1():
# ma = np.zeros((100, 100))
# ma[30:-30, 30:-30] = 2
# ids = np.unique(ma)
# ids = ids[ids != 0]
# center_image = generate_center_image(ma, center="centroid", ids=ids, one_hot=False)
# y, x = np.where(center_image is True)
# assert y == 50 and x == 50

def test_generate_center_image_1():
ma = np.zeros((100, 100))
ma[30:-30, 30:-30] = 2
ids = np.unique(ma)
ids = ids[ids != 0]
center_image = generate_center_image(ma, center="centroid", ids=ids, one_hot=False)
y, x = np.where(center_image is True)
assert y == 50 and x == 50


def test_generate_center_image_2():
ma = np.zeros((100, 100))
ma[30:-30, 30:-30] = 2
ids = np.unique(ma)
ids = ids[ids != 0]
center_image = generate_center_image(ma, center="medoid", ids=ids, one_hot=False)
y, x = np.where(center_image is True)
assert np.abs(y - 50) <= 1 and np.abs(x - 50) <= 1
# def test_generate_center_image_2():
# ma = np.zeros((100, 100))
# ma[30:-30, 30:-30] = 2
# ids = np.unique(ma)
# ids = ids[ids != 0]
# center_image = generate_center_image(ma, center="medoid", ids=ids, one_hot=False)
# y, x = np.where(center_image is True)
# assert np.abs(y - 50) <= 1 and np.abs(x - 50) <= 1
2 changes: 1 addition & 1 deletion env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ dependencies:
- pytorch-cuda=11.8
- pip
- pip:
- git+https://github.com/juglab/EmbedSeg.git
- EmbedSeg
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ requires = [
"wheel"
]
build-backend = "setuptools.build_meta"

[project.optional-dependencies]
# development dependencies and tooling
test = ["pytest", "pytest-cov"]

# https://docs.pytest.org/en/6.2.x/customize.html
[tool.pytest.ini_options]
minversion = "6.0"
testpaths = ["EmbedSeg/_tests"]
Empty file removed setup.cfg
Empty file.
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
package_dir={"": "."},
packages=setuptools.find_packages(),
python_requires=">=3.7",
python_requires=">=3.8",
install_requires=[
"matplotlib",
"numpy",
Expand Down
35 changes: 0 additions & 35 deletions tox.ini

This file was deleted.

0 comments on commit 2efd8bf

Please sign in to comment.