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

Remove TestBase.context() #10248

Merged
merged 1 commit into from Jul 3, 2020
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions src/python/pants/engine/internals/scheduler_test_base.py
Expand Up @@ -79,9 +79,6 @@ def mk_scheduler(
build_id="buildid_for_test", should_report_workunits=should_report_workunits,
)

def context_with_scheduler(self, scheduler, *args, **kwargs):
return self.context(*args, scheduler=scheduler, **kwargs)

def execute(self, scheduler, product, *subjects):
"""Runs an ExecutionRequest for the given product and subjects, and returns the result
value."""
Expand Down
58 changes: 20 additions & 38 deletions src/python/pants/source/source_root_test.py
Expand Up @@ -188,27 +188,21 @@ def test_all_roots(self):
"fixed/root/jvm",
)

options = {
"pants_ignore": [],
"root_patterns": [
source_root_config = create_subsystem(
SourceRootConfig,
root_patterns=[
"src/*",
"src/example/*",
"contrib/go/examples/src/go/src",
# Dir does not exist, should not be listed as a root.
"java",
"fixed/root/jvm",
],
}
options.update(self.options[""]) # We need inherited values for pants_workdir etc.

self.context(
for_subsystems=[SourceRootConfig], options={SourceRootConfig.options_scope: options}
marker_filenames=[],
)

source_root_config = SourceRootConfig.global_instance()

# This function mocks out reading real directories off the file system.
def provider_rule(path_globs: PathGlobs) -> Snapshot:
def provider_rule(_: PathGlobs) -> Snapshot:
return Snapshot(Digest("abcdef", 10), (), dirs)

def source_root_mock_rule(req: SourceRootRequest) -> OptionalSourceRoot:
Expand All @@ -230,36 +224,25 @@ def source_root_mock_rule(req: SourceRootRequest) -> OptionalSourceRoot:
],
)

self.assertEqual(
{
SourceRoot("contrib/go/examples/src/go/src"),
SourceRoot("src/java"),
SourceRoot("src/python"),
SourceRoot("src/python/subdir/src/python"),
SourceRoot("src/kotlin"),
SourceRoot("src/example/java"),
SourceRoot("src/example/python"),
SourceRoot("my/project/src/java"),
SourceRoot("fixed/root/jvm"),
},
set(output),
)
assert {
SourceRoot("contrib/go/examples/src/go/src"),
SourceRoot("src/java"),
SourceRoot("src/python"),
SourceRoot("src/python/subdir/src/python"),
SourceRoot("src/kotlin"),
SourceRoot("src/example/java"),
SourceRoot("src/example/python"),
SourceRoot("my/project/src/java"),
SourceRoot("fixed/root/jvm"),
} == set(output)

def test_all_roots_with_root_at_buildroot(self):
options = {
"pants_ignore": [],
"root_patterns": ["/"],
}
options.update(self.options[""]) # We need inherited values for pants_workdir etc.

self.context(
for_subsystems=[SourceRootConfig], options={SourceRootConfig.options_scope: options}
source_root_config = create_subsystem(
SourceRootConfig, root_patterns=["/"], marker_filenames=[],
)

source_root_config = SourceRootConfig.global_instance()

# This function mocks out reading real directories off the file system
def provider_rule(path_globs: PathGlobs) -> Snapshot:
def provider_rule(_: PathGlobs) -> Snapshot:
dirs = ("foo",) # A python package at the buildroot.
return Snapshot(Digest("abcdef", 10), (), dirs)

Expand All @@ -275,5 +258,4 @@ def provider_rule(path_globs: PathGlobs) -> Snapshot:
),
],
)

self.assertEqual({SourceRoot(".")}, set(output))
assert {SourceRoot(".")} == set(output)
218 changes: 0 additions & 218 deletions src/python/pants/source/test_wrapped_globs.py

This file was deleted.

2 changes: 0 additions & 2 deletions src/python/pants/testutil/BUILD
Expand Up @@ -6,7 +6,6 @@ python_library(
dependencies=[
':int-test-for-export',
':test_base',
'src/python/pants/testutil/base:context_utils',
'src/python/pants/testutil/engine',
'src/python/pants/testutil/option',
'src/python/pants/testutil/subsystem',
Expand Down Expand Up @@ -75,7 +74,6 @@ python_library(
'src/python/pants/source',
'src/python/pants/subsystem',
'src/python/pants/task',
'src/python/pants/testutil/base:context_utils',
'src/python/pants/testutil/engine',
'src/python/pants/testutil/option',
'src/python/pants/testutil/subsystem',
Expand Down
14 changes: 0 additions & 14 deletions src/python/pants/testutil/base/BUILD

This file was deleted.

Empty file.