Skip to content

Commit

Permalink
Split tests into unit/integration/functional
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Nov 9, 2023
1 parent 4ccd3c6 commit 6a7015c
Show file tree
Hide file tree
Showing 94 changed files with 39 additions and 42 deletions.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from .utils import formats_with_support_for_cell_metadata

# Pytest's tmpdir is in /tmp (at least for me), so this helps avoiding interferences between
# Pytest's tmpdir is in /tmp (at least for me), so this helps to avoid interferences between
# global configuration on HOME and the test collection
jupytext.config.JUPYTEXT_CEILING_DIRECTORIES = ["/tmp/"]

Expand Down
Empty file added tests/functional/__init__.py
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion tests/test_black.py → tests/functional/cli/test_black.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from jupytext.compare import compare, compare_cells, compare_notebooks
from jupytext.header import _DEFAULT_NOTEBOOK_METADATA

from .utils import list_notebooks, requires_autopep8, requires_black, requires_flake8
from ...utils import list_notebooks, requires_autopep8, requires_black, requires_flake8


@requires_black
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py → tests/functional/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from jupytext.formats import JupytextFormatError, long_form_one_format
from jupytext.paired_paths import InconsistentPath, paired_paths

from .utils import (
from ...utils import (
list_notebooks,
requires_jupytext_installed,
requires_myst,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from jupytext import write
from jupytext.cli import jupytext

from .utils import requires_black
from ...utils import requires_black


@pytest.fixture
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from jupytext.cli import jupytext
from jupytext.version import __version__

from .utils import (
from ...utils import (
requires_ir_kernel,
requires_nbconvert,
requires_user_kernel_python3,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_isort.py → tests/functional/cli/test_isort.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from jupytext.cli import pipe_notebook
from jupytext.compare import compare

from .utils import requires_isort
from ...utils import requires_isort


@requires_isort
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
import jupytext
from jupytext import TextFileContentsManager
from jupytext.compare import compare_cells

from .utils import notebook_model
from tests.utils import notebook_model

SAMPLE_NOTEBOOK = new_notebook(
cells=[new_markdown_cell("A Markdown cell"), new_code_cell("# A code cell\n1 + 1")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from jupytext.jupytext import read, write, writes
from jupytext.kernels import kernelspec_from_language

from .utils import (
from ...utils import (
list_notebooks,
notebook_model,
requires_pandoc,
Expand Down
File renamed without changes.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_replace_issue_numbers_with_links(input, output):
sys.version_info < (3, 5), reason="'PosixPath' object has no attribute 'read_text'"
)
def test_update_changelog():
changelog_file = Path(__file__).parent.parent / "CHANGELOG.md"
changelog_file = Path(__file__).parent.parent.parent.parent / "CHANGELOG.md"
cur_text = changelog_file.read_text()
new_text = replace_issue_number_with_links(cur_text)
if cur_text != new_text:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def documentation_files():
for path in (Path(__file__).parent.parent / "docs").iterdir():
for path in (Path(__file__).parent / "../../../docs").iterdir():
if path.suffix == ".md":
yield path

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import jupytext
from jupytext.cli import jupytext as jupytext_cli

from .utils import requires_black, requires_myst, requires_user_kernel_python3
from ...utils import requires_black, requires_myst, requires_user_kernel_python3

doc_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "docs")
doc_path = os.path.join(os.path.dirname(__file__), "..", "..", "..", "docs")


@requires_user_kernel_python3
Expand Down
Empty file added tests/integration/__init__.py
Empty file.
Empty file.
File renamed without changes.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from jupytext.compare import compare, compare_notebooks
from jupytext.metadata_filter import filter_metadata, metadata_filter_as_dict

from .utils import requires_myst
from ...utils import requires_myst


def to_dict(keys):
Expand Down
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from jupytext import read, reads, writes
from jupytext.formats import JupytextFormatError, auto_ext_from_metadata

from .utils import list_notebooks
from ...utils import list_notebooks


@pytest.mark.parametrize(
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from nbformat.v4.nbbase import new_code_cell, new_markdown_cell

from jupytext import reads, writes

from .utils import formats_with_support_for_cell_metadata, is_myst_available
from tests.utils import formats_with_support_for_cell_metadata, is_myst_available


@pytest.fixture()
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import jupytext
from jupytext.combine import combine_inputs_with_outputs
from jupytext.compare import compare, compare_notebooks

from .utils import list_notebooks
from tests.utils import list_notebooks


def test_combine():
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from jupytext import TextFileContentsManager, read
from jupytext.cli import jupytext as jupytext_cli

from .utils import skip_on_windows
from ...utils import skip_on_windows


@pytest.fixture
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import jupytext

from .utils import list_notebooks
from ...utils import list_notebooks


@pytest.mark.skipif(nbformat.__version__ <= "5.7", reason="normalize is not available")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from jupytext.compare import compare_notebooks
from jupytext.contentsmanager import TextFileContentsManager

from .utils import list_notebooks, notebook_model
from ...utils import list_notebooks, notebook_model


@pytest.mark.parametrize("nb_file", list_notebooks(skip="66"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from jupytext.compare import compare_notebooks
from jupytext.contentsmanager import TextFileContentsManager

from .utils import list_notebooks, requires_myst
from ...utils import list_notebooks, requires_myst


@pytest.mark.parametrize("nb_file", list_notebooks("python"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import jupytext
from jupytext.compare import compare

from .utils import list_notebooks
from ...utils import list_notebooks


@pytest.mark.parametrize("nb_file", list_notebooks() + list_notebooks("Rmd"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from jupytext.compare import compare
from jupytext.formats import long_form_one_format

from .utils import list_notebooks
from ...utils import list_notebooks


@pytest.mark.parametrize(
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import jupytext
from jupytext.header import header_to_metadata_and_cell

from .utils import list_notebooks, requires_nbconvert
from ...utils import list_notebooks, requires_nbconvert


@requires_nbconvert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from jupytext.languages import _SCRIPT_EXTENSIONS
from jupytext.paired_paths import full_path

from .utils import (
from ...utils import (
list_notebooks,
requires_myst,
requires_pandoc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import jupytext
from jupytext.compare import compare

from .utils import list_notebooks
from ...utils import list_notebooks


@pytest.mark.parametrize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import jupytext
from jupytext.compare import compare

from .utils import list_notebooks
from ...utils import list_notebooks


@pytest.mark.parametrize("nb_file", list_notebooks("Rmd"))
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import jupytext
from jupytext.compare import compare_notebooks

from .utils import list_notebooks
from ...utils import list_notebooks


@pytest.mark.parametrize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
myst_to_notebook,
)

from .utils import requires_myst, requires_no_myst
from ...utils import requires_myst, requires_no_myst


@requires_myst
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import jupytext
from jupytext.compare import compare_notebooks

from .utils import list_notebooks
from ...utils import list_notebooks


@pytest.mark.parametrize("nb_file", list_notebooks("ipynb_py"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import jupytext
from jupytext.compare import compare_notebooks

from .utils import list_notebooks
from ...utils import list_notebooks


@pytest.mark.parametrize("nb_file", list_notebooks(skip="66"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import jupytext

from .utils import list_notebooks
from ...utils import list_notebooks


@pytest.mark.parametrize("r_file", list_notebooks("R_spin"))
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from jupytext.formats import NOTEBOOK_EXTENSIONS
from jupytext.myst import myst_extensions

from .utils import is_myst_available, is_quarto_available
from ...utils import is_myst_available, is_quarto_available


@pytest.mark.parametrize("ext", sorted(set(NOTEBOOK_EXTENSIONS) - {".ipynb"}))
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from jupytext.compare import compare, compare_notebooks
from jupytext.pandoc import PandocError

from .utils import requires_no_pandoc, requires_pandoc
from ...utils import requires_no_pandoc, requires_pandoc


@requires_pandoc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import jupytext
from jupytext.compare import compare, compare_notebooks

from .utils import notebook_model
from ...utils import notebook_model


def test_read_simple_file(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import jupytext
from jupytext.compare import compare, compare_notebooks

from .utils import requires_quarto
from ...utils import requires_quarto


@requires_quarto
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added tests/unit/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
unesc,
)

from .utils import notebook_model
from ..utils import notebook_model


def test_unesc():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_formats.py → tests/unit/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
validate_one_format,
)

from .utils import list_notebooks, requires_myst, requires_pandoc
from ..utils import list_notebooks, requires_myst, requires_pandoc


@pytest.mark.parametrize("nb_file", list_notebooks("python"))
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from jupytext.cell_to_text import three_backticks_or_more
from jupytext.compare import compare, compare_notebooks

from .utils import requires_myst
from ..utils import requires_myst


def test_three_backticks_or_more():
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/test_pep8.py → tests/unit/test_pep8.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
pep8_lines_between_cells,
)

from .utils import list_notebooks
from ..utils import list_notebooks


def test_next_instruction_is_function_or_class():
Expand Down
File renamed without changes.

0 comments on commit 6a7015c

Please sign in to comment.