Commit Graph

7 Commits

Author SHA1 Message Date
Dave Dalcino
d90f6c0487 Fix pytest warning about custom marker
Pytest complains that one of the custom markers we are using is not
registered. This fixes that
2022-07-30 18:18:29 -07:00
David Dalcino
d5213142a8 Fix misuse of disable_socket (#415)
In an earlier PR, I added calls to `disable_socket()` from
`pytest_socket` where I thought they were needed to prevent some tests
from accessing the network, in case they weren't monkeypatched properly.
Today, I discovered that `disable_socket()` disables sockets globally
for all tests, which means that the tests that use remote data cannot
run if they are executed after another test calls `disable_socket()`.

This change calls `disable_socket()` once from `conftest.py`, so that
no tests are allowed to use network data unless they are marked as ok
to use the network, with `@pytest.mark.enable_socket`. See example of
usage in `tests/test_connection.py`.

Changed return code for unexpected exceptions:

This allows us to write tests that can discover whether an unexpected
exception occurred just by checking the return code, rather than reading
stderr. This will allow us to write less friable tests that don't break
every time some insignificant output details change.

This change catches exceptions derived from Exception and
KeyboardInterrupt raised by `installer`, while run by multiple
processes, and propagates them back to earlier stack entries. This will
prevent any OSError and BrokenPipe exceptions that would otherwise be
raised when one process has an exception while the other processes are
still running.

This also handles the MemoryError exception we saw in #416, and offers
some suggestions for solving the issue.
2021-10-05 14:40:05 +09:00
Hiroshi Miura
fac014216f Use global instance to hold Settings instead of Borg (#272)
* Use global variable to hold Settings

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Settings global instance to hold configurations

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Revert to Settings class to helper module

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Revert Settings class variables

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* PEP8

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* CI: change actions to use macos-11

Signed-off-by: Hiroshi Miura <miurahr@linux.com>

* Revert "CI: change actions to use macos-11"

CI: macos-11 is just for private preview

This reverts commit f1d576f4bf.
2021-06-19 10:43:19 +09:00
Hiroshi Miura
741eb4989e PEP8/Black
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-05-24 08:27:07 +09:00
Hiroshi Miura
0cfeda838a PEP8/Black
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-05-23 12:12:52 +09:00
Hiroshi Miura
ca72e070c7 test: Early load custom configuration
hack for borg class

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2021-05-23 12:12:04 +09:00
Hiroshi Miura
b243b8b914 Add unit test
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
2019-11-18 09:43:34 +09:00