1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-13 15:57:14 +03:00

2980 Commits

Author SHA1 Message Date
Athanasius
3f3a4f282e app version: Write a .gitversion file with short hash from setup.py 2021-04-01 14:45:52 +01:00
Athanasius
8b3294ecdd typeshed now handles tk 'name' parameter 2021-04-01 14:45:52 +01:00
Athanasius
f0c6b9efaa EDDN: Minor logging and format fixup to match 4.2.4 2021-04-01 14:45:52 +01:00
Athanasius
9a8daf665e EDDN: Restore 4.2.4 is_horizons() check in full 2021-04-01 14:45:52 +01:00
Athanasius
63be402cb4 EDDN: Restore safe_modules_and_ships() from 4.2.4 2021-04-01 14:45:52 +01: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
e0574e5584 Contributing.md: Minor pytest-related edits
* URL-ise some things.
* `` around some code.
2021-04-01 14:45:52 +01:00
Athanasius
7ad3518a7b config.py: Restor appversion to intended 5.0.0-beta1 for current develop. 2021-04-01 14:45:52 +01:00
Athanasius
e3d3e79b50 tests: Add .coveragerc (excludes tests/ and venv/)
Without these 'omit' settings pytest coverage reports on the tests
themselves, plus the venv files if present.
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
Athanasius
baca42f06e JournalLock: Fix update_lock() with an extra mock
* update_lock() wants to, potentially, invoke
  JournalLock.JournalAlreadyLocked() instance for a tkinter pop-up.
  We do *not* want to mock all of that, so monkeypatch a mock so that in
  the 'test PASSED' case this just works.
2021-04-01 14:45:52 +01:00
Athanasius
8c74d46368 JournalLock: Implement update_lock() test.
* This uses a separate mock_journaldir_changing() that returns a new
  tmpdir on each invocation of config.get_str('journaldir').
2021-04-01 14:45:52 +01:00
Athanasius
0c9b841e80 JournalLock: Test release_lock()
This re-factored other_process_lock() a little for DRY reasons.
2021-04-01 14:45:52 +01:00
Athanasius
cda6d344ae JournalLock: Tag sub-process locker prints for easy reading 2021-04-01 14:45:52 +01:00
Athanasius
1a1ad86840 JournalLock: Implement non-win32 sub-process lock 2021-04-01 14:45:52 +01:00
Athanasius
6d33ee0d8b JournalLock: Use multiprocessing for 'already locked' test.
Confirmed working on Windows.
2021-04-01 14:45:52 +01:00
Athanasius
6dbdd332be config.py: Silence flake8 complaint about no space at start of comment 2021-04-01 14:45:52 +01:00
Athanasius
0cae22e4a4 Contributing.md: Expand on unit test docs & set vim wordwrap.
* vim: modeline for 79 character line wrap
* Add some hints about running tests.
* Pointer to the pytest docs.
2021-04-01 14:45:52 +01:00
Athanasius
3a80d77997 Contributing.md: We use pytest and a particular file layout for tests. 2021-04-01 14:45:52 +01:00
Athanasius
e84af6ae7f Update: "TODO" tests comments 2021-04-01 14:45:52 +01:00
Athanasius
1fca5703c1 Add self.locked asserts as check on _obtain_lock() side effects 2021-04-01 14:45:52 +01:00
Athanasius
cfdf9fbf20 Re-factor JournalLock.obtain_lock() for 'ALREADY_LOCKED' test.
This splits the code for opening the lockfile away from that for
actually obtaining the lock.  It enables a test for trying to lock again
with the same file handle.
2021-04-01 14:45:52 +01:00
Athanasius
70bdc5e0e9 Read-Only obtain_lock() test commented and cleaned up.
* Comment added about what you'd see if you could check tmpdir
  properties whilst it's set !Write.
* Deleted all the testing print()s.
2021-04-01 14:45:52 +01:00
Athanasius
ec230a9c05 Make tmpdir non-writable for the read-only test
* On win32 this uses pywin32 package modules, so that's now in
  requirements-dev.txt.
* I *think* that code is as clean as it's going to be.  Windows is a
  pain with having you *append* a Deny ACL (rather than remove an Allow
  one), and then you have to find it in all the ACLs for the object in
  order to remove it by index.
* Linux version of this using `os.chmod()` currently untested.
2021-04-01 14:45:52 +01:00
Athanasius
fbad8e240f obtain_lock() Read-Only test
Only tested under win32 so far, but I'd hope os.chmod() is the way to go
on Linux and macOS.

