(dotenv_file)
| 153 | |
| 154 | |
| 155 | def test_unset_no_value(dotenv_file): |
| 156 | logger = logging.getLogger("dotenv.main") |
| 157 | with open(dotenv_file, "w") as f: |
| 158 | f.write("foo") |
| 159 | |
| 160 | with mock.patch.object(logger, "warning") as mock_warning: |
| 161 | result = dotenv.unset_key(dotenv_file, "foo") |
| 162 | |
| 163 | assert result == (True, "foo") |
| 164 | with open(dotenv_file, "r") as f: |
| 165 | assert f.read() == "" |
| 166 | mock_warning.assert_not_called() |
| 167 | |
| 168 | |
| 169 | def test_unset_encoding(dotenv_file): |