Skip to content

test: add coverage for WorkContext (context.py) #1075

@mnadzam

Description

@mnadzam

WorkContext in src/fromager/context.py is the central state object passed to virtually every function in the codebase. It has 67% unit test coverage with only 1 explicit test function (test_pip_constraints_args) which tests the pip_constraint_args property. The remaining public methods have no dedicated unit tests.

setup() is exercised indirectly through test fixtures (tmp_context, testdata_context) but has no dedicated test verifying its behavior. package_build_info() has ~39 callers making it the most widely used method.

Scope

Method Lines Callers
enable_parallel_builds() 98 1
wheels_build (property) 102 10
pip_wheel_server_args (property) 113 1
uv_clean_cache() 136 1
write_to_graph_to_file() 156 1
package_build_info() 160 43
setup() 169 1
clean_build_dirs() 189 2

Acceptance Criteria

  • setup() -- test directory creation and idempotency
  • package_build_info() -- test settings delegation with Requirement and string
  • enable_parallel_builds() + wheels_build -- test thread-specific path generation
  • write_to_graph_to_file() -- test file creation
  • pip_wheel_server_args -- test HTTPS and HTTP URL handling
  • uv_clean_cache() -- test empty args raises, test correct command and env
  • clean_build_dirs() -- test safety check, cleanup enabled, cleanup disabled

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions