mirror of
https://github.com/Paillat-dev/pycord-reactive-views.git
synced 2026-01-02 17:14:56 +00:00
Initial commit
This commit is contained in:
30
tests/conftest.py
Normal file
30
tests/conftest.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# ---------------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See LICENSE in project root for information.
|
||||
# ---------------------------------------------------------------------------------
|
||||
"""
|
||||
This is a configuration file for pytest containing customizations and fixtures.
|
||||
|
||||
In VSCode, Code Coverage is recorded in config.xml. Delete this file to reset reporting.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List
|
||||
|
||||
import pytest
|
||||
from _pytest.nodes import Item
|
||||
|
||||
|
||||
def pytest_collection_modifyitems(items: list[Item]):
|
||||
for item in items:
|
||||
if "spark" in item.nodeid:
|
||||
item.add_marker(pytest.mark.spark)
|
||||
elif "_int_" in item.nodeid:
|
||||
item.add_marker(pytest.mark.integration)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def unit_test_mocks(monkeypatch: None):
|
||||
"""Include Mocks here to execute all commands offline and fast."""
|
||||
pass
|
||||
32
tests/test_methods.py
Normal file
32
tests/test_methods.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# ---------------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See LICENSE in project root for information.
|
||||
# ---------------------------------------------------------------------------------
|
||||
"""This is a sample python file for testing functions from the source code."""
|
||||
from __future__ import annotations
|
||||
|
||||
from python_package.hello_world import hello_world
|
||||
|
||||
|
||||
def hello_test():
|
||||
"""
|
||||
This defines the expected usage, which can then be used in various test cases.
|
||||
Pytest will not execute this code directly, since the function does not contain the suffex "test"
|
||||
"""
|
||||
hello_world()
|
||||
|
||||
|
||||
def test_hello(unit_test_mocks: None):
|
||||
"""
|
||||
This is a simple test, which can use a mock to override online functionality.
|
||||
unit_test_mocks: Fixture located in conftest.py, implictly imported via pytest.
|
||||
"""
|
||||
hello_test()
|
||||
|
||||
|
||||
def test_int_hello():
|
||||
"""
|
||||
This test is marked implicitly as an integration test because the name contains "_init_"
|
||||
https://docs.pytest.org/en/6.2.x/example/markers.html#automatically-adding-markers-based-on-test-names
|
||||
"""
|
||||
hello_test()
|
||||
Reference in New Issue
Block a user