Skip to content

Commit

Permalink
Merge pull request #177 from zenml-io/alex/refactor-tests-not-raising
Browse files Browse the repository at this point in the history
Refactor tests not raising
  • Loading branch information
alex-zenml authored Nov 18, 2021
2 parents 29520e3 + 5e50608 commit 314300e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 6 additions & 3 deletions tests/core/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# TODO: [MEDIUM] add basic CRUD tests back in

import os
from contextlib import ExitStack as does_not_raise
from pathlib import Path

import pytest
Expand Down Expand Up @@ -52,9 +53,11 @@ def test_initializing_repository_from_root_sets_cwd_as_repo_path() -> None:
def test_initializing_repository_without_git_repo_does_not_raise_error(
tmp_path: str,
) -> None:
"""Check initializing repository without git repository does not raise error"""
repo = Repository(str(tmp_path))
assert repo.git_wrapper is None
"""Check initializing repository without git repository does not raise
error"""
with does_not_raise():
repo = Repository(str(tmp_path))
assert repo.git_wrapper is None


def test_initializing_repo_with_git_repo_present_sets_git_wrapper(
Expand Down
5 changes: 2 additions & 3 deletions tests/utils/test_analytics_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@
# permissions and limitations under the License.

import platform
from contextlib import ExitStack as does_not_raise

from zenml.constants import VALID_OPERATING_SYSTEMS
from zenml.utils.analytics_utils import get_segment_key, get_system_info


def test_get_segment_key():
"""Checks the get_segment_key method returns a value"""
try:
with does_not_raise():
get_segment_key()
except Exception as e:
assert False, f"Exception raised: {e}"


def test_get_system_info_type():
Expand Down

0 comments on commit 314300e

Please sign in to comment.