Wykres commitów

1549 Commity (master)

Autor SHA1 Wiadomość Data
Diefesson de Sousa SIlva be327a7bc7 binascii: Implement newline param in function b2a_base64.
See: https://docs.python.org/3/library/binascii.html#binascii.b2a_base64
2022-06-29 13:00:50 +10:00
Fabian Schmitt e7e8eff86b urequests: Add Basic Authentication support.
Usage matches the shorthand version described in
https://requests.readthedocs.io/en/latest/user/authentication/#basic-authentication
2022-06-29 12:59:38 +10:00
Andrew Leech 106c28a4d7 urequests: Fix raising unsupported Transfer-Encoding exception.
Would lead to recursive TypeError because of str + bytes.
2022-06-29 12:59:12 +10:00
Paul Sokolovsky d978e246d5 urequests: Explicitly add "Connection: close" to request headers.
Even though we use HTTP 1.0, where closing connection after sending
response should be the default, some servers ignore this requirement and
keep the connection open.  So, explicitly send corresponding header to get
the expected behavior.
2022-06-29 12:58:47 +10:00
Paul Sokolovsky 5854ae1286 urequests: Add ability to parse response headers.
This is controlled by parse_headers param to request(), which defaults to
True for compatibility with upstream requests. In this case, headers are
available as .headers of Response objects. They are however normal (not
case-insensitive) dict.

If parse_headers=False, old behavior of ignore response headers is used,
which saves memory on the dict.

Finally, parse_headers can be a custom function which can e.g. parse only
subset of headers (again, to save memory).
2022-06-28 16:55:15 +10:00
Andrew Leech db4c739863 unittest: Version 0.9.0 2022-05-06 10:47:37 +10:00
Andrew Leech 959115d3a9 unittest: Add support for specifying custom TestRunner. 2022-05-06 10:47:37 +10:00
Steve Li 2d61dbdb93 unittest: Add setUpClass and tearDownClass handling.
Supports setUp and tearDown functionality at Class level.
2022-05-06 10:47:37 +10:00
Andrew Leech ddeb9a7da2 unittest: Improve failure text consistency with cpython. 2022-05-06 10:47:37 +10:00
Andrew Leech 9b6315a2ba unittest: Add exception capturing for subTest. 2022-05-06 10:47:37 +10:00
Andrew Leech 9f6f211506 unittest: Reset python env between tests. 2022-05-06 10:47:37 +10:00
Andrew Leech cb8d108ac1 unittest: Add test for environment isolation. 2022-05-06 10:47:37 +10:00
Andrew Leech a7b2f63117 unittest: Add discover function. 2022-05-06 10:47:37 +10:00
Andrew Leech 9d9ca3d59b unittest: Run test_* functions as well as TestCase classes. 2022-05-06 10:47:37 +10:00
Andrew Leech c7eb3de858 unittest: Print module name on result lines.
Matches cpython format.
2022-05-06 10:47:37 +10:00
Paul Sokolovsky f92833b015 unittest: Support TestCase subclasses with own runTest() method.
E.g. for doctest.

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky ac282d861e unittest: Add TextTestRunner as alias for TestRunner.
For CPython compatibility.

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 5a53a75ec1 unittest: Print no. of skipped tests in a way compatible with CPython.
Perhaps, modern CPython (3.8).

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 01fcd42042 unittest: test_unittest: Add tests for expectedFailure decorator.
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 377ebbfe56 unittest: Add expectedFailure decorator.
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 8e82f3d80b unittest: Support recursive TestSuite's.
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky e582666f5d unittest: Properly handle failures vs errors.
Also, rework result printing to be more compatible with CPython.

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 1b46612f94 unittest: Implement basic addCleanup()/doCleanup().
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 2c0b508e4d unittest: TestSuite: Add run() method.
For CPython compatibility.

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 04dce89790 unittest: Add dummy TestCase.assertWarns() context manager.
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 555f28ce6d unittest: Add dummy TestCase.subTest() context manager.
Just runs "subtests" in the scope of the main TestCase.

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 7d77774027 unittest: Add TestCase.skipTest() method.
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 5d3a44cb1c unittest: TestCase: Add (dummy) __init__.
Mostly to workaround inherited MicroPython's issues with inheritance.

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky f09d2ec608 unittest: Support both test classes and class instances.
And for clarity, rename runner function run_class() -> run_suite().

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky d747b21fc6 unittest: Only treat callable fields as test methods.
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky c72ec5c029 unittest: TestSuite: Add undescore to internal field, self._tests.
To avoid possible name clashes.

Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky dc788f4e50 unittest: Reinstate useful debugger helper.
Signed-off-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
2022-05-06 10:47:37 +10:00
Paul Sokolovsky dedfe2dcd4 unittest: Add assertLessEqual, assertGreaterEqual methods.
As used by CPython testsuite.
2022-05-06 10:47:37 +10:00
Paul Sokolovsky a57b575020 unittest: AssertRaisesContext: Store exception value as self.exception.
For tests to check. This feature is used by CPython stdlib tests.
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 965e25ce89 unittest: test_unittest: Typo fix. 2022-05-06 10:47:37 +10:00
Paul Sokolovsky fca89f65c7 unittest: test_unittest: Add test for .assertRaises(AssertionError).
Make sure that not raising AssertionError from tested function is properly
caught.
2022-05-06 10:47:37 +10:00
sss 669d343feb unittest: Allow to catch AssertionError with assertRaises().
Without this change, current implementaiton produces a false positive
result for AssertionError type.

Example of falsely passing test code:

def test(a, b):
    assert a > 10
    assert b > 10

self.assertRaises(AssertionError, test, 20, 20)
2022-05-06 10:47:37 +10:00
Paul Sokolovsky 663a3d6c54 unittest: test_unittest.py: Fix typo in method name. 2022-05-06 10:47:37 +10:00
Andrew Leech 7d4d02edfc unittest: Log failure tracebacks at test end.
Store traceback details for each test failure and log to console at the
end of the test, like CPython version of the module does.
2022-05-06 10:47:37 +10:00
Andrew Leech a9cd99ce2d unittest: Allow passing module name or instance into unittest.main() 2022-05-06 10:47:37 +10:00
Andrew Leech d64557a211 fnmatch: Release 0.6.0. 2022-05-06 10:47:37 +10:00
Andrew Leech 7259f0fd6f fnmatch: Remove dependency on os.path. 2022-05-06 10:47:37 +10:00
Andrew Leech dcdac1f552 fnmatch: Add ure compatibility.
Removes dependency on re-pcre which is only available on unix port.
2022-04-08 16:16:56 +10:00
Matt Trentini 0c31e0b3d7 micropython/aioble: Prioritise services in advertisement payload.
A number of fields (services, appearance, manufacturer, name) can appear
when a scan is requested.  However there is only so much space in the
header so, if a user has configured multiple fields, some may be 'pushed'
into the active scan response which requires additional communication.

When iOS scans for BLE devices it can filter by services, and so services
must be in the advertising (as opposed to scan response) payload.
2022-03-24 11:25:31 +11:00
robert-hh 760bfefd9d micropython/upysh: Add the cp() function and improve ls and rm.
- cp() copies a file. If the target is a directory, the file is copied
  into that directory.  It uses a small buffer, so it's not fast.
- ls uses ilistdir and creates a sorted output with directories listed as
  the first group.
- rm optionally deletes recursive, if the target is a directory.
2022-03-24 10:37:48 +11:00
Andrew Leech 22cd7fdd64 tools/codeformat: Fix compatibility running from subfolder in repo. 2022-03-23 12:16:24 +11:00
Andrew Leech ab1e6231dc tools/codeformat: By default only check/update on current git branch.
It can be difficult using the codeformat.py tool when there are other files
in the repository not currently matching the standard.

For developers, running over the entire repo can throw up a large list of
changes in a local git which can lead to inclusion of unrelated changes in
commits if they're added accidentally.  If the files arg is used to trim
down the list of files scanned, it runs a risk of missing some files
they've modified.  In CI, it means that PR's can fail on codeformat for
issues that aren't related to that PR.

This change adds a git query in the codeformat tool by default to only work
on the list of files that have been modified in the current branch.  This
can still be overridden by the files arg to run over all files still, eg.
python3 tools/codeformat.py -v '**'.
2022-03-22 16:46:48 +11:00
Lorenzo Cappelletti fc86070ffb python-stdlib/datetime: Add new implementation of datetime module.
This new module is a port of Python datetime providing classes for
manipulating dates, times, and deltas.  It completely replaces the existing
unix-ffi version.

Signed-off-by: Lorenzo Cappelletti <lorenzo.cappelletti@gmail.com>
2022-03-22 14:02:01 +11:00
Damien George 64b8817c0d all: Update formatting for new Black version 22.1.0.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-22 13:30:34 +11:00
Jim Mussared cdd260f079 aioble/multitests: Add multitest for shutdown handlers.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-12 13:36:18 +11:00