Changeset: 2b0819f9c0a9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2b0819f9c0a9
Modified Files:
        sql/test/remote/Tests/creds.SQL.py
        sql/test/remote/Tests/different_user.SQL.py
        sql/test/remote/Tests/invalid_creds.SQL.py
Branch: Oct2020
Log Message:

Properly manipulate path names (so that this can work on Windows).


diffs (102 lines):

diff --git a/sql/test/remote/Tests/creds.SQL.py 
b/sql/test/remote/Tests/creds.SQL.py
--- a/sql/test/remote/Tests/creds.SQL.py
+++ b/sql/test/remote/Tests/creds.SQL.py
@@ -51,7 +51,7 @@ def freeport():
 def worker_load(in_filename, workerrec, cmovies, ratings_table_def_fk):
     c = workerrec['conn']
     screateq = "CREATE TABLE ratings {}".format(ratings_table_def_fk)
-    load_data = "COPY INTO ratings FROM '{}' USING DELIMITERS 
',','\n'".format(in_filename)
+    load_data = "COPY INTO ratings FROM r'{}' USING DELIMITERS 
',','\n'".format(in_filename)
     c.execute(cmovies)
     c.execute(screateq)
     c.execute(load_data)
@@ -95,10 +95,10 @@ with tempfile.TemporaryDirectory() as tm
         c = supervisorconn.cursor()
 
         # Create the movies table and load the data
-        movies_filename=os.getenv("TSTDATAPATH")+"/netflix_data/movies.csv"
+        movies_filename = os.path.join(os.getenv("TSTDATAPATH"), 
"netflix_data", "movies.csv")
         movies_create = "CREATE TABLE movies {}".format(MOVIES_TABLE_DEF)
         c.execute(movies_create)
-        load_movies = "COPY INTO movies FROM '{}' USING DELIMITERS 
',','\n','\"'".format(movies_filename)
+        load_movies = "COPY INTO movies FROM r'{}' USING DELIMITERS 
',','\n','\"'".format(movies_filename)
         c.execute(load_movies)
 
         # Declare the ratings merge table on supervisor
@@ -106,7 +106,7 @@ with tempfile.TemporaryDirectory() as tm
         c.execute(mtable)
 
         # Create the workers and load the ratings data
-        
fn_template=os.getenv("TSTDATAPATH")+"/netflix_data/ratings_sample_{}.csv"
+        fn_template = os.path.join(os.getenv("TSTDATAPATH"), "netflix_data", 
"ratings_sample_{}.csv")
         cmovies = "CREATE REMOTE TABLE movies {} ON '{}' WITH USER 'monetdb' 
PASSWORD 'monetdb'".format(MOVIES_TABLE_DEF, supervisor_uri)
         try:
             create_workers(tmpdir, workers, fn_template, NWORKERS, cmovies, 
RATINGS_TABLE_DEF_FK)
diff --git a/sql/test/remote/Tests/different_user.SQL.py 
b/sql/test/remote/Tests/different_user.SQL.py
--- a/sql/test/remote/Tests/different_user.SQL.py
+++ b/sql/test/remote/Tests/different_user.SQL.py
@@ -51,7 +51,7 @@ def freeport():
 def worker_load(in_filename, workerrec, cmovies, ratings_table_def_fk):
     c = workerrec['conn']
     screateq = "CREATE TABLE ratings {}".format(ratings_table_def_fk)
-    load_data = "COPY INTO ratings FROM '{}' USING DELIMITERS 
',','\n'".format(in_filename)
+    load_data = "COPY INTO ratings FROM r'{}' USING DELIMITERS 
',','\n'".format(in_filename)
     c.execute(cmovies)
     c.execute(screateq)
     c.execute(load_data)
@@ -100,10 +100,10 @@ with tempfile.TemporaryDirectory() as TM
         c.execute("SET SCHEMA \"supervisor_schema\"")
 
         # Create the movies table and load the data
