Skip to content

Commit a91633e

Browse files
Merge pull request #277 from mishaschwartz/v1.10.3
v1.10.3
2 parents 2b441f6 + 7cd09c3 commit a91633e

File tree

14 files changed

+33
-16
lines changed

14 files changed

+33
-16
lines changed

.dockerfiles/entrypoint-dev.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
if [ ! -f "${HOME}/.installed" ]; then
6-
/app/bin/install.sh -p '3.8' --docker --all-testers
6+
/app/bin/install.sh -p '3.9' --docker --all-testers
77

88
echo "export REDIS_URL=${REDIS_URL}
99
export PGHOST=${PGHOST}

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ python:
44
- "3.6"
55
- "3.7"
66
- "3.8"
7+
- "3.9"
78
# command to run tests
89
script:
910
- python setup.py test

Changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# CHANGELOG
22
All notable changes to this project will be documented here.
33

4+
## [v1.10.3]
5+
- Fix bug where zip archive was unpacked two levels deep instead of just one (#271)
6+
- Pass PGHOST and PGINFO environment variables to tests (#272)
7+
- Update to new version of markus-api that supports uploading binary files (#273)
8+
- Fix bug where environment variables were not string types (#274)
9+
- Add python3.9 as a tester option for the py and pyta testers, as well as the installer (#275)
10+
411
## [v1.10.2]
512
- Updated java tester to support configurable classpaths and source files (#268)
613

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ $ bin/install.sh [-p|--python-version python-version] [--non-interactive] [--doc
3939

4040
options:
4141

42-
- `--python_version` : version of python to install/use to run the autotester (default is 3.8).
42+
- `--python_version` : version of python to install/use to run the autotester (default is 3.9).
4343
- `--non-interactive` : run the installer in non-interactive mode (all confirmations will be accepted without prompting the user).
4444
- `--docker` : run the installer for installing in docker. This installs in non-interactive mode and iptables, postgresql debian packages will not be installed.
4545
- `--all-testers` : install all testers as well as the server. See [Testers](#testers).

bin/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ _check_python_version() {
2222
set_python_version() {
2323
# get the python version from the argument passed to this script or use python3.8 by default
2424
if [ -z "${PYTHON_VERSION}" ]; then
25-
PYTHON_VERSION=3.8
25+
PYTHON_VERSION=3.9
2626
else
2727
# check if both a major and minor version have been specified
2828
if [[ ${PYTHON_VERSION} != $(echo "${PYTHON_VERSION}" | grep -ow '^[0-9].[0-9]$') ]]; then

bin/uninstall.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ BINDIR=$(dirname ${THISSCRIPT})
147147
SERVERDIR=$(dirname ${BINDIR})
148148
TESTERSDIR=$(dirname ${SERVERDIR})/testers
149149
THISUSER=$(whoami)
150-
PYTHONVERSION="3.8"
150+
PYTHONVERSION="3.9"
151151

152152
SERVERUSER=$(get_config_param SERVER_USER)
153153
if [[ -n ${SERVERUSER} ]]; then

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
zip_safe=False,
1616
install_requires=[
1717
"redis==3.3.8",
18-
"requests==2.22.0",
1918
"rq==1.1.0",
2019
"supervisor==4.1.0",
2120
"PyYAML==5.1.2",
2221
"psycopg2-binary==2.8.4",
23-
"markusapi==0.1.1",
22+
"markusapi==0.2.0",
2423
"jsonschema==3.0.2",
2524
],
2625
tests_require=["pytest==5.3.1", "hypothesis==4.47.3", "fakeredis==1.1.0"],

src/autotester/resources/postgresql/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
POSTGRES_PREFIX = config["resources", "postgresql", "_prefix"]
1111
PGPASSFILE = os.path.join(config["workspace"], config["_workspace_contents", "_logs"], ".pgpass")
1212
PGHOST = config["resources", "postgresql", "host"]
13+
PGPORT = config["resources", "postgresql", "port"]
1314

1415

1516
def setup_database(test_username: str) -> Dict[str, str]:
@@ -27,7 +28,7 @@ def setup_database(test_username: str) -> Dict[str, str]:
2728
with open(PGPASSFILE) as f:
2829
password = f.read().strip()
2930

30-
with psycopg2.connect(database=database, user=user, password=password, host=PGHOST) as conn:
31+
with psycopg2.connect(database=database, user=user, password=password, host=PGHOST, port=PGPORT) as conn:
3132
with conn.cursor() as cursor:
3233
cursor.execute("DROP OWNED BY CURRENT_USER;")
3334
if test_username != user:
@@ -39,5 +40,7 @@ def setup_database(test_username: str) -> Dict[str, str]:
3940
"PGDATABASE": database,
4041
"PGPASSWORD": password,
4142
"PGUSER": user,
43+
"PGHOST": PGHOST,
44+
"PGPORT": str(PGPORT),
4245
"AUTOTESTENV": "true",
4346
}

src/autotester/server/client_customizations/markus.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def write_student_files(self, destination: str) -> None:
3636
zip_content = self._api.get_files_from_repo(self.assignment_id, self.group_id, collected=collected)
3737
if zip_content is None:
3838
raise TestScriptFilesError("No test files found")
39-
extract_zip_stream(zip_content, destination, ignore_root_dirs=2)
39+
extract_zip_stream(zip_content, destination, ignore_root_dirs=1)
4040

4141
def send_test_results(self, results_data: Dict) -> None:
4242
""" Send test results to the client """
@@ -73,7 +73,7 @@ def upload_feedback_to_repo(self, feedback_file: str) -> None:
7373
Upload the feedback file to the group's repo.
7474
"""
7575
if os.path.isfile(feedback_file):
76-
with open(feedback_file) as feedback_open:
76+
with open(feedback_file, 'rb') as feedback_open:
7777
self._api.upload_file_to_repo(
7878
self.assignment_id, self.group_id, os.path.basename(feedback_file), feedback_open.read()
7979
)
@@ -83,7 +83,7 @@ def upload_feedback_file(self, feedback_file: str) -> None:
8383
Upload the feedback file using MarkUs' api.
8484
"""
8585
if os.path.isfile(feedback_file):
86-
with open(feedback_file) as feedback_open:
86+
with open(feedback_file, 'rb') as feedback_open:
8787
self._api.upload_feedback_file(
8888
self.assignment_id, self.group_id, os.path.basename(feedback_file), feedback_open.read()
8989
)

src/autotester/testers/py/lib/sql_helper.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ def connection(*args, **kwargs):
4040
"database": os.environ.get("PGDATABASE"),
4141
"password": os.environ.get("PGPASSWORD"),
4242
"user": os.environ.get("PGUSER"),
43-
"host": "localhost",
43+
"host": os.environ.get("PGHOST"),
44+
"port": os.environ.get("PGPORT")
4445
}
4546
return _unmockable_psycopg2_connect(*args, **kwargs)
4647

@@ -99,7 +100,9 @@ def execute_psql_file(
99100
*args: str,
100101
database: Optional[str] = None,
101102
password: Optional[str] = None,
102-
user: Optional[str] = None
103+
user: Optional[str] = None,
104+
host: Optional[str] = None,
105+
port: Optional[str] = None,
103106
) -> subprocess.CompletedProcess:
104107
"""
105108
Return a CompletedProcess object returned after calling:
@@ -140,6 +143,8 @@ def execute_psql_file(
140143
"PGUSER": user or os.environ.get("PGUSER"),
141144
"PGPASSWORD": password or os.environ.get("PGPASSWORD"),
142145
"PGDATABASE": database or os.environ.get("PGDATABASE"),
146+
"PGHOST": host or os.environ.get("PGHOST"),
147+
"PGPORT": port or os.environ.get("PGPORT")
143148
}
144149
env = {**os.environ, **db_vars}
145150
return subprocess.run(["psql", "-f", filename] + list(args), env=env, capture_output=True)

0 commit comments

Comments
 (0)