-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
77 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# (C) Datadog, Inc. 2018 | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) | ||
import sys | ||
|
||
from .tooling.cli import ddev | ||
|
||
|
||
sys.exit(ddev()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
datadog_checks_dev/datadog_checks/dev/tooling/templates/check/{check_name}/tests/conftest.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
# (C) Datadog, Inc. {year} | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) | ||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def instance(): | ||
return {{}} |
8 changes: 8 additions & 0 deletions
8
...ks_dev/datadog_checks/dev/tooling/templates/check/{check_name}/tests/test_{check_name}.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
# (C) Datadog, Inc. {year} | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) | ||
from datadog_checks.{check_name} import {check_class} | ||
|
||
|
||
def test_check(aggregator, instance): | ||
check = {check_class}('{check_name}', {{}}, {{}}) | ||
check.check(instance) | ||
|
||
aggregator.assert_all_metrics_covered() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# (C) Datadog, Inc. 2018 | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) | ||
import os | ||
import sys | ||
|
||
from datadog_checks.dev.subprocess import run_command | ||
from datadog_checks.dev.utils import chdir, remove_path | ||
|
||
|
||
HERE = os.path.dirname(os.path.abspath(__file__)) | ||
CORE_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(HERE))) | ||
|
||
|
||
def test_new_check_test(): | ||
check_path = os.path.join(CORE_ROOT, 'my_check') | ||
|
||
try: | ||
run_command( | ||
[sys.executable, '-m', 'datadog_checks.dev', 'create', '-q', '-l', CORE_ROOT, 'my-check'], | ||
capture=True, | ||
check=True | ||
) | ||
run_command( | ||
[sys.executable, '-m', 'pip', 'install', check_path], | ||
capture=True, | ||
check=True | ||
) | ||
with chdir(check_path): | ||
run_command([sys.executable, '-m', 'pytest'], capture=True, check=True) | ||
finally: | ||
remove_path(check_path) |