@@ -89,7 +89,7 @@ def override_config(cov: Coverage, **kwargs: TConfigValueIn) -> Iterator[None]:
89
89
90
90
DEFAULT_DATAFILE = DefaultValue ("MISSING" )
91
91
_DEFAULT_DATAFILE = DEFAULT_DATAFILE # Just in case, for backwards compatibility
92
- CONFIG_FROM_ENVIRONMENT = ":envvar :"
92
+ CONFIG_DATA_PREFIX = ":data :"
93
93
94
94
class Coverage (TConfigurable ):
95
95
"""Programmatic access to coverage.py.
@@ -317,8 +317,8 @@ def __init__( # pylint: disable=too-many-arguments
317
317
self ._should_write_debug = True
318
318
319
319
# Build our configuration from a number of sources.
320
- if config_file == CONFIG_FROM_ENVIRONMENT :
321
- self .config = deserialize_config (cast ( str , os . getenv ( "COVERAGE_PROCESS_CONFIG" )) )
320
+ if isinstance ( config_file , str ) and config_file . startswith ( CONFIG_DATA_PREFIX ) :
321
+ self .config = deserialize_config (config_file [ len ( CONFIG_DATA_PREFIX ):] )
322
322
else :
323
323
if not isinstance (config_file , bool ):
324
324
config_file = os .fspath (config_file )
@@ -1426,7 +1426,7 @@ def process_startup() -> Coverage | None:
1426
1426
config_data = os .getenv ("COVERAGE_PROCESS_CONFIG" )
1427
1427
cps = os .getenv ("COVERAGE_PROCESS_START" )
1428
1428
if config_data is not None :
1429
- config_file = CONFIG_FROM_ENVIRONMENT
1429
+ config_file = CONFIG_DATA_PREFIX + config_data
1430
1430
elif cps is not None :
1431
1431
config_file = cps
1432
1432
else :
0 commit comments