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

Refactor tests #27

Merged
merged 55 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
4176c3b
proto benchmarking smoke test (WIP)
sfmig Oct 16, 2023
a9f8f11
added git URL to monkeypatched asv but not fully working yet (WIP)
sfmig Oct 16, 2023
8ef7e57
rename workflows directory
sfmig Dec 1, 2023
ff2bbf1
rename and reorganise default configs and cellfinder main workflow sc…
sfmig Dec 1, 2023
36eb5b2
update benchmarks to new locations of modules
sfmig Dec 1, 2023
4b296d3
update modules locations in tests
sfmig Dec 1, 2023
8c0617d
replace argparse by typer
sfmig Dec 4, 2023
16db368
add test for setup logger
sfmig Dec 4, 2023
bd82760
pass logger by name
sfmig Dec 4, 2023
c162460
unit tests for setup steps (WIP)
sfmig Dec 4, 2023
e2a5eea
rename path variable in config. add unit tests for setup steps.
sfmig Dec 6, 2023
7c5e59a
replace message by message pattern for regex
sfmig Dec 6, 2023
e0a2206
fix to retrieve custom logger
sfmig Dec 6, 2023
095e2e1
remove notes about logger issue
sfmig Dec 6, 2023
a9dbbd2
small edits to comments
sfmig Dec 6, 2023
98385c5
make two modules for unit tests (workflows and benchmarks)
sfmig Dec 6, 2023
289b2f8
renaming modules and add test for setup_workflow
sfmig Dec 6, 2023
edce94c
remove old workflow tests and conftest
sfmig Dec 6, 2023
0bab20f
take logger name from module
sfmig Dec 6, 2023
b4d585f
add integration tests and conftest for fixtures shared between unit a…
sfmig Dec 6, 2023
0533548
change logger name source in logger test
sfmig Dec 6, 2023
2dda253
rename tests for benchmarks
sfmig Dec 6, 2023
cc47a0f
add entrypoint and preliminary tests (WIP)
sfmig Dec 6, 2023
36a78cc
remove benchmarks results
sfmig Dec 6, 2023
0956ca5
fix CLI test
sfmig Dec 6, 2023
ea731dc
remove condition for logger one handler only
sfmig Dec 7, 2023
550ad45
add docstrings and typing
sfmig Dec 7, 2023
59a31ca
remove conftest and move some integration tests to unit
sfmig Dec 7, 2023
233c3df
recover conftest for shared fixtures
sfmig Dec 7, 2023
8dd1374
parametrise integration tests
sfmig Dec 7, 2023
91a39b5
move shared fixtures from unit to conftest.py
sfmig Dec 7, 2023
8435f32
change argument for CLI via main using typer
sfmig Dec 7, 2023
4395380
move custom logger fixture to conftest under unit tests
sfmig Dec 7, 2023
6e0801b
fix for brainglobe workflows benchmark test
sfmig Dec 7, 2023
9b69d1c
mark benchmark tests as skip for now
sfmig Dec 7, 2023
2bc55b4
replace typer by argparse (WIP)
sfmig Dec 7, 2023
ea8e1ee
add test for config parser
sfmig Dec 7, 2023
fde2f6e
argparse fix but not the best
sfmig Dec 7, 2023
6971548
change parser and test to always receive a list
sfmig Dec 7, 2023
36676cf
add default to main and move parser out of main
sfmig Dec 7, 2023
0327e41
fix typing of List
sfmig Dec 8, 2023
0614e89
add init file for benchmarks
sfmig Dec 8, 2023
3b66b3e
reorganise fixtures in conftest
sfmig Dec 8, 2023
25abb7b
add wrapper fn for entrypoint
sfmig Dec 8, 2023
8a269a3
edit asv to fetch repo from this branch (for benchmarks PR)
sfmig Dec 11, 2023
a30c28b
edit paths to asv config (for benchmarks PR)
sfmig Dec 11, 2023
9a8a430
small edits from PR review comments
sfmig Dec 11, 2023
429f970
Apply suggestions from code review
sfmig Dec 11, 2023
2913946
add teardown comment to benchmark test (currently skipped)
sfmig Dec 11, 2023
6e5a9a8
remove dvcs from monkeypatched asv config in benchmark test (currentl…
sfmig Dec 11, 2023
c3974c0
fill in docstring for benchmark test (currently skipped)
sfmig Dec 11, 2023
38d15e4
mypy fix
sfmig Dec 11, 2023
d867f9f
fix linting
sfmig Dec 11, 2023
f17027e
logger_name in lowercase
sfmig Dec 11, 2023
466667c
Merge branch 'main' into smg/tests-refactor
sfmig Dec 14, 2023
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
7 changes: 4 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ exclude *.yaml
exclude *.yml
exclude Dockerfile
exclude *.ini
exclude asv.conf.json
exclude brainglobe_workflows/cellfinder/default_config.json

recursive-include brainglobe_workflows *.py
recursive-include brainglobe_workflows/configs *.json
recursive-include brainglobe_benchmarks *.py
recursive-exclude brainglobe_benchmarks/results *
include asv.conf.json

recursive-exclude * __pycache__
recursive-exclude * *.py[co]

global-include *.pxd

prune benchmarks
prune docs
prune tests
prune resources
Expand Down
13 changes: 7 additions & 6 deletions asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

// The URL or local path of the source code repository for the
// project being benchmarked
"repo": ".",
// "repo": ".",
"repo": "https://github.com/brainglobe/brainglobe-workflows",

// The Python project's subdirectory in your repo. If missing or
// the empty string, the project is assumed to be located at the root
Expand Down Expand Up @@ -39,14 +40,14 @@

// List of branches to benchmark. If not provided, defaults to "master"
// (for git) or "default" (for mercurial).
"branches": ["main"], // for git
"branches": ["smg/tests-refactor"], // for git
// "branches": ["default"], // for mercurial

// The DVCS being used. If not set, it will be automatically
// determined from "repo" by looking at the protocol in the URL
// (if remote), or by looking for special directories, such as
// ".git" (if local).
// "dvcs": "git",
"dvcs": "git",

// The tool to use to create environments. May be "conda",
// "virtualenv", "mamba" (above 3.8)
Expand Down Expand Up @@ -146,19 +147,19 @@

// The directory (relative to the current directory) that benchmarks are
// stored in. If not provided, defaults to "benchmarks"
// "benchmark_dir": "benchmarks",
"benchmark_dir": "brainglobe_benchmarks",

// The directory (relative to the current directory) to cache the Python
// environments in. If not provided, defaults to "env"
"env_dir": ".asv/env",

// The directory (relative to the current directory) that raw benchmark
// results are stored in. If not provided, defaults to "results".
"results_dir": "benchmarks/results",
"results_dir": "brainglobe_benchmarks/results",

// The directory (relative to the current directory) that the html tree
// should be written to. If not provided, defaults to "html".
"html_dir": "benchmarks/html",
"html_dir": "brainglobe_benchmarks/html",

// The number of characters to retain in the commit hashes.
// "hash_length": 8,
Expand Down
File renamed without changes.
12 changes: 5 additions & 7 deletions benchmarks/cellfinder.py → brainglobe_benchmarks/cellfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
from cellfinder_core.main import main as cellfinder_run
from cellfinder_core.tools.IO import read_with_dask

from brainglobe_workflows.cellfinder.cellfinder_main import (
DEFAULT_JSON_CONFIG_PATH,
from brainglobe_workflows.cellfinder import (

Check warning on line 10 in brainglobe_benchmarks/cellfinder.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_benchmarks/cellfinder.py#L10

Added line #L10 was not covered by tests
CellfinderConfig,
run_workflow_from_cellfinder_run,
)
from brainglobe_workflows.cellfinder.cellfinder_main import (
setup as setup_cellfinder_workflow,
)
from brainglobe_workflows.cellfinder import setup as setup_cellfinder_workflow
from brainglobe_workflows.utils import DEFAULT_JSON_CONFIG_PATH_CELLFINDER

Check warning on line 15 in brainglobe_benchmarks/cellfinder.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_benchmarks/cellfinder.py#L14-L15

Added lines #L14 - L15 were not covered by tests


class TimeBenchmarkPrepGIN:
Expand Down Expand Up @@ -79,7 +77,7 @@
min_run_count = 2 # default:2

# Custom attributes
input_config_path = str(DEFAULT_JSON_CONFIG_PATH)
input_config_path = str(DEFAULT_JSON_CONFIG_PATH_CELLFINDER)

Check warning on line 80 in brainglobe_benchmarks/cellfinder.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_benchmarks/cellfinder.py#L80

Added line #L80 was not covered by tests

def setup_cache(
self,
Expand Down Expand Up @@ -114,7 +112,7 @@
known_hash=config.data_hash,
path=config.install_path,
progressbar=True,
processor=pooch.Unzip(extract_dir=config.extract_dir_relative),
processor=pooch.Unzip(extract_dir=config.data_dir_relative),
)

# Check paths to input data should now exist in config
Expand Down
Loading