The win32 implementation currently relies on the pywin32 package being
installed in order to use its ntsecuritycon and win32security modules.
It might be possible to do this with ctypes instead, but this sure looks
cleaner than most ctypes code I've seen.
2021-04-01 14:45:52 +01:00
Athanasius
80b99195eb Differentiate test docstrings. 2021-04-01 14:45:52 +01:00
Athanasius
12e5d26276 Add tests on JournalLock.set_path_from_journaldir() 2021-04-01 14:45:51 +01:00
Athanasius
7bd6e8ff58 Move test & fixture into a class.
This is for then adding more tests.
2021-04-01 14:45:51 +01:00
Athanasius
c344d612ad No need to str(tmpdir), as comparison works without now. 2021-04-01 14:45:51 +01:00
Athanasius
509a1f2c2e Rename mock_get_str() to mock_journaldir() 2021-04-01 14:45:51 +01:00
Athanasius
a325c62765 Generalise mock get_str() for re-use, and add asserts
* mock get_str() is now via a fixture so it can be re-used in more than
  one test, avoiding DRY issue.
* Some actual tests, in the form of asserts, added to
  test_journal_lock_init().
2021-04-01 14:45:51 +01:00
Athanasius
8612e772cf tests/journal_lock.py: Initial framework.
No actual test per se yet, but this runs with `pytest -k 'journal_lock'`
2021-04-01 14:45:51 +01:00
Athanasius
f53dcd92e5 Fix small typo in JournalLock.set_path_from_journaldir() docstring 2021-04-01 14:45:51 +01:00
Athanasius
c43343742a tests: Move the config.py related files into tests/config.py/
In general I think this will keep things neater:

1. Create a directory inside tests/ named after the file the tests are
   for.
2. Put all files for that test inside this new directory.
2021-04-01 14:45:51 +01:00
Athanasius
bfb7780efc Version to 4.2.0-beta1 to distinguish Python 3.8 builds
* I don't want to be checking something against 4.1.x releases when my
  last build was with Python 3.8.

# Conflicts:
#	config.py
2021-04-01 14:45:51 +01:00
Athanasius
5a38537294 docs: General update for main now using Python 3.9 & misc
* Extend EDCD copyright into 2021 here as well.
* Recommend *against* any attempt at making plugins also work with
  Python 2.7.
* setup.py no longer writes appcast files.  Mention
  edmarketconnector.xml enclosure instead for the url= bit.
* DRY about location of log files, just point to appropriate wiki link.
2021-04-01 14:45:51 +01:00
A_D
557e88bc44 removed extra check 2021-04-01 14:45:51 +01:00
A_D
b7c20facdd Fix spurious modules or ships was None
Nothing other than /shipyard actually returns the modules and ships
data, so checking for it anywhere other than that automatically is just
asking for extra log noise and nothing else.
2021-04-01 14:45:51 +01:00
Athanasius
99cbbf1cf8 Releasing.md: .pre-commit-config.yaml may need python version updating also. 2021-04-01 14:45:51 +01:00
Athanasius
bbb99eff2c Releasing.md: Update .python-version as needed. 2021-04-01 14:45:51 +01:00
Athanasius
a40091c36c Add .python-version file
At the very least `pyenv` uses this as a signal for the version of
Python that should be used.  See:

	<https://github.com/pyenv/pyenv#choosing-the-python-version>
2021-04-01 14:45:51 +01:00
Athanasius
c0bf09d974 setup.py: Fix whitespace before comments 2021-04-01 14:45:51 +01:00
Athanasius
8a3176c67d setup.py: Fix win32 OPTIONS formatting 2021-04-01 14:45:51 +01:00
Athanasius
732cfa1192 journal_lock: No need for exc_info=True on logger.exception() 2021-04-01 14:45:51 +01:00
Athanasius
bc33bf1b19 Attempt to get develop back to code state before rebase on main. 2021-04-01 14:45:51 +01:00
dependabot[bot]
7fc5144121 Bump isort from 5.7.0 to 5.8.0
Bumps [isort](https://github.com/pycqa/isort) from 5.7.0 to 5.8.0.
- [Release notes](https://github.com/pycqa/isort/releases)
- [Changelog](https://github.com/PyCQA/isort/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/pycqa/isort/compare/5.7.0...5.8.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-01 14:45:51 +01:00