commit: 3a392ae4913e38bd7631181fff65f8711ae7396e Author: Sergey Torokhov <torokhov-s-a <AT> yandex <DOT> ru> AuthorDate: Tue Oct 27 04:25:27 2020 +0000 Commit: Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net> CommitDate: Tue Oct 27 04:25:27 2020 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=3a392ae4
games-board/rmahjong: Fix tests ResourceWarnings, remove unittest2 DEPEND The inittest2 dependence is unneccessary as python3 internal unittest is used. Update patches to fix passing float into int("") in other way. Update test.py patch to fix numerous 'ResourceWarning's. Signed-off-by: Sergey Torokhov <torokhov-s-a <AT> yandex.ru> .../files/rmahjong-0.4_fix_python3_compat.patch | 50 ++++++++-------------- .../rmahjong/files/rmahjong-0.4_fix_tests.patch | 14 ++++++ games-board/rmahjong/rmahjong-0.4_p20201013.ebuild | 5 +-- 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/games-board/rmahjong/files/rmahjong-0.4_fix_python3_compat.patch b/games-board/rmahjong/files/rmahjong-0.4_fix_python3_compat.patch index d6ad5893..62ec68e7 100644 --- a/games-board/rmahjong/files/rmahjong-0.4_fix_python3_compat.patch +++ b/games-board/rmahjong/files/rmahjong-0.4_fix_python3_compat.patch @@ -1,35 +1,3 @@ -diff --git a/client/client.py b/client/client.py ---- a/client/client.py -+++ b/client/client.py -@@ -138,10 +138,10 @@ class Mahjong: - - def init_player_boxes(self, names, player_winds, score): - self.player_boxes = [ -- PlayerBox((50, 700), names[0], player_winds[0], int(score[0]), direction_up, (0,-80)), -- PlayerBox((954, 50), names[1], player_winds[1], int(score[1]), direction_left, (-210, 0)), -- PlayerBox((700, 0), names[2], player_winds[2], int(score[2]), direction_up, (0,80)), -- PlayerBox((0, 50), names[3], player_winds[3], int(score[3]), direction_right, (80,0)) ] -+ PlayerBox((50, 700), names[0], player_winds[0], int(float(score[0])), direction_up, (0,-80)), -+ PlayerBox((954, 50), names[1], player_winds[1], int(float(score[1])), direction_left, (-210, 0)), -+ PlayerBox((700, 0), names[2], player_winds[2], int(float(score[2])), direction_up, (0,80)), -+ PlayerBox((0, 50), names[3], player_winds[3], int(float(score[3])), direction_right, (80,0)) ] - for widget in self.player_boxes: - self.gui.add_widget(widget) - -diff --git a/client/states.py b/client/states.py ---- a/client/states.py -+++ b/client/states.py -@@ -555,8 +555,8 @@ class ScoreState(RoundPreparingState): - results = [] - for wind in winds: - name = (self.mahjong.get_player_name(wind)) -- score = (int(self.message[wind + "_score"])) -- payment = (int(self.message[wind + "_payment"])) -+ score = (int(float(self.message[wind + "_score"]))) -+ payment = (int(float(self.message[wind + "_payment"]))) - results.append((name, score, payment)) - results.sort(key = lambda r: r[1], reverse = True) - return results diff --git a/client/tilepainter.py b/client/tilepainter.py --- a/client/tilepainter.py +++ b/client/tilepainter.py @@ -67,6 +35,24 @@ index 042ee54..dc7e463 100644 def is_hand_open(sets): for set in sets: +@@ -97,14 +97,14 @@ + + if wintype == "Ron": + if player_wind.name == "WE": +- return (name, round_to_base(score / 2 * 3, 100)) ++ return (name, round_to_base(score // 2 * 3, 100)) + else: + return (name, score) + else: + if player_wind.name == "WE": +- return (name, (round_to_base(score / 2, 100), 0)) ++ return (name, (round_to_base(score // 2, 100), 0)) + else: +- return (name, (round_to_base(score / 4, 100), round_to_base(score / 2, 100))) ++ return (name, (round_to_base(score // 4, 100), round_to_base(score // 2, 100))) + + def quick_pons_and_kans(hand): + d = {} @@ -274,7 +275,7 @@ def eval_sets(pair, sets, round_wind, player_wind, last_tile, wintype): # Other hands for name, fn in score_functions: diff --git a/games-board/rmahjong/files/rmahjong-0.4_fix_tests.patch b/games-board/rmahjong/files/rmahjong-0.4_fix_tests.patch index 7926e714..93b671db 100644 --- a/games-board/rmahjong/files/rmahjong-0.4_fix_tests.patch +++ b/games-board/rmahjong/files/rmahjong-0.4_fix_tests.patch @@ -1,3 +1,17 @@ +diff a/server/botengine.py b/server/botengine.py +--- a/server/botengine.py ++++ b/server/botengine.py +@@ -53,7 +53,10 @@ + + def shutdown(self): + self.thread.thread_quit = True ++ self.process.stdin.close() ++ self.process.stdout.close() + self.process.terminate() ++ self.process.wait() + #self._write("QUIT\n") + #self.join() + diff --git a/server/test.py b/server/test.py --- a/server/test.py +++ b/server/test.py diff --git a/games-board/rmahjong/rmahjong-0.4_p20201013.ebuild b/games-board/rmahjong/rmahjong-0.4_p20201013.ebuild index 28f4c28e..fff2446a 100644 --- a/games-board/rmahjong/rmahjong-0.4_p20201013.ebuild +++ b/games-board/rmahjong/rmahjong-0.4_p20201013.ebuild @@ -38,7 +38,6 @@ RDEPEND=" dev-python/pyopengl[${PYTHON_MULTI_USEDEP}] ') " -DEPEND="test? ( dev-python/unittest2 )" PATCHES=( "${FILESDIR}/${PN}-0.4_fix_python3_compat.patch" @@ -62,7 +61,7 @@ src_compile() { } src_test() { - cd "${S}/server/" && python3 test.py + cd "${S}/server/" && python3 test.py -v } src_install() { @@ -79,5 +78,5 @@ src_install() { dobin "rmahjong" doicon -s 48 "${DISTDIR}/kmahjongg_${PN}.png" - make_desktop_entry "${PN}" "RMahjong" "kmahjongg_${PN}.png" "Game;BoardGame;" || die "Failed making desktop entry!" + make_desktop_entry "${PN}" "RMahjong" "kmahjongg_${PN}" "Game;BoardGame;" || die "Failed making desktop entry!" }