Skip to content

Commit

Permalink
Merge pull request #691 from pypa/core-tests-not-installed
Browse files Browse the repository at this point in the history
Move flit_core tests out of installable package
  • Loading branch information
takluyver authored Oct 18, 2024
2 parents 9b1ef13 + d8bff6c commit adead86
Show file tree
Hide file tree
Showing 73 changed files with 11 additions and 6 deletions.
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.
File renamed without changes.
13 changes: 9 additions & 4 deletions tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pathlib
import sys
import tempfile
from unittest import TestCase, SkipTest
from unittest import TestCase, SkipTest, skipIf
from unittest.mock import patch

import pytest
Expand All @@ -13,10 +13,10 @@

from flit import install
from flit.install import Installer, _requires_dist_to_pip_requirement, DependencyError
import flit_core.tests

samples_dir = pathlib.Path(__file__).parent / 'samples'
core_samples_dir = pathlib.Path(flit_core.tests.__file__).parent / 'samples'
tests_dir = pathlib.Path(__file__).parent
samples_dir = tests_dir / 'samples'
core_samples_dir = tests_dir.parent / 'flit_core' / 'tests_core' / 'samples'

class InstallTests(TestCase):
def setUp(self):
Expand Down Expand Up @@ -56,6 +56,7 @@ def test_install_module(self):
samples_dir / 'module1_toml', 'module1', '0.1', expected_editable=False
)

@skipIf(not core_samples_dir.is_dir(), "Missing flit_core samples")
def test_install_module_pep621(self):
Installer.from_ini_path(
core_samples_dir / 'pep621_nodynamic' / 'pyproject.toml',
Expand Down Expand Up @@ -154,6 +155,7 @@ def test_symlink_package(self):
samples_dir / 'package1', 'package1', '0.1', expected_editable=True
)

@skipIf(not core_samples_dir.is_dir(), "Missing flit_core samples")
def test_symlink_module_pep621(self):
if os.name == 'nt':
raise SkipTest("symlink")
Expand Down Expand Up @@ -278,6 +280,7 @@ def test_install_requires(self):
assert len(calls) == 1
assert calls[0]['argv'][1:5] == ['-m', 'pip', 'install', '-r']

@skipIf(not core_samples_dir.is_dir(), "Missing flit_core samples")
def test_install_reqs_my_python_if_needed_pep621(self):
ins = Installer.from_ini_path(
core_samples_dir / 'pep621_nodynamic' / 'pyproject.toml',
Expand All @@ -292,13 +295,15 @@ def test_extras_error(self):
Installer.from_ini_path(samples_dir / 'requires-requests.toml',
user=False, deps='none', extras='dev')

@skipIf(not core_samples_dir.is_dir(), "Missing flit_core samples")
def test_install_data_dir(self):
Installer.from_ini_path(
core_samples_dir / 'with_data_dir' / 'pyproject.toml',
).install_directly()
assert_isfile(self.tmpdir / 'site-packages' / 'module1.py')
assert_isfile(self.tmpdir / 'data' / 'share' / 'man' / 'man1' / 'foo.1')

@skipIf(not core_samples_dir.is_dir(), "Missing flit_core samples")
def test_symlink_data_dir(self):
if os.name == 'nt':
raise SkipTest("symlink")
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ commands =
# Python 3.6: only test flit_core
[testenv:py36]
commands =
python -m pytest --cov=flit_core/flit_core --pyargs flit_core
python -m pytest --cov=flit_core/flit_core flit_core

# Python 3.7: only test flit_core
[testenv:py37]
commands =
python -m pytest --cov=flit_core/flit_core --pyargs flit_core
python -m pytest --cov=flit_core/flit_core flit_core

[testenv:bootstrap]
skip_install = true
Expand Down

0 comments on commit adead86

Please sign in to comment.