Skip to content

Commit

Permalink
Add test setup for pytest and tox
Browse files Browse the repository at this point in the history
  • Loading branch information
TorecLuik committed Dec 20, 2023
1 parent 04e67fd commit f548202
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 2 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ build-backend = "setuptools.build_meta"

[project]
name = "omero_slurm_client"
#version = "0.0.1"
dynamic = ["version"]
authors = [{ name = "Torec Luik", email = "[email protected]" }]
description = "A python library for easy connecting between Omero (jobs) and a Slurm cluster"
readme = "README.md"
requires-python = ">=3.6"
keywords = ["omero", "slurm"]
keywords = ["omero", "slurm", "high-performance-computing", "fair", "image-analysis", "bioimaging", "high-throughput-screening", "high-content-screening", "cytomine", "biomero", "biaflows"]
license = { file = "LICENSE" }
classifiers = [
"Programming Language :: Python :: 3",
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
setup(name="omero_slurm_client",
use_scm_version=True,
setup_requires=['setuptools_scm'],
tests_require=['pytest'],
install_requires=[
# "requests==2.31.0", # needs Python3.7+, which will use the toml instead
"requests==2.27.1",
Expand Down
Empty file added tests/integration/__init__.py
Empty file.
Empty file added tests/unit/__init__.py
Empty file.
23 changes: 23 additions & 0 deletions tests/unit/test_slurm_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from omero_slurm_client import SlurmClient
import pytest


def test_slurm_client_init():
# Test default initialization
slurm_client = SlurmClient()
assert isinstance(slurm_client, SlurmClient)
assert slurm_client.slurm_data_path == SlurmClient._DEFAULT_SLURM_DATA_PATH
assert slurm_client.slurm_images_path == SlurmClient._DEFAULT_SLURM_IMAGES_PATH
# Add more assertions for other default values

# Test custom initialization
slurm_client_custom = SlurmClient(
host="custom_host",
slurm_data_path="/custom/data/path",
slurm_images_path="/custom/images/path",
# Add more custom parameters
)
assert slurm_client_custom.host == "custom_host"
assert slurm_client_custom.slurm_data_path == "/custom/data/path"
assert slurm_client_custom.slurm_images_path == "/custom/images/path"
# Add more assertions for other custom values
14 changes: 14 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
envlist = py{36,39,312}
requires = tox-conda

[testenv]
deps =
pytest
commands =
pytest

0 comments on commit f548202

Please sign in to comment.