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

Fixed and rearranged unit tests #184

Merged
merged 8 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 7 additions & 3 deletions .pipelines/azdo-base-pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
steps:
- script: |
./lint-and-test.sh
displayName: 'Linting & unit tests'
- script: |
flake8 --output-file=lint-testresults.xml --format junit-xml
displayName: 'Run lint tests'

- script: |
python -m pytest . --cov=diabetes_regression --cov-report=html --cov-report=xml --junitxml=unit-testresults.xml
displayName: 'Run unit tests'

- task: PublishTestResults@2
condition: succeededOrFailed()
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data_test.py → data/data_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_absPath(filename):
path = os.path.abspath(
os.path.join(
os.path.dirname(
__file__), os.path.pardir, os.path.pardir, "data", filename
__file__), os.path.pardir, "data", filename
)
)
return path
Expand Down
1 change: 0 additions & 1 deletion diabetes_regression/ci_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ dependencies:
- flake8==3.7.9
- flake8_formatter_junit_xml==0.0.6
- azure-cli==2.0.81
- tox==3.14.3
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ def test_train_model():
run = Mock(Run)
reg = train_model(run, data, alpha=1.2)

run.log.assert_called_with("mse", 0.029843893480257067,
description='Mean squared error metric')
_, call2 = run.log.call_args_list
nameValue, descriptionDict = call2
name, value = nameValue
description = descriptionDict['description']
assert (name == 'mse')
np.testing.assert_almost_equal(value, 0.029843893480257067)
assert (description == 'Mean squared error metric')

preds = reg.predict([[1], [2]])
np.testing.assert_equal(preds, [9.93939393939394, 9.03030303030303])
4 changes: 0 additions & 4 deletions docs/development_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,3 @@ BUILD_BUILDID is a variable used to uniquely identify the ML pipeline between th
set to the current build number. In a local environment, we can use a command such as
`uuidgen` so set a different random identifier on each run, ensuring there are
no collisions.

### Local testing

Before committing, run `tox` to execute linter and unit test checks.
4 changes: 0 additions & 4 deletions lint-and-test.sh

This file was deleted.

Empty file removed tests/unit/__init__.py
Empty file.
7 changes: 0 additions & 7 deletions tox.ini

This file was deleted.