-        movies_filename=os.getenv("TSTDATAPATH")+"/netflix_data/movies.csv"
+        movies_filename = os.path.join(os.getenv("TSTDATAPATH"), 
"netflix_data", "movies.csv")
         movies_create = "CREATE TABLE movies {}".format(MOVIES_TABLE_DEF)
         c.execute(movies_create)
-        load_movies = "COPY INTO movies FROM '{}' USING DELIMITERS 
',','\n','\"'".format(movies_filename)
+        load_movies = "COPY INTO movies FROM r'{}' USING DELIMITERS 
',','\n','\"'".format(movies_filename)
         c.execute(load_movies)
 
         # Declare the ratings merge table on supervisor
@@ -111,7 +111,7 @@ with tempfile.TemporaryDirectory() as TM
         c.execute(mtable)
 
         # Create the workers and load the ratings data
-        
fn_template=os.getenv("TSTDATAPATH")+"/netflix_data/ratings_sample_{}.csv"
+        fn_template = os.path.join(os.getenv("TSTDATAPATH"), "netflix_data", 
"ratings_sample_{}.csv")
         cmovies = "CREATE REMOTE TABLE movies {} ON 
'{}/supervisor_schema/movies' WITH USER 'supervisor_user' PASSWORD 
'supervisor_pass'".format(MOVIES_TABLE_DEF, supervisor_uri)
         try:
             create_workers(TMPDIR, workers, fn_template, NWORKERS, cmovies, 
RATINGS_TABLE_DEF_FK)
diff --git a/sql/test/remote/Tests/invalid_creds.SQL.py 
b/sql/test/remote/Tests/invalid_creds.SQL.py
--- a/sql/test/remote/Tests/invalid_creds.SQL.py
+++ b/sql/test/remote/Tests/invalid_creds.SQL.py
@@ -52,7 +52,7 @@ def freeport():
 def worker_load(in_filename, workerrec, cmovies, ratings_table_def_fk):
     c = workerrec['conn']
     screateq = "CREATE TABLE ratings {}".format(ratings_table_def_fk)
-    load_data = "COPY INTO ratings FROM '{}' USING DELIMITERS 
',','\n'".format(in_filename)
+    load_data = "COPY INTO ratings FROM r'{}' USING DELIMITERS 
',','\n'".format(in_filename)
     c.execute(cmovies)
     c.execute(screateq)
     c.execute(load_data)
@@ -93,10 +93,10 @@ with tempfile.TemporaryDirectory() as TM
         c = supervisorconn.cursor()
 
         # Create the movies table and load the data
-        movies_filename=os.getenv("TSTDATAPATH")+"/netflix_data/movies.csv"
+        movies_filename = os.path.join(os.getenv("TSTDATAPATH"), 
"netflix_data", "movies.csv")
         movies_create = "CREATE TABLE movies {}".format(MOVIES_TABLE_DEF)
         c.execute(movies_create)
-        load_movies = "COPY INTO movies FROM '{}' USING DELIMITERS 
',','\n','\"'".format(movies_filename)
+        load_movies = "COPY INTO movies FROM r'{}' USING DELIMITERS 
',','\n','\"'".format(movies_filename)
         c.execute(load_movies)
 
         # Declare the ratings merge table on supervisor
@@ -104,7 +104,7 @@ with tempfile.TemporaryDirectory() as TM
         c.execute(mtable)
 
         # Create the workers and load the ratings data
-        
fn_template=os.getenv("TSTDATAPATH")+"/netflix_data/ratings_sample_{}.csv"
+        fn_template = os.path.join(os.getenv("TSTDATAPATH"), "netflix_data", 
"ratings_sample_{}.csv")
         cmovies = "CREATE REMOTE TABLE movies {} ON '{}' WITH USER 
'nonexistent' PASSWORD 'badpass'".format(MOVIES_TABLE_DEF, supervisor_uri)
         try:
             create_workers(TMPDIR, workers, fn_template, NWORKERS, cmovies, 
RATINGS_TABLE_DEF_FK)
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to