Compare commits

...

3 Commits

Author SHA1 Message Date
cclecle
45d132c5ca fix cod4 boolean handling 2023-09-30 13:16:40 +01:00
cclecle
cd3a937423 chore: remove useless data dir from setuptools 2023-09-30 00:19:57 +01:00
cclecle
5fdabae600 fix: switch to pypi version of chacha-cicd-helper 2023-09-29 23:59:11 +01:00
4 changed files with 36 additions and 12 deletions

View File

@@ -67,7 +67,7 @@ plugins:
verbose: false
exclude_pages:
- LICENSE
output_path: C:\Users\chacha\git\pygamecfg\helpers-results\doc_gen\site\pdf\manual.pdf
output_path: C:\Users\chacha\git\pygamecfg\helpers-results\cl_doc_gen\site\pdf\manual.pdf
markdown_extensions:
- def_list
- tables
@@ -114,8 +114,8 @@ markdown_extensions:
- footnotes
- pymdownx.superfences
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
emoji_index: !!python/name:materialx.emoji.twemoji ''
emoji_generator: !!python/name:materialx.emoji.to_svg ''
extra:
branch: master
repository: pygamecfg

View File

@@ -48,7 +48,6 @@ include-package-data = true
where = ["src"]
[tool.setuptools.package-data]
"pygamecfg.data" = ["*.*"]
"pysimpleini" = ["py.typed"]
[project.urls]
@@ -57,12 +56,12 @@ Documentation = "https://chacha.ddns.net/mkdocs-web/chacha/pygamecfg/master/la
Tracker = "https://chacha.ddns.net/gitea/chacha/pygamecfg/issues"
[project.optional-dependencies]
test = ["chacha_cicd_helper@git+https://chacha.ddns.net/gitea/chacha/chacha_cicd_helper.git@master"]
coverage-check = ["chacha_cicd_helper@git+https://chacha.ddns.net/gitea/chacha/chacha_cicd_helper.git@master"]
complexity-check = ["chacha_cicd_helper@git+https://chacha.ddns.net/gitea/chacha/chacha_cicd_helper.git@master"]
quality-check = ["chacha_cicd_helper@git+https://chacha.ddns.net/gitea/chacha/chacha_cicd_helper.git@master"]
type-check = ["chacha_cicd_helper@git+https://chacha.ddns.net/gitea/chacha/chacha_cicd_helper.git@master"]
doc-gen = ["chacha_cicd_helper@git+https://chacha.ddns.net/gitea/chacha/chacha_cicd_helper.git@master"]
test = ["chacha_cicd_helper"]
coverage-check = ["chacha_cicd_helper"]
complexity-check = ["chacha_cicd_helper"]
quality-check = ["chacha_cicd_helper"]
type-check = ["chacha_cicd_helper"]
doc-gen = ["chacha_cicd_helper"]
# [project.scripts]
# my-script = "my_package.module:function"

View File

@@ -39,7 +39,7 @@ class GameOption_COD4(GameOption):
self.cfgfile = open(self.mainConfigFilePath, "r", encoding="utf8") # pylint: disable=consider-using-with
def format_OT_BOOLEAN(self, value: Union[int, str, float]) -> str:
return "1" if bool(value) is True else "0"
return "1" if super().format_OT_BOOLEAN(value) is "True" else "0"
def close(self) -> None:
self.cfgfile.close()

View File

@@ -61,7 +61,7 @@ class Testtest_cod4(unittest.TestCase):
# /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep
self.assertEqual("17\n", capted_stdout.getvalue())
self.assertEqual("", capted_stderr.getvalue())
# check if other key still there / untouched
# check if *other* key still there / untouched
self.test_normal_READ_sv_mapRotation()
def test_defect_READ_net_port_NONEXISTS(self):
@@ -74,3 +74,28 @@ class Testtest_cod4(unittest.TestCase):
fct_main(["-g", "cod4", "-b", "test/tmp/COD4", "GetOption", "net_port"])
self.assertEqual("132\n", capted_stdout.getvalue())
self.assertEqual("", capted_stderr.getvalue())
def test_normal_WRITE_oldschool(self):
with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr:
fct_main(["-g", "cod4", "-b", "test/tmp/COD4", "SetOption", "oldschool", "1"])
# /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep
# self.assertEqual("setting option <oldschool> to: 1\n", capted_stdout.getvalue())
self.assertEqual("", capted_stderr.getvalue())
with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr:
fct_main(["-g", "cod4", "-b", "test/tmp/COD4", "GetOption", "oldschool"])
# /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep
self.assertEqual("1\n", capted_stdout.getvalue())
self.assertEqual("", capted_stderr.getvalue())
with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr:
fct_main(["-g", "cod4", "-b", "test/tmp/COD4", "SetOption", "oldschool", "0"])
# /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep
self.assertEqual("setting option <oldschool> to: 0\n", capted_stdout.getvalue())
self.assertEqual("", capted_stderr.getvalue())
with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr:
fct_main(["-g", "cod4", "-b", "test/tmp/COD4", "GetOption", "oldschool"])
# /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep
self.assertEqual("0\n", capted_stdout.getvalue())
self.assertEqual("", capted_stderr.getvalue())