Skip to content

Commit 9ba200a

Browse files
Merge pull request #37 from cthoyt/improve-testing
Improve testing
2 parents e653ff1 + d16e7dd commit 9ba200a

File tree

4 files changed

+28
-15
lines changed

4 files changed

+28
-15
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,11 @@ We are motivated to constantly make RexMex even better.
175175
RexMex can be installed with the following command after the repo is cloned.
176176

177177
```sh
178-
$ python setup.py install
178+
$ pip install .
179179
```
180180

181+
Use `-e/--editable` when developing.
182+
181183
**Installation via pip**
182184

183185
RexMex can be installed with the following pip command.
@@ -196,21 +198,23 @@ $ pip install rexmex --upgrade
196198

197199
**Running tests**
198200

201+
Tests can be run with `tox` with the following:
202+
199203
```sh
200-
$ pytest ./tests/unit -cov rexmex/
201-
$ pytest ./tests/integration -cov rexmex/
204+
$ pip install tox
205+
$ tox -e py
202206
```
203207

204208
--------------------------------------------------------------------------------
205209

206210
**Citation**
207211

208-
If you use RexMex in a scientific publication, we would appreciate citations. Please see GitHubs built in citation tool.
212+
If you use RexMex in a scientific publication, we would appreciate citations. Please see GitHub's built-in citation tool.
209213

210214

211215

212216
--------------------------------------------------------------------------------
213217

214218
**License**
215219

216-
- [Apache-2.0 License](https://github.com/AZ-AI/rexmex/blob/master/LICENSE)
220+
- [Apache-2.0 License](https://github.com/AZ-AI/rexmex/blob/master/LICENSE)

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
setup_requires = ["pytest-runner"]
77

88

9-
tests_require = ["pytest", "pytest-cov", "mock", "unittest"]
9+
tests_require = ["pytest", "pytest-cov"]
1010

11+
extras_require = {"test": tests_require}
1112

1213
keywords = [
1314
"recommender",
@@ -37,6 +38,7 @@
3738
install_requires=install_requires,
3839
setup_requires=setup_requires,
3940
tests_require=tests_require,
41+
extras_require=extras_require,
4042
classifiers=[
4143
"Development Status :: 3 - Alpha",
4244
"Intended Audience :: Developers",

tests/integration/test_aggregation.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,37 @@ def test_classification(self):
1515
score_card = ScoreCard(metric_set)
1616

1717
performance_metrics = score_card.generate_report(self.scores)
18-
assert performance_metrics.shape == (1, 11)
18+
assert performance_metrics.shape == (1, len(metric_set))
1919

2020
performance_metrics = score_card.generate_report(self.scores, grouping=["source_group"])
21-
assert performance_metrics.shape == (5, 11)
21+
assert performance_metrics.shape == (5, len(metric_set))
2222

2323
performance_metrics = score_card.generate_report(self.scores, grouping=["source_group", "target_group"])
24-
assert performance_metrics.shape == (20, 11)
24+
assert performance_metrics.shape == (20, len(metric_set))
2525

2626
def test_regression(self):
2727
metric_set = RatingMetricSet()
2828
metric_set.normalize_metrics()
2929
score_card = ScoreCard(metric_set)
3030

3131
performance_metrics = score_card.generate_report(self.scores)
32-
assert performance_metrics.shape == (1, 7)
32+
assert performance_metrics.shape == (1, len(metric_set))
3333

3434
performance_metrics = score_card.generate_report(self.scores, grouping=["source_group"])
35-
assert performance_metrics.shape == (5, 7)
35+
assert performance_metrics.shape == (5, len(metric_set))
3636

3737
performance_metrics = score_card.generate_report(self.scores, grouping=["source_group", "target_group"])
38-
assert performance_metrics.shape == (20, 7)
38+
assert performance_metrics.shape == (20, len(metric_set))
3939

4040
def test_addition(self):
4141
metric_set = RatingMetricSet() + ClassificationMetricSet()
4242
score_card = ScoreCard(metric_set)
4343

4444
performance_metrics = score_card.generate_report(self.scores)
45-
assert performance_metrics.shape == (1, 18)
45+
assert performance_metrics.shape == (1, len(metric_set))
4646

4747
performance_metrics = score_card.generate_report(self.scores, grouping=["source_group"])
48-
assert performance_metrics.shape == (5, 18)
48+
assert performance_metrics.shape == (5, len(metric_set))
4949

5050
performance_metrics = score_card.generate_report(self.scores, grouping=["source_group", "target_group"])
51-
assert performance_metrics.shape == (20, 18)
51+
assert performance_metrics.shape == (20, len(metric_set))

tox.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ envlist =
88
lint
99
flake8
1010
mypy
11+
py
12+
13+
[testenv:py]
14+
commands =
15+
pytest --cov rexmex
16+
extras =
17+
test
1118

1219
[testenv:lint]
1320
deps =

0 commit comments

Comments
 (0)