Skip to content

Commit

Permalink
Merge pull request #177 from RichieHakim/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
RichieHakim authored Jan 31, 2024
2 parents c48778d + 9409973 commit a622a2a
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 54 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ jobs:
]
extra: [
all,
all_latest,
# all_latest,
]
install-level: [
system,
user,
# user,
]

steps:
Expand Down
2 changes: 1 addition & 1 deletion roicat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
for pkg in __all__:
exec('from . import ' + pkg)

__version__ = '1.1.30'
__version__ = '1.1.32'
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def read_requirements():
# Operating system specific dependencies
# OpenCV >= 4.9 is not supported on macOS < 12
system, version_macos = platform.system(), platform.mac_ver()[0]
print(f"System: {system}, macOS version: {version_macos}")
print(f"System: {system}")
if (system == "Darwin"):
# Safely convert version string components to integers
version_parts = version_macos.split('.')
Expand All @@ -48,6 +48,9 @@ def read_requirements():
print(f"Detected macOS version {version_major_macos}, which is < 12. Installing an older version of OpenCV: {version_opencv_macos_sub12}")
deps_all_dict['opencv_contrib_python'] = version_opencv_macos_sub12
deps_all_latest['opencv_contrib_python'] = version_opencv_macos_sub12
import re
## find the numbers in the string
version_opencv = '.'.join(re.findall(r'[0-9]+', deps_all_dict['opencv_contrib_python']))


## Make different versions of dependencies
Expand Down
9 changes: 0 additions & 9 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
# from os.path import dirname, basename, isfile, join
# import glob
# modules = glob.glob(join(dirname(__file__), "*.py"))
# __all__ = [ basename(f)[:-3] for f in modules if isfile(f) and not f.endswith('__init__.py')]

# for pkg in __all__:
# exec('from . import ' + pkg)

# del dirname, basename, isfile, join, glob, modules, pkg
90 changes: 49 additions & 41 deletions tests/test_packages.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
import warnings


PACKAGES = [
'GPUtil',
'PIL',
'cpuinfo',
'cv2',
'jupyter',
'mat73',
'matplotlib',
'natsort',
'numpy',
'onnx',
'onnxruntime',
'optuna',
'psutil',
'pytest',
'scipy',
'seaborn',
'skl2onnx',
'sklearn',
'sparse',
'torch',
'torchaudio',
'torchvision',
'tqdm',
'xxhash',
'yaml',
'bokeh',
'holoviews',
'jupyter_bokeh',
'umap',
'hdbscan',
'kymatio',
]

def test_internal_package_tests():
"""
Test packages.
Expand Down Expand Up @@ -29,60 +63,34 @@ def test_internal_package_tests():
exec(f'import {pkg_s}')
print(f'RH: Successfully imported {pkg_s}')
except ImportError:
warnings.warn(f'RH: Could not import {pkg_s}.')
warnings.warn(f'RH: Could not import {pkg_s}. Skipping tests.')
continue

## Get a handle on the package
pkg_h = eval(pkg_s)
else:
try:
## Get a handle on the package
pkg_h = eval(pkg_s)

## Get the path to the package
path_pkg = str(Path(pkg_h.__file__).parent)

## Get the path to the package
path_pkg = str(Path(pkg_h.__file__).parent)
## Run the tests
pytest.main([path_pkg, '-v'])
except Exception as e:
warnings.warn(f'RH: Could not run tests for {pkg_s}. Error: {e}')
continue

## Run the tests
pytest.main([path_pkg, '-v'])

def test_importing_packages():
"""
Runs pytest on the core packages.
"""
corePackages = [
'hdbscan',
'holoviews',
'jupyter',
'kymatio',
'matplotlib',
'natsort',
'numpy',
'cv2',
'optuna',
'PIL',
'pytest',
'sklearn',
'scipy',
'seaborn',
'sparse',
'tqdm',
'umap',
'xxhash',
'bokeh',
'psutil',
'cpuinfo',
'GPUtil',
'yaml',
'mat73',
'torch',
'torchvision',
'torchaudio',
'skl2onnx',
'onnx',
'onnxruntime',
]

for pkg in corePackages:
for pkg in PACKAGES:
try:
exec(f'import {pkg}')
except ModuleNotFoundError:
warnings.warn(f'RH Warning: {pkg} not found. Skipping tests.')
warnings.warn(f'RH Warning: {pkg} not found.')

def test_torch(
device='cpu',
Expand Down

0 comments on commit a622a2a

Please sign in to comment.