From 95a934f8150b89c04b74cbf62cf13af73ed64975 Mon Sep 17 00:00:00 2001 From: YangSuoze Date: Thu, 5 Mar 2026 18:50:49 +0800 Subject: [PATCH] Fix setup.cfg python_requires placement and add regression test --- setup.cfg | 5 ++--- tests/test_setup_cfg.py | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 tests/test_setup_cfg.py diff --git a/setup.cfg b/setup.cfg index 109276f..6c44f48 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,6 +13,7 @@ package_dir = packages = find_namespace: zip_safe = True include_package_data = True +python_requires = >=3.10 install_requires = numpy openai>=1.52.0 @@ -67,8 +68,6 @@ install_requires = [options.packages.find] where = . include = autoagent* - -python_requires = >=3.10 [options.entry_points] console_scripts = @@ -78,4 +77,4 @@ max_line_length = 120 ignore = E501,W6 in-place = true recursive = true -aggressive = 3 \ No newline at end of file +aggressive = 3 diff --git a/tests/test_setup_cfg.py b/tests/test_setup_cfg.py new file mode 100644 index 0000000..e7a3709 --- /dev/null +++ b/tests/test_setup_cfg.py @@ -0,0 +1,24 @@ +import configparser +from pathlib import Path +import unittest + + +class SetupCfgTests(unittest.TestCase): + def test_python_requires_is_defined_under_options(self): + setup_cfg = Path(__file__).resolve().parents[1] / "setup.cfg" + parser = configparser.ConfigParser() + parser.read(setup_cfg, encoding="utf-8") + + self.assertTrue(parser.has_option("options", "python_requires")) + self.assertEqual(parser.get("options", "python_requires"), ">=3.10") + + def test_python_requires_is_not_under_packages_find(self): + setup_cfg = Path(__file__).resolve().parents[1] / "setup.cfg" + parser = configparser.ConfigParser() + parser.read(setup_cfg, encoding="utf-8") + + self.assertFalse(parser.has_option("options.packages.find", "python_requires")) + + +if __name__ == "__main__": + unittest.main()