Skip to content

Fix slowdown on Python 3 #290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/colorer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import re
import sys
from lib.singleton import Singleton


# Use it to print messages on the screen and to the worker's log.
Expand Down Expand Up @@ -128,7 +127,6 @@ class Colorer(object):
1. ftp://ftp.cs.utk.edu/pub/shuford/terminal/dec_vt220_codes.txt
2. http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
"""
__metaclass__ = Singleton
fgcolor = {
"black": '0;30',
"red": '0;31',
Expand Down
21 changes: 18 additions & 3 deletions lib/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import sys
import argparse
from itertools import product
from lib.singleton import Singleton

from lib.colorer import color_stdout

Expand All @@ -23,14 +22,28 @@ def env_list(name, default):
return value_list or default


class Options:
class Options(object):
"""Handle options of test-runner"""

__metaclass__ = Singleton
_instance = None
_initialized = False

def __new__(cls, *args, **kwargs):
"""Make the class singleton."""
if cls._instance:
return cls._instance
cls._instance = super(Options, cls).__new__(cls, *args, **kwargs)
return cls._instance

def __init__(self):
"""Add all program options, with their defaults."""

# The __init__() method is called always, even when we
# return already initialized Options instance from
# __new__().
if Options._initialized:
return

parser = argparse.ArgumentParser(
description="Tarantool regression test suite front-end.")

Expand Down Expand Up @@ -264,6 +277,8 @@ def __init__(self):
self.args = parser.parse_args()
self.check()

Options._initialized = True

def check(self):
"""Check the arguments for correctness."""
check_error = False
Expand Down
8 changes: 0 additions & 8 deletions lib/singleton.py

This file was deleted.