David Sangrey
b5a4ee6ed2
[Nit] Cleanup some Flake8
2024-03-28 10:49:01 -04:00
David Sangrey
57cd75e75e
[2186] Additional Files
2024-03-27 19:39:51 -04:00
David Sangrey
b7633fa6e3
Handover a number of Lists to Tuples
...
Tuples are (slightly) more efficient for comparing if x in y. Not that it'll really matter at this scale, but it's technically better and simple to implement.
Applying to all files except theme.py, because theme.py is scary.
2023-12-27 00:29:35 -05:00
David Sangrey
473bd1cdf6
[2051] Replace More Old-Style Union/Opts
...
And re-adds the missing but deprecated abstracts in config
2023-11-16 13:21:54 -05:00
David Sangrey
28e10b70ef
[2051] Add Tests and gitignore File
2023-10-19 20:06:52 -04:00
A_D
50dd603520
tests/config: Disable mypy on _old_config.py
...
This file is just for regression testing and will never be typed
correctly, which is why we no longer use it :D
2022-12-23 17:53:58 +02:00
Athanasius
90183554ef
tests/journal_lock: Use proper pytest
types in fixtures
...
When I last typed this I couldn't find any official way to type `pytest`
fixtures. Perhaps that was before:
https://docs.pytest.org/en/6.2.x/changelog.html#improvements
which now makes it clean and simple.
2022-12-23 14:48:26 +00:00
Athanasius
25dfb0588a
tests/journal_lock: Minor typing fixes.
2022-12-23 14:47:14 +00:00
Athanasius
4041890f39
tests/config/_old_config.py: Minor typing fixes.
2022-12-23 14:47:11 +00:00
Athanasius
4db4165676
config/linux: Fix pre-commit run --all-files
-only issue
...
When run this way mypy thinks `config.linux` has no attribute `LinuxConfig`.
2022-12-23 14:47:04 +00:00
Athanasius
5885e6698c
tests/config: flake8 6.0.0 doesn't like var-name l
...
But it's fine with `s`.
2022-12-05 16:08:00 +00:00
Athanasius
41d7af54b4
tests/config: Update copy of 'OUT' constants to match 'live' values
...
It's actually just the NAMES that got changed as part of the EDDN rework, so
this would have made no difference to the tests. But now a grep won't find
any instance of the old names.
2022-12-01 11:46:29 +00:00
Athanasius
0aa74b8755
tests: journal: Change py
LocalPath type to be _pytest.tmpdir.TempPathFactory
...
This is more correct, and means we don't need the `py` module, which wasn't
in requirements-dev.txt, causing GitHub workflow `pytest` runs to fail.
2022-10-29 16:01:39 +01:00
Athanasius
5a0e31436b
tests: journal_lock: Works 100% on Linux, remove 'plan' docstring text
2022-09-07 12:27:35 +01:00
Athanasius
480b0712dd
tests: journal_lock: Close filehandle in test_obtain_lock_already_locked()
...
After the test completes as expected (ALREADY_LOCKED), ensure we close the
filehandle for that, else it seems to interfere with the sub-process
cleanup, which then leads to subsequent tests not being able to cleanup.
Tests as now working after 10s of runs of `pytest` in a loop.
2022-09-07 12:21:57 +01:00
Athanasius
77e7f71ee3
tests: journal_lock: Add, and use, _release_lock()
to fix TestJournalLock.test_release_lock
...
Because the `with ...` was leaving the file locked it then couldn't be
`os.unlink()`'d.
2022-09-07 12:03:50 +01:00
Athanasius
130bd619cf
tests: journal_lock: Cleanup properly in test_update_lock()
...
* As this involved two directories we also need to clean up the 'old' one.
2022-09-05 12:55:39 +01:00
Athanasius
725473e2db
tests: journal_lock: Finale factory change fixups & cleanup
...
* `test_release_lock()` needed `.getbasetemp()` on `mock_journaldir` usage.
* Add removal of lock file to `other_process_lock()`
2022-09-05 12:51:52 +01:00
Athanasius
34f1989b0b
tests: journal_lock: Use .getbasetemp() in test_obtain_lock_already_locked
2022-09-05 12:49:11 +01:00
Athanasius
fb0c139865
tests: journal_lock: Ensure all tests, that should, clean up
2022-09-05 12:44:13 +01:00
Athanasius
ddf6669f35
tests: journal_lock: fix test_obtain_lock_with_tmpdir_ro()
...
* Set `tmpdir` properly for this test.
* Do **NOT** unset `JournalLock.journal_dir_lockfile_name` on release, as
this is needed to remove the file
* Ensure prior test(s) release their locks, *and* remove the file.
2022-09-05 12:39:03 +01:00
Athanasius
27d93b5f31
tests: journal_lock: Need <factory>.getbasetemp() and str() as necessary
2022-09-05 12:17:54 +01:00
Athanasius
9915c5435d
tests: journal_lock: test_update_lock_same: Make .obtain.lock()
an assert
2022-09-05 11:51:12 +01:00
Athanasius
b47f278655
tests: journal_lock: Fix test_journal_lock_init test
...
* It's `tmp_path_factory` now, not `tmpdir_factory`.
* Need to `str(...)` if a string is what we want.
2022-09-05 11:49:05 +01:00
Athanasius
cc37b23db4
tests: journal_lock: Fix up pytest tmpdir types
2022-09-05 09:22:55 +01:00
Athanasius
3e0c69be5e
docs: Pass for config.py -> config/__init__.py and related changes
2022-01-31 15:41:25 +00:00
A_D
8c2a0ae95a
make tests not explode on windows
2022-01-26 20:37:10 +02:00
A_D
bff6175ee7
Update to use sys.platform over platform
2022-01-26 18:51:49 +02:00
A_D
88a7de6dd0
removed redundant test
2021-08-22 22:18:50 +02:00
A_D
1e71955375
added check_multiple method
2021-08-19 20:37:39 +02:00
A_D
710807f585
made precedence of operators a part of the API
2021-08-19 20:37:37 +02:00
A_D
532716e748
use range instead of silly checks
2021-08-19 20:37:36 +02:00
A_D
3133cba0a4
checked negatives, added test to that effect
2021-08-19 20:37:36 +02:00
A_D
3e297af79c
added killswitch tests
2021-08-19 20:37:34 +02:00
A_D
3da89e838f
finised deep_get tests
2021-08-19 20:37:33 +02:00
A_D
9255c4fa96
resolved edgecase with dotted keys
2021-08-19 20:37:33 +02:00
A_D
df200d2c22
quoting fixes
2021-08-19 20:37:32 +02:00
A_D
da8bb27b84
added deep get tests
2021-08-19 20:37:32 +02:00
A_D
5b96b9b118
tests for _apply complete
2021-08-19 20:37:32 +02:00
A_D
e7e210cc87
start on unit tests
2021-08-19 20:37:31 +02:00
A_D
bf4e89377b
Fixed line numbers for test
2021-06-04 14:40:53 +02:00
Athanasius
bf54af7211
Lint new EDMCLogging test
2021-05-10 15:34:49 +01:00
A_D
36ccead469
added test for classvar logging
2021-05-10 15:29:04 +02:00
A_D
3341800f71
Added missing save to test
2021-04-13 00:32:03 +02:00
Athanasius
b6dcc39fb2
JournalLock: No need to ' is True' on assert
2021-04-01 14:45:52 +01:00
Athanasius
0811a000ed
JournalLock: tests - Expand on comment about other_process_lock() section
2021-04-01 14:45:52 +01:00
Athanasius
d0617ba337
JournalLock: tests - minor docstring and formatting cleanups
2021-04-01 14:45:52 +01:00
Athanasius
f2fd16307c
JournalLock: Cleanup pytest coverage
...
* Some `# pragma: no cover' added where it's more pain to get coverage
than to put up with lack of testing.
We are choosing to NOT test retry_lock() or the call to it from
update_lock() as it's tkinter stuff.
* Check `self.journal_dir_lockfile` exists before trying to call
.close() on it.
* Note where platform checks means only one if branch gets run, so of
course coverage will complain about the other one.
* Add test_release_lock_lie_locked() to test when not locked, but
pretend we were so release_lock() returns False.
* Add test_update_lock_same() to check if an attempt is made to 'update'
to the same directory.
2021-04-01 14:45:52 +01:00
Athanasius
8bf5a43c5b
JournalLock: Add release_lock() test when not locked.
2021-04-01 14:45:52 +01:00
Athanasius
2fa3428581
JournalLock: Actually, just passing None
as the tk.Tk parent works.
...
In the PASSED case we never even make a JournalAlreadyLocked instance.
In the FAILED case let it blow up on the `None`.
2021-04-01 14:45:52 +01:00