Remove the 'if __name__ == "__main__": unittest.main()'. Indeed, the
module can't be run this way due to its imports. Tests from this module
can be run with:
cd scripts/python/TerraSync
python3 -m unittest tests.test_virtual_path
In Python, common usage is not to define accessors, but to directly use
class or instance attributes (especially when the associated data is
constant after instance creation). If it later happens that a given
attribute needs getter or setter logic, this can always be done via the
@property decorator, and doesn't affect calling code at all. See for
instance:
https://docs.python.org/3/library/functions.html#propertyhttps://mail.python.org/pipermail/tutor/2012-December/thread.html#92990
Apply this to the DirIndex class and rename the following attributes for
better readability: f -> files, d -> directories, t -> tarballs.
The tests can be run from directory 'scripts/python/TerraSync' using:
python3 -m unittest tests.test_dirindex
(or just 'python3 -m unittest' to run all tests pertaining to
terrasync.py).
python3 has a default implementation for __ne__ when __eq__ is defined. The opposite is not true -- having only __ne__ does not have a default __eq__ implementation.
Also note that there are cases when eq/ne will both be True or both False, therefore, developers are encouraged to explicitly define these methods in pairs.
- Use a range-based for loop instead of an iterator.
- Don't bother checking if the previously-visited directory was the
same: the potential saving that the previous code was hoping should be
null because FGGlobals::append_fg_scenery() doesn't add a path to
FGGlobals::fg_scenery if it's already there---this assumes that all
paths added to FGGlobals::fg_scenery go through
FGGlobals::append_fg_scenery(), of course.
This should have no effect on FG's behavior.
If a menu-bar item is missing a <name>, we can end up building a string
from nullptr, which is a SEGV.
Reported as Sentry issue FLIGHTGEAR-1D
Will back-port to LTS once verified.
Capture the current behaviour of Increment/DecrementWaypoint in
AI flightplans, prior to making some simplifications. Especially try
to test the behaviour of the ‘increment and erase’ logic.
Use the ‘file name copying’ version of log(), to avoid an ASan use-
after-free. Note this requires SG change
908496d43dd7c3a7ca1de42b0e0c21aa0498c7df
to work correctly.
When there are installed the same aircrafts from different sources
(fgdata + fgaddon + git) with identical descriptions, use the URI to
provide stable sorting.
Our copy of libGSM, and a system-wide version have different include
suffixes, so adjust the FindGsm.cmake so that the returned include-path
is consistent with our internal version.
See discussion in:https://sourceforge.net/p/flightgear/codetickets/2368/