Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
chayim committed Apr 26, 2022
2 parents 594b5d7 + 7861d51 commit 21dd461
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/tox-tests.yml
Expand Up @@ -5,6 +5,8 @@ jobs:
lint:
name: lint
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{matrix.python-version}}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -41,9 +41,9 @@ black = "^21.7b0"
tox-pyenv = "^1.1.0"
PyMySQL = "^1.0.2"
cryptography = "^3.4.7"
psycopg2-binary = "^2.9.3"
ibm-db = "^3.1.1"
ibm-db-sa = "^0.3.7"
psycopg2-binary = "^2.9.3"

[tool.pytest.ini_options]
markers = [
Expand Down
4 changes: 1 addition & 3 deletions rgsync/Connectors/cql_connector.py
Expand Up @@ -44,9 +44,7 @@ def Connect(self):

ConnectionStr = self._getConnectionStr()

WriteBehindLog(
f"Connect: connecting db={self.db} keyspace={self.keyspace}"
)
WriteBehindLog(f"Connect: connecting db={self.db} keyspace={self.keyspace}")
auth_provider = PlainTextAuthProvider(
username=self.user, password=self.password
)
Expand Down
8 changes: 8 additions & 0 deletions rgsync/Connectors/sql_connectors.py
Expand Up @@ -126,6 +126,14 @@ def _getConnectionStr(self):
return f"db2://{self.user}:{self.passwd}@{self.db}"


class DB2Connection(BaseSqlConnection):
def __init__(self, user, passwd, db):
BaseSqlConnection.__init__(self, user, passwd, db)

def _getConnectionStr(self):
return f"db2://{self.user}:{self.passwd}@{self.db}"


class BaseSqlConnector:
def __init__(self, connection, tableName, pk, exactlyOnceTableName=None):
self.connection = connection
Expand Down
4 changes: 1 addition & 3 deletions rgsync/redis_gears_write_behind.py
Expand Up @@ -269,9 +269,7 @@ def __init__(self, mappings, connector, name, version=None):
# cases like mongo, that don't implement this, silence the warning
if "object has no attribute 'PrepereQueries'" in str(e):
return
WriteBehindLog(
f'Skip calling PrepereQueries of connector, err="{str(e)}"'
)
WriteBehindLog(f'Skip calling PrepereQueries of connector, err="{str(e)}"')


def DeleteKeyIfNeeded(r):
Expand Down
12 changes: 3 additions & 9 deletions tests/test_mongowritebehind.py
Expand Up @@ -32,9 +32,7 @@ def setup_class(cls):
dbpasswd = docker["MONGO_INITDB_ROOT_PASSWORD"]
db = docker["MONGO_DB"]

con = (
f"mongodb://{dbuser}:{dbpasswd}@172.17.0.1:27017/{db}?authSource=admin"
)
con = f"mongodb://{dbuser}:{dbpasswd}@172.17.0.1:27017/{db}?authSource=admin"

script = """
from rgsync import RGJSONWriteBehind, RGJSONWriteThrough
Expand Down Expand Up @@ -228,9 +226,7 @@ def setup_class(cls):
dbpasswd = docker["MONGO_INITDB_ROOT_PASSWORD"]
db = docker["MONGO_DB"]

con = (
f"mongodb://{dbuser}:{dbpasswd}@172.17.0.1:27017/{db}?authSource=admin"
)
con = f"mongodb://{dbuser}:{dbpasswd}@172.17.0.1:27017/{db}?authSource=admin"

script = f"""
from rgsync import RGJSONWriteBehind, RGJSONWriteThrough
Expand Down Expand Up @@ -279,9 +275,7 @@ def setup_class(cls):
dbpasswd = docker["MONGO_INITDB_ROOT_PASSWORD"]
db = docker["MONGO_DB"]

con = (
f"mongodb://{dbuser}:{dbpasswd}@172.17.0.1:27017/{db}?authSource=admin"
)
con = f"mongodb://{dbuser}:{dbpasswd}@172.17.0.1:27017/{db}?authSource=admin"

script = """
from rgsync import RGJSONWriteBehind, RGJSONWriteThrough
Expand Down
4 changes: 4 additions & 0 deletions tests/test_sqlwritebehind.py
Expand Up @@ -94,6 +94,10 @@ def testWriteBehindAck(self):
res = result.fetchone()
assert res == ("1", "foo", "bar", 22)

result = self.dbconn.execute(text("select * from persons"))
res = result.fetchone()
assert res == ("1", "foo", "bar", 22)

# delete from database
self.env.execute_command("hset", "person:1", "#", "~2")
res = None
Expand Down

0 comments on commit 21dd461

Please sign in to comment.