Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test_find_sources when run under site-packages #10075

Merged
merged 3 commits into from
Feb 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion mypy/test/test_find_sources.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
from mypy.modulefinder import BuildSource
import os
import pytest
import shutil
import tempfile
import unittest
from typing import List, Optional, Set, Tuple

from mypy.find_sources import InvalidSourceList, SourceFinder, create_source_list
from mypy.fscache import FileSystemCache
from mypy.modulefinder import BuildSource
from mypy.options import Options
from mypy.modulefinder import BuildSource


class FakeFSCache(FileSystemCache):
Expand Down Expand Up @@ -60,6 +63,15 @@ def find_sources(


class SourceFinderSuite(unittest.TestCase):
def setUp(self) -> None:
self.tempdir = tempfile.mkdtemp()
self.oldcwd = os.getcwd()
os.chdir(self.tempdir)

def tearDown(self) -> None:
os.chdir(self.oldcwd)
shutil.rmtree(self.tempdir)

def test_crawl_no_namespace(self) -> None:
options = Options()
options.namespace_packages = False
Expand Down