Skip to content

Commit

Permalink
Decouple modelTest from SourceCodeApi
Browse files Browse the repository at this point in the history
Summary:
When I moved all Pysa access to Pyre environments into
PyrePysaEnvironment I punted on a few tests, but we really should
clean those up.

This one was accessing a TypeEnvironment and a SourceCodeApi, both of
which are implementation details of Pyre and shouldn't be leaked. We
already have a `source_of_qualifier` helper in the pyre pysa environment,
so let's use it.

The test code actually gets simpler as a bonus.

Reviewed By: rchen152

Differential Revision: D63547514

fbshipit-source-id: 0cd12bee1918b44c223624543851c1fae9c8a59e
  • Loading branch information
stroxler authored and facebook-github-bot committed Sep 28, 2024
1 parent 818b2d7 commit 48bfb0a
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions source/interprocedural_analyses/taint/test/modelTest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ module PyrePysaEnvironment = Analysis.PyrePysaEnvironment

let get_stubs_and_definitions ~source_file_name ~project =
let pyre_api = Test.ScratchProject.pyre_pysa_read_only_api project in
let type_environment = Test.ScratchProject.type_environment project in
let source_code_api =
Analysis.TypeEnvironment.ReadOnly.get_untracked_source_code_api type_environment
in
let qualifier = Ast.Reference.create (String.chop_suffix_exn source_file_name ~suffix:".py") in
let ast_source =
Analysis.SourceCodeApi.source_of_qualifier source_code_api qualifier
PyrePysaEnvironment.ReadOnly.source_of_qualifier pyre_api qualifier
|> fun option -> Option.value_exn option
in
let initial_callables =
Expand Down

0 comments on commit 48bfb0a

Please sign in to comment.