{ "cells": [ { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "# Usage" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To use `micromagnetictests`, in the specific calculator package, inside the tests directory import the tests you want to use. For instance:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from micromagnetictests.calculatortests import TestDMI, TestExchange" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "On the other hand, all tests can be imported as:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from micromagnetictests.calculatortests import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "After this, create `conftest.py` file, where a fixture for a calculator is set. For instance:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "# The content of this should be in conftest.py\n", "\n", "import pytest\n", "\n", "# Here import your calculator\n", "\n", "\n", "@pytest.fixture(scope=\"module\")\n", "def calculator():\n", " pass\n", " # return imported calculator" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": {}, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 4 }