| 110 | |
| 111 | |
| 112 | def test_environ() -> None: |
| 113 | environ = Environ() |
| 114 | |
| 115 | # We can mutate the environ at this point. |
| 116 | environ["TESTING"] = "True" |
| 117 | environ["GONE"] = "123" |
| 118 | del environ["GONE"] |
| 119 | |
| 120 | # We can read the environ. |
| 121 | assert environ["TESTING"] == "True" |
| 122 | assert "GONE" not in environ |
| 123 | |
| 124 | # We cannot mutate these keys now that we've read them. |
| 125 | with pytest.raises(EnvironError): |
| 126 | environ["TESTING"] = "False" |
| 127 | |
| 128 | with pytest.raises(EnvironError): |
| 129 | del environ["GONE"] |
| 130 | |
| 131 | # Test coverage of abstract methods for MutableMapping. |
| 132 | environ = Environ() |
| 133 | assert list(iter(environ)) == list(iter(os.environ)) |
| 134 | assert len(environ) == len(os.environ) |
| 135 | |
| 136 | |
| 137 | def test_config_with_env_prefix(tmpdir: Path, monkeypatch: pytest.MonkeyPatch) -> None: |