Skip to content

testing.TestEnvironment not equal to itself #15225

@rickeylev

Description

@rickeylev

Description of the bug:

The testing.TestEnvironment object is a bit strange: it isn't equal to itself. In comparison, most provider keys are equal to themselves.

This makes it difficult to write code that can properly detect when the testing.TestEnvironment provider key was requested, e.g.

def get_provider(key):
  if key == testing.TestEnvironment: ...

(in my particular case, I'm writing helper code for tests to assert TestEnvironment)

Also, I'm not sure if this should be TestEnvironment or TestEnvironmentInfo -- the public symbol is testing.TestEnvironment, but the docs say it returns TestEnvironmentInfo (note no leading "testing" namespace and the extra Info suffix).

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

print(testing.TestEnvironment == testing.TestEnvironment)

actual: prints false

expected: prints true

Which operating system are you running Bazel on?

linux

What is the output of bazel info release?

google build

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

n/a

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

n/a

Have you found anything relevant by searching the web?

15224 is sort of related -- same category of "TestEnvironemt provider acts weird"

Any other information, logs, or outputs that you want to share?

No response

Metadata

Metadata

Assignees

Labels

P4This is either out of scope or we don't have bandwidth to review a PR. (No assignee)type: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions