Timeline
Jun 30, 2019:
- 9:08 PM Changeset [1827:ae7c58902489] by
- Remove unused mock session classes These classes were needed when the tests in `test_file.py` and `test_with_statement.py` still used the old mock session support in `mock_ftplib.py`.
- 9:06 PM Changeset [1826:72c0f9a06e12] by
- Use `ScriptedSession` in `TestAvailableChild`
- 8:41 PM Changeset [1825:eeddeb17229c] by
- Use `ScriptedSession` in `TestFileOperations`
- 5:41 PM Changeset [1824:f35237913b7d] by
- Add XXX comment on text file creation
- 4:40 PM Changeset [1823:d8f5fdc5815b] by
- Add TODO comment on future test revision Add TODO comment on future test revision for binary/text modes.
- 4:15 PM Changeset [1822:588dd642fb25] by
- Create `sock` per instance, not per class The mock socket object is used to verify in tests whether the socket's `gettimeout` and `settimeout` methods are called. Defining the mock object at the class level causes all `ScriptedSession` objects to share the mock. Therefore, if multiple tests call `sock.gettimeout` or `sock.settimeout` they interfere with each other. I noticed the problem when running `test_host.py` alone with `pytest test/test_host.py` succeeded, but running all fast tests with `make test` failed in `test.test_host.TestUploadAndDownload.test_download` because of a test on the `sock` attribute.
Jun 18, 2019:
- 10:46 PM Changeset [1821:969e915c85d7] by
- Simplify `Call` creations - Remove arguments which are `None` (mostly `result`s). `None` is the default for this argument. - Put argument `args` before `result`. This is more natural because we must pass arguments into a function/method before we get a result.
- 10:34 PM Changeset [1820:2a6cad87b143] by
- Improve `Call` constructor API - Put `result` after `args` and `kwargs` because we first pass the arguments and then get a result. - Make all arguments but `method_name` keyword-only arguments to avoid confusion.
- 7:46 PM Changeset [1819:66015241a6d5] by
- Add docstrings to test methods
- 7:40 PM Changeset [1818:89490275e1c5] by
- Use `ScriptedSession` in `TestFileContextManager`
- 7:32 PM Changeset [1817:bb81569fff7e] by
- Raise exception from `result` argument If a `Call` constructor had the `result` argument set to an exception, this exception (class or instance) should be raised when the call is "executed". The previous code didn't handle the possibility that an exception could be raised.
- 6:46 PM Changeset [1816:c589604f8a4b] by
- Use `ScriptedSession` in `TestHostContextManager`
- 6:28 PM Changeset [1815:f0523f8daee8] by
- Increase year in copyright
- 8:15 AM Changeset [1814:2f7af0774ec8] by
- Increase `min-similarity-lines` Increase the value to suppress the warning for common context manager code. I would have liked to disable the warning R0801 locally, but it doesn't seem to be possible. See also https://github.com/PyCQA/pylint/issues/214 .
- 8:03 AM Changeset [1813:a2c9f94db9cd] by
- Distribute `disable` over several lines The long lines in the `pylintrc` file have always bothered me, but backslashes or brackets around the list resulted in errors from Pylint. Fortunately I found some help at https://stackoverflow.com/a/47349011 .
- 8:00 AM Changeset [1812:b6ce48af3ecf] by
- Add `no-else-raise` Don't warn if a `raise` statement is followed by `else` or `elif`. Although technically Pylint's warning makes sense, I find it helpful to outline the `if`/`elif`/`else` structure and keep it even one of the branches gets a `raise` statement.
- 1:36 AM Changeset [1811:20115e5cfc46] by
- Use Pytest's `tmp_path` fixture Use the `tmp_path` fixture to make sure that temporary files are removed. Also, simplify the code even more by using the `path.read_bytes` and `path.write_bytes` methods.
Jun 17, 2019:
- 10:24 PM Changeset [1810:840277a08296] by
- Remove `ascii_data` This function is no longer needed. I assume this was used when we still had an "ASCII" mode that was about converting line endings on the fly. Since `random_data` now would only be needed in `binary_data`, merge `random_data` into `binary_data`.
- 10:18 PM Changeset [1809:03b28a125c97] by
- Remove uses of `mock_ftplib` With all the test cases in `test_host.py` switched to the `scripted_session` module, `mock_ftplib` is no longer needed.
- 10:16 PM Changeset [1808:f1fa4cf11231] by
- Use `ScriptedSession` in `TestFailingPickling`
- 10:09 PM Changeset [1807:65b79d35761d] by
- Define `Call` on module level Create a reference `Call` to `scripted_session.Call` on the module level, so that not every test method has to create a local reference.
- 9:57 PM Changeset [1806:6a898515802d] by
- Use `ScriptedSession` in `TestAcceptEitherUnicodeOrBytes` Only during working on this I became aware how many `cwd` calls happen for most of the FTP commands. This was kind of hidden with the previous implementation which faked the FTP server and didn't require any specification (or look at) the actually executed FTP/session commands.
- 5:29 PM Changeset [1805:afdbffb32f8d] by
- Use `ScriptedSession` in `test_synchronize_times_for_server_in_east`
- 5:14 PM Changeset [1804:88d20a857d6d] by
- Move helper class `_Path` Move helper mock class `_Path` to class level of `TestTimeShift` to make `_Path` usable for multiple test methods.
Jun 10, 2019:
- 10:55 PM Changeset [1803:555e10d7d302] by
- Use `ScriptedSession` in `test_synchronize_times` We no longer use the `TimeShiftFTPHost` class here; instead put `_Path` helper class in the test method. However, `TimeShiftFTPHost` is still used in the following test method `test_synchronize_times_for_server_in_east`, so this needs some refactoring later.
- 10:17 PM Changeset [1802:cb4ed831f41e] by
- Add another reason for race condition The more likely reason for a race condition would be removal of the helper file. All in all, that's still quite unlikely. ;-)
- 10:11 PM Changeset [1801:70f6c1457158] by
- Use `ScriptedSession` in `test_assert_valid_time_shift`
- 10:08 PM Changeset [1800:f8e4a49b6c62] by
- Use `ScriptedSession` in `test_rounded_time_shift`
- 9:59 PM Changeset [1799:7d0043ea6eb1] by
- Use `ScriptedSession` in `test_conditional_download_with_newer_target`
- 9:48 PM Changeset [1798:d54db23b933b] by
- Use `ScriptedSession` in `test_conditional_download_with_older_target`
- 9:38 PM Changeset [1797:25d9514b2cef] by
- Use `ScriptedSession` for `test_conditional_download_without_target`
- 9:33 PM Changeset [1796:10014a3ee248] by
- Distinguish sources of calls Don't only print the scripted session, but also whether the call is in `_next_script_call` or `__getattr__`.
- 5:04 PM Changeset [1795:26d05e101044] by
- Use `ScriptedSession` in `test_conditional_upload_with_upload` This test requires two scripts, one for the host on which `upload_if_newer` is called and one for the session that is used for the actual file transfer. Since `unittest.mock.patch` can't patch the built-in code of `io.BytesIO` and `io.StringIO`, I added two trivial classes that _can_ be patched.
- 4:58 PM Changeset [1794:8352e0d49d69] by
- Define allowed marker explicitly This is a feature in Pytest that should prevent unexpected behavior because of typos in marker names.
Jun 9, 2019:
- 8:42 PM Changeset [1793:82b72a77706d] by
- Use `ScriptedSession` in `test_conditional_upload_without_upload`
- 8:40 PM Changeset [1792:a1e5112eb836] by
- Move `local_target` assignment down We're copying from the remove file to the local target. Reflect this in the order of the statements.
Apr 22, 2019:
- 5:47 PM Changeset [1791:866a59de515d] by
- Add `dir_line` function The function can be used to construct lines as they would be returned in an FTP listing. This is especially useful if we need to control the date or time relative to the current date or time.
- 5:34 PM Changeset [1790:5eccaa7bf8fe] by
- Update class docstring We no longer distinguish ASCII and binary mode in the "FTP sense". It's still possible to open a remote file as text or binary, but uploads and downloads are always binary.
- 4:12 PM Changeset [1789:3133202c909c] by
- Print `ScriptedSession` in only one place Print `ScriptedSession` in only one place, in `_next_script_call`. Escpecially, print the object before `_next_script_call` may raise an exception, so we have the information available for debugging.
Apr 21, 2019:
- 6:07 PM WikiDeletePage edited by
- (diff)
- 6:07 PM TracNotification edited by
- (diff)
- 6:07 PM TracBrowser edited by
- (diff)
- 6:07 PM CamelCase edited by
- (diff)
- 6:07 PM TracWiki edited by
- (diff)
- 6:07 PM TicketQuery created by
- 6:07 PM TracQuery edited by
- (diff)
- 6:07 PM TracPlugins edited by
- (diff)
- 6:07 PM TracGuide edited by
- (diff)
- 6:07 PM TracNavigation edited by
- (diff)
- 6:07 PM TracBackup edited by
- (diff)
- 6:07 PM WikiMacros edited by
- (diff)
- 6:07 PM TracReports edited by
- (diff)
- 6:07 PM TracUpgrade edited by
- (diff)
- 6:07 PM TracAdmin edited by
- (diff)
- 6:07 PM TracLogging edited by
- (diff)
- 6:07 PM TracWorkflow edited by
- (diff)
- 6:07 PM TracStandalone edited by
- (diff)
- 6:07 PM InterWiki edited by
- (diff)
- 6:07 PM TracLinks edited by
- (diff)
- 6:07 PM TracRevisionLog edited by
- (diff)
- 6:07 PM TracTimeline edited by
- (diff)
- 6:07 PM InterTrac edited by
- (diff)
- 6:07 PM WikiFormatting edited by
- (diff)
- 6:07 PM TracRoadmap edited by
- (diff)
- 6:07 PM WikiPageNames edited by
- (diff)
- 6:07 PM TracModWSGI edited by
- (diff)
- 6:07 PM PageTemplates edited by
- (diff)
- 6:07 PM TracSupport edited by
- (diff)
- 6:07 PM TracInstall edited by
- (diff)
- 6:07 PM TracChangeset edited by
- (diff)
- 6:07 PM WikiNewPage edited by
- (diff)
- 6:07 PM WikiHtml edited by
- (diff)
- 6:07 PM TracFastCgi edited by
- (diff)
- 6:07 PM TracImport edited by
- (diff)
- 6:07 PM TracModPython edited by
- (diff)
- 6:07 PM TracEnvironment edited by
- (diff)
- 6:07 PM TracTickets edited by
- (diff)
- 6:07 PM TracIni edited by
- (diff)
- 6:07 PM TracSyntaxColoring edited by
- (diff)
- 6:07 PM TracAccessibility edited by
- (diff)
- 6:07 PM TracRepositoryAdmin edited by
- (diff)
- 6:07 PM TracSearch edited by
- (diff)
- 6:07 PM TracPermissions edited by
- (diff)
- 6:07 PM TracFineGrainedPermissions edited by
- (diff)
- 6:07 PM TracTicketsCustomFields edited by
- (diff)
- 6:07 PM WikiRestructuredText edited by
- (diff)
- 6:07 PM TracRss edited by
- (diff)
- 6:07 PM TracInterfaceCustomization edited by
- (diff)
- 6:07 PM WikiProcessors edited by
- (diff)
- 6:07 PM TracCgi edited by
- (diff)
- 6:07 PM TracChangeLog created by
- 6:07 PM WikiRestructuredTextLinks edited by
- (diff)
- 6:07 PM TracBatchModify edited by
- (diff)
- 6:07 PM TracUnicode edited by
- (diff)
Apr 20, 2019:
- 10:20 PM Changeset [1788:f793533cee54] by
- Print requested attribute When running out of `Call` objects for a `ScriptedSession`, print the last requested attribute to give the test developer a hint about what kind of call is missing next.
- 9:50 PM Changeset [1787:ebfb895f1abb] by
- Change `self._print` to `print` Since the `_print` method was removed, using it triggered a `__getattr__` call, which in turn triggered an `IndexError` and an attempted call to `_print` etc., leading to an infinite recursion.
- 9:35 PM Changeset [1786:6bf3f11c4eb1] by
- Remove line that was added for a breakpoint
- 5:26 PM Changeset [1785:d9c22cc77a24] by
- Remove `test_recursive_listing` Remove `TestRecursiveListingForDotAsPath.test_recursive_listing`. The method failed and after stepping through it with the debugger, it's not clear why it worked to begin with. Since this is anyway an obscure way to test the use of '.' vs. '' in the `session.dir` call I decided to remove the test.
- 5:23 PM Changeset [1784:be1e64b05a25] by
- Combine call checks Combine most of `Call.check_method_name`, `Call.check_args`, `ScriptedSession._print_method_names` and `ScriptedSession._print_args` in `Call.check_args`. By printing the "ScriptedSession n" header separately instead of using it in all print calls, I was able to move the printing of methods and arguments into `Call`.
Apr 19, 2019:
- 9:52 PM Changeset [1783:2ae14d87d0ef] by
- Reset session counter for each test Reset the class variable `_session_count` in `ScriptedSession` every time a `MultisessionFactory` object is created. In practice, this means that the counter is reset for each test. However, there could be a problem when we create more than one `MultisessionFactory` in a single test. I added an extra class method `reset_session_count` to hide whether "resetting" means to set `_session_count` to 0 or to 1.
- 9:42 PM Changeset [1782:866f74bb0220] by
- Revise `scripted_session` module While adapting the test `TestUploadAndDownload.test_download` to the scripted session concept, I got pretty confused about the "scripted" call vs. the call from the system under test. Especially the term "expected" turned out to be confusing: - "Expected" can mean we specified something in the scripted call, and we expect the system under test to behave accordingly. This is the original notion I had when using "expected". - However, when creating tests, it can happen that the scripted call is specified wrongly and the "expected" call is the one from the system under test, not from the scripted call. Therefore, I decided to remove the word "expected" from the API and speak of `scripted_*` vs. `sut_*`. Apart from this naming change, I refactored the printing and checking of method names, args and kwargs of scripted call vs. sut call. A disadvantage of the new design is that the method name check must now be called explicitly from every method in `ScriptedSession` that could be called by the system under test. This isn't just the `__getattr__` method, but also `dir`, `transfercmd` and `ntransfercmd`. Maybe I can fix or improve this later.
- 6:31 PM Changeset [1781:88ac92027072] by
- Fix mock socket assertions - I forgot to explicitly use `assert` for the comparisons. This is a common mistake because mock's `assert_*` methods have the assertion built in whereas other mock checks require an explicit `assert` statement. Although it's clear when an explicit `assert` is needed, it's easy to forget. - Fix comparison tuples for `call` objects. The wrong comparison values weren't noticed before because of the previous bullet point. Despite the examples in the documentation, it's somewhat difficult to see what the comparison values should be. A big help is to use `tuple(call)` on an expected `call` to see what the comparison tuple should look like.
- 6:20 PM Changeset [1780:8e0cb12054ea] by
- Use named constant from `FTPFile` Use named constant `FTPFile._close_timeout` instead of literal 5.
- 6:18 PM Changeset [1779:554879f6050a] by
- Turn `_scripted_sessions` into a public attribute
- 6:16 PM Changeset [1778:a25fab65d6b1] by
- Verify operations on mock socket
- 6:15 PM Changeset [1777:54ec3c0fbe70] by
- Remember created `ScriptedSession` objects These can be examined after running a test.
- 5:51 PM Changeset [1776:de2dec8839fa] by
- Use `ScriptedSession` in `test_download` This also requires some additions to the `ScriptedSession` class, namely a `sock` attribute and the `ntransfercmd` and `transfercmd` methods. This test is the first to use more than one `ScriptedSession` object. One object is for the initially created `host` object, the other for the FTP file.
- 5:06 PM Changeset [1775:3aa4a955ed66] by
- Structure output with some indentation
- 4:44 PM Changeset [1774:cdafd091b9d1] by
- Rename `_index` to `_call_index` This makes it easier to understand and to distinguish it from `_session_count`.
- 4:41 PM Changeset [1773:9bec86daea2d] by
- Revise `ScriptedSession` debugging output - Avoid continuation after using `end=""`. Instead, don't use the `end` argument, even if it means printing one more line. - Print a proper error message if we run out of `Call` objects instead of only showing _only_ an `IndexError`.
- 4:22 PM Changeset [1772:172c44d9b83c] by
- Fix confusing code Show explicitly what's going on. The previous statement self._session_count = self._session_count looked really weird although it did something sensible: copying the current class-level counter to an instance variable.
- 4:16 PM Changeset [1771:cd4643cb9969] by
- Shorten `ScriptedSession` tag in output Instead of printing <ScriptedSession at 0x7f45f5aaa780> Expecting method name '__init__' - found it print a shorter form ScriptedSession 1: Expecting method name '__init__' - found it `ScriptedSession`s get increasing counter values (which is a class-level variable). This makes the output not only more compact, but also makes it easier to distinguish different `ScriptedSession` objects. Of course, this wouldn't work properly with multithreaded or multiprocessing code, but I don't see a need for this anytime soon.
- 4:09 PM Changeset [1770:6027514990a8] by
- Insert section comment Insert section comment to separate custom `ftplib.FTP` methods.
- 4:04 PM Changeset [1769:22c600474048] by
- Improve `ScriptedSession` output Make it easier to follow what's going on while selecting and processing each call.
- 3:02 PM Changeset [1768:f0c8711b57d5] by
- Explain why we don't override `__repr__`
- 2:51 PM Changeset [1767:eab86b88e8ea] by
- Add docstring for `Call.check_args`
Note: See TracTimeline
for information about the timeline view.