Skip to content

(Test cross-imports) Don't cross-import test utils #182636

@justinmc

Description

@justinmc

Some test files import test utilities from other library's tests. This won't be possible once Material and Cupertino are moved to the flutter/packages repo.

For example:

import '../widgets/semantics_tester.dart';

Umbrella issue: #177028

What to do about it

  • Move the util to flutter_test if:
    • it's used in many places.
    • it has a solid API that has been in use for awhile and we are ready to commit to it.
    • it's of public-level quality.
  • Duplicate the util if:
    • its implementation is trivial, or it's just a constant, etc.
    • we are worried about its API needing changes and don't want to make it public.
  • Any other options? I don't think it will be possible to import it any other way.

The utils

Rendering:

Widgets:

Tests to fix:

Material importing Widgets

$ rg "import '\.\.\/widgets" packages/flutter/test/material -l

Cupertino importing Widgets

$ rg "import '\.\.\/widgets" packages/flutter/test/cupertino -l

Cupertino importing Rendering

$ rg "import '\.\.\/rendering" packages/flutter/test/cupertino -l

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work lista: tests"flutter test", flutter_test, or one of our testsf: cupertinoflutter/packages/flutter/cupertino repositoryf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done
    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions