diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 651ff6b..ca569c0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - python: [3.7, 3.8, 3.9, 3.x] + python: [3.7, 3.8, 3.9, "3.10", 3.x] steps: - name: install libxml2-dev run: sudo apt-get install libxml2-dev libxslt-dev diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index 5f59064..6015056 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - python: [3.7, 3.8, 3.9, 3.x] + python: [3.7, 3.8, 3.9, "3.10", 3.x] steps: - name: install {libxml2,libxslt}-dev run: sudo apt-get install libxml2-dev libxslt-dev diff --git a/Pipfile b/Pipfile index 2061133..00fdb05 100644 --- a/Pipfile +++ b/Pipfile @@ -13,11 +13,11 @@ freezegun = "==0.3.10" mypy = "==0.711" black = "==18.9b0" aiofiles = "==0.8.0" -uvloop = "==0.14.0" +uvloop = "==0.16.0" sphinx = "==4.5.0" sphinxcontrib-asyncio = "==0.3.0" recommonmark = "==0.5.0" -orjson = "==3.4.0" +orjson = "==3.7.2" [requires] python_version = "3" diff --git a/Pipfile.lock b/Pipfile.lock index 3176722..ce9298a 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "71755f0cf2f19fa434863a8a08f3eef60d667597647d8be96efcf79527fc81e6" + "sha256": "c5772227ff117c34cbb55b65c5ec6efb2c1f3efafeebac8e46f0010f86f76a21" }, "pipfile-spec": 6, "requires": { @@ -279,24 +279,42 @@ }, "orjson": { "hashes": [ - "sha256:132766446e6ff0ad9d13cd550cfc15d078ca3d2c6d5277517897da91d12e39df", - "sha256:1e957d1ab0ea3e4a4706cfa8f00a3a672dda7959607c231b6acb0b15ce35d52e", - "sha256:24dd09562ec383ddd77e9f82b9d604ea3a300643b2fd5beaf9a0b21d77e52be2", - "sha256:2dcfc744cad7dceee7fca55ebdca91cc79e14223acc76423f0f4017e7a2676c9", - "sha256:48238a0a2696c4f082d5432802064b4a63849cce3fc81ea80d9517f5cfeda138", - "sha256:4a757ee2154b09631d272e63bd35c549f876ce5425dd154446dff0e1ef603429", - "sha256:4fc25cd9f81de2b6e55fa7e5563973a1d47c05c86fbaf9124b1b74a08df65929", - "sha256:5b7db73d295d75a25c4f3a120e141d182cbcbb240d07c1b006655269bb802508", - "sha256:5ed087b0de8c8fad29d0b776d5c3287644271159e85efe2fbd745ebc0cb81697", - "sha256:86c005a10b626e1be5392a439774cf79f920a6e90f49dcd708aa6adc0c2f3fb3", - "sha256:af526fa8f4e4ac6ba953bf50bb384928a7d4a2849180c21593cdd3e08060f8ca", - "sha256:b326c47e19c939ee770c377d72d7595eefc21bf3b08864fcb82f46d433a0069f", - "sha256:e7c2920f66ee994cef285e93b81bee08935803b4f322bee77d0353a33746f778", - "sha256:ec84a7c0703fab8b4feecac19a5fb92156ae402fc8952a961ecbf1cdac1ef5c0", - "sha256:fd1bf6ab3b12020531a153e77d8468d7febf0efa6e36a64a06e08e5c02d2d707" + "sha256:12eb683ddbdddd6847ca2b3b074f42574afc0fbf1aff33d8fdf3a4329167762a", + "sha256:14bc727f41ce0dd93d1a6a9fc06076e2401e71b00d0bf107bf64d88d2d963b77", + "sha256:19eb800811a53efc7111ff7536079fb2f62da7098df0a42756ba91e7bdd01aff", + "sha256:1cf9690a0b7c51a988221376741a31087bc1dc2ac327bb2dde919806dfa59444", + "sha256:26306d988401cc34ac94dd38873b8c0384276a5ad80cdf50e266e06083284975", + "sha256:299a743576aaa04f5c7994010608f96df5d4a924d584a686c6e263cee732cb00", + "sha256:2d90ca4e74750c7adfb7708deb096f835f7e6c4b892bdf703fe871565bb04ad7", + "sha256:34a67d810dbcec77d00d764ab730c5bbb0bee1d75a037c8d8e981506e8fba560", + "sha256:3ff49c219b30d715c8baae17c7c5839fe3f2c2db10a66c61d6b91bda80bf8789", + "sha256:4c686cbb73ccce02929dd799427897f0a0b2dd597d2f5b6b434917ecc3774146", + "sha256:4c6bdb0a7dfe53cca965a40371c7b8e72a0441c8bc4949c9015600f1c7fae408", + "sha256:54a1e4e39c89d37d3dbc74dde36d09eebcde365ec6803431af9c86604bbbaf3a", + "sha256:54cfa4d915a98209366dcf500ee5c3f66408cc9e2b4fd777c8508f69a8f519a1", + "sha256:590bc5f33e54eb2261de65e4026876e57d04437bab8dcade9514557e31d84537", + "sha256:662bda15edf4d25d520945660873e730e3a6d9975041ba9c32f0ce93b632ee0d", + "sha256:6e6fc60775bb0a050846710c4a110e8ad17f41e443ff9d0d05145d8f3a74b577", + "sha256:796914f7463277d371402775536fb461948c0d34a67d20a57dc4ec49a48a8613", + "sha256:7e197e6779b230e74333e06db804ff876b27306470f68692ec70c27310e7366f", + "sha256:891640d332c8c7a1478ea6d13b676d239dc86451afa46000c4e8d0990a0d72dd", + "sha256:8ac61c5c98cbcdcf7a3d0a4b62c873bbd9a996a69eaa44f8356a9e10aa29ef49", + "sha256:9778a7ec4c72d6814f1e116591f351404a4df2e1dc52d282ff678781f45b509b", + "sha256:993550e6e451a2b71435142d4824a09f8db80d497abae23dc9f3fe62b6ca24c0", + "sha256:99bb2127ee174dd6e68255db26dbef0bd6c4330377a17867ecfa314d47bfac82", + "sha256:a82089ec9e1f7e9b992ff5ab98b4c3c2f98e7bbfdc6fadbef046c5aaafec2b54", + "sha256:b0b2483f8ad1f93ae4aa43bcf6a985e6ec278e931d0118bae605ffd811b614a1", + "sha256:b0f4e92bdfe86a0da57028e669bc1f50f48d810ef6f661e63dc6593c450314bf", + "sha256:b2b660790b0804624c569ddb8ca9d31bac6f94f880fd54b8cdff4198735a9fec", + "sha256:b705132b2827d33291684067cca6baa451a499b459e46761d30fcf4d6ce21a9a", + "sha256:c589d00b4fb0777f222b35925e4fa030c4777f16d1623669f44bdc191570be66", + "sha256:d3ae3ed52c875ce1a6c607f852ca177057445289895483b0247f0dc57b481241", + "sha256:e4b70bb1f746a9c9afb1f861a0496920b5833ff06f9d1b25b6a7d292cb7e8a06", + "sha256:f735999d49e2fff2c9812f1ea330b368349f77726894e2a06d17371e61d771bb", + "sha256:fbd3b46ac514cbe29ecebcee3882383022acf84aa4d3338f26d068c6fbdf56a0" ], "index": "pypi", - "version": "==3.4.0" + "version": "==3.7.2" }, "packaging": { "hashes": [ @@ -533,18 +551,25 @@ }, "uvloop": { "hashes": [ - "sha256:08b109f0213af392150e2fe6f81d33261bb5ce968a288eb698aad4f46eb711bd", - "sha256:123ac9c0c7dd71464f58f1b4ee0bbd81285d96cdda8bc3519281b8973e3a461e", - "sha256:4315d2ec3ca393dd5bc0b0089d23101276778c304d42faff5dc4579cb6caef09", - "sha256:4544dcf77d74f3a84f03dd6278174575c44c67d7165d4c42c71db3fdc3860726", - "sha256:afd5513c0ae414ec71d24f6f123614a80f3d27ca655a4fcf6cabe50994cc1891", - "sha256:b4f591aa4b3fa7f32fb51e2ee9fea1b495eb75b0b3c8d0ca52514ad675ae63f7", - "sha256:bcac356d62edd330080aed082e78d4b580ff260a677508718f88016333e2c9c5", - "sha256:e7514d7a48c063226b7d06617cbb12a14278d4323a065a8d46a7962686ce2e95", - "sha256:f07909cd9fc08c52d294b1570bba92186181ca01fe3dc9ffba68955273dd7362" + "sha256:04ff57aa137230d8cc968f03481176041ae789308b4d5079118331ab01112450", + "sha256:089b4834fd299d82d83a25e3335372f12117a7d38525217c2258e9b9f4578897", + "sha256:1e5f2e2ff51aefe6c19ee98af12b4ae61f5be456cd24396953244a30880ad861", + "sha256:30ba9dcbd0965f5c812b7c2112a1ddf60cf904c1c160f398e7eed3a6b82dcd9c", + "sha256:3a19828c4f15687675ea912cc28bbcb48e9bb907c801873bd1519b96b04fb805", + "sha256:6224f1401025b748ffecb7a6e2652b17768f30b1a6a3f7b44660e5b5b690b12d", + "sha256:647e481940379eebd314c00440314c81ea547aa636056f554d491e40503c8464", + "sha256:6ccd57ae8db17d677e9e06192e9c9ec4bd2066b77790f9aa7dede2cc4008ee8f", + "sha256:772206116b9b57cd625c8a88f2413df2fcfd0b496eb188b82a43bed7af2c2ec9", + "sha256:8e0d26fa5875d43ddbb0d9d79a447d2ace4180d9e3239788208527c4784f7cab", + "sha256:98d117332cc9e5ea8dfdc2b28b0a23f60370d02e1395f88f40d1effd2cb86c4f", + "sha256:b572256409f194521a9895aef274cea88731d14732343da3ecdb175228881638", + "sha256:bd53f7f5db562f37cd64a3af5012df8cac2c464c97e732ed556800129505bd64", + "sha256:bd8f42ea1ea8f4e84d265769089964ddda95eb2bb38b5cbe26712b0616c3edee", + "sha256:e814ac2c6f9daf4c36eb8e85266859f42174a4ff0d71b99405ed559257750382", + "sha256:f74bc20c7b67d1c27c72601c78cf95be99d5c2cdd4514502b4f3eb0933ff1228" ], "index": "pypi", - "version": "==0.14.0" + "version": "==0.16.0" }, "zipp": { "hashes": [ diff --git a/docs-src/compatibility.rst b/docs-src/compatibility.rst index b2f692a..5c5c69e 100644 --- a/docs-src/compatibility.rst +++ b/docs-src/compatibility.rst @@ -2,12 +2,12 @@ Compatibility ~~~~~~~~~~~~~ The explicit passing of a ``loop`` keyword argument, and subsequent access of a -``.loop`` attribute, has been deprecated and will be removed in version 0.7.0 for +``.loop`` attribute, has been deprecated and was removed in version 0.7.0 for Loggers and Handlers. Currently tested on Python: -- 3.6 - 3.7 - 3.8 - 3.9 +- 3.10 diff --git a/setup.cfg b/setup.cfg index b37d47f..c3207d7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,10 +23,10 @@ classifiers = Natural Language :: English Operating System :: MacOS :: MacOS X Operating System :: Unix - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Topic :: Software Development :: Libraries Topic :: System :: Logging diff --git a/tests/handlers/test_files.py b/tests/handlers/test_files.py index f3a3cc9..8d1e309 100644 --- a/tests/handlers/test_files.py +++ b/tests/handlers/test_files.py @@ -45,12 +45,8 @@ async def tearDown(self): async def test_initialization(self): mode = "x" encoding = "utf-8" - loop = Mock() handler = AsyncFileHandler( - filename=self.temp_file.name, - mode=mode, - encoding=encoding, - loop=loop, + filename=self.temp_file.name, mode=mode, encoding=encoding ) self.assertIsInstance(handler, AsyncFileHandler) @@ -58,15 +54,9 @@ async def test_initialization(self): self.assertEqual(handler.absolute_file_path, self.temp_file.name) self.assertEqual(handler.mode, mode) self.assertEqual(handler.encoding, encoding) - self.assertEqual(handler.loop, loop) self.assertIsNone(handler.stream) - async def test_init_gets_the_running_event_loop(self): - handler = AsyncFileHandler(filename=self.temp_file.name) - - self.assertIsInstance(handler.loop, asyncio.AbstractEventLoop) - async def test_close_closes_the_file(self): handler = AsyncFileHandler(filename=self.temp_file.name) diff --git a/tests/handlers/test_streams.py b/tests/handlers/test_streams.py index e8221c4..074f88b 100644 --- a/tests/handlers/test_streams.py +++ b/tests/handlers/test_streams.py @@ -37,10 +37,7 @@ def test_initialization(self): stream = Mock() formatter = Mock() filter = Mock() - loop = Mock() - handler = AsyncStreamHandler( - stream, level, formatter, filter, loop=loop - ) + handler = AsyncStreamHandler(stream, level, formatter, filter) self.assertIsInstance(handler, AsyncStreamHandler) @@ -48,14 +45,6 @@ def test_initialization(self): self.assertEqual(handler.formatter, formatter) self.assertEqual(handler.stream, stream) self.assertIn(filter, handler.filters) - self.assertEqual(handler.loop, loop) - - async def test_init_gets_the_running_event_loop(self): - handler = AsyncStreamHandler( - stream=self.write_pipe, level=10, formatter=Mock() - ) - - self.assertIsInstance(handler.loop, asyncio.AbstractEventLoop) async def test_init_writer_makes_pipe_nonblocking(self): flags = fcntl.fcntl(self.write_pipe.fileno(), fcntl.F_GETFL) diff --git a/tests/test_logger.py b/tests/test_logger.py index f31153a..71891af 100644 --- a/tests/test_logger.py +++ b/tests/test_logger.py @@ -17,40 +17,6 @@ from tests.utils import make_read_pipe_stream_reader -class LoggerOutsideEventLoopTest(unittest.TestCase): - def test_property_loop_always_return_a_running_loop(self): - logger = Logger(name="mylogger") - - # it's not safe to install the loop implictly, callers should use - # asynio.run - with self.assertRaises(RuntimeError): - logger.loop - - # it's not safe to run the loop implictly, callers should use - # asynio.run - with contextlib.closing(asyncio.get_event_loop()) as loop: - with self.assertRaises(RuntimeError): - logger.loop - - results = [] - - async def get_logger_loop(): - results.append(logger.loop) - - loop.run_until_complete(get_logger_loop()) - logger_loop, = results - - # now that the loop was explicitly set and started, we can use it - self.assertIs(logger_loop, loop) - del logger_loop - self.assertFalse(loop.is_closed()) - - # now that the loop was explicitly stopped, it's useless to return - loop = asyncio.get_event_loop() - with self.assertRaises(RuntimeError): - logger.loop - - class LoggerTests(asynctest.TestCase): async def setUp(self): r_fileno, w_fileno = os.pipe() @@ -77,7 +43,7 @@ async def test_init_with_default_handlers_initializes_handlers_for_stdout_and_st with asynctest.patch( "aiologger.logger.AsyncStreamHandler", side_effect=handlers ) as handler_init: - logger = Logger.with_default_handlers(loop=self.loop) + logger = Logger.with_default_handlers() self.assertCountEqual(logger.handlers, handlers) self.assertCountEqual( @@ -399,15 +365,6 @@ async def test_it_returns_a_log_task_if_logging_is_enabled_for_level(self): logged_content = await self.stream_reader.readline() self.assertEqual(logged_content, b"Xablau\n") - async def test_it_only_keeps_a_reference_to_the_loop_after_the_first_log_call( - self - ): - logger = Logger.with_default_handlers() - self.assertIs(logger._loop, get_running_loop()) - - await logger.info("Xablau") - self.assertIs(logger._loop, get_running_loop()) - def test_find_caller_without_stack_info(self): logger = Logger()