Skip to content

Commit fc54d87

Browse files
authored
refactor: remove bok-choy and replace xblockutils with xblock.utils
1 parent 9fde65e commit fc54d87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+51
-4670
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,12 @@ concurrency:
1515
jobs:
1616
tests:
1717
runs-on: ${{ matrix.os }}
18-
services:
19-
# Using SQLite3 for integration tests throws `django.db.utils.OperationalError: database table is locked: workbench_xblockstate`.
20-
mysql:
21-
image: mysql:8
22-
env:
23-
MYSQL_ROOT_PASSWORD: rootpw
24-
ports:
25-
- 3307:3306
2618
strategy:
2719
fail-fast: false
2820
matrix:
2921
os: [ubuntu-20.04]
3022
python-version: [3.8]
31-
toxenv: [py38-django32, py38-django42, integration-django32, integration-django42, quality, translations-django32, translations-django42]
23+
toxenv: [py38-django32, py38-django42, quality, translations-django32, translations-django42]
3224

3325
steps:
3426
- name: checkout repo
@@ -41,13 +33,6 @@ jobs:
4133
with:
4234
python-version: ${{ matrix.python-version }}
4335

44-
# `libgtk2.0-0` and `libxt6` are required by an older version of Firefox.
45-
- name: Install Required System Packages
46-
if: ${{ startsWith(matrix.toxenv, 'integration') }}
47-
run: |
48-
sudo apt-get update
49-
sudo apt-get install -y libxmlsec1-dev ubuntu-restricted-extras xvfb libxml2-dev libxslt-dev libevent-dev libgtk2.0-0 libxt6
50-
5136
- name: Install translations dependencies
5237
if: ${{ startsWith(matrix.toxenv, 'translations') }}
5338
run: |

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ coverage.xml
4444
# Translations
4545
*.pot
4646

47-
# Integration test output:
47+
# test output:
4848
/*.log
4949
/tests.*.png
5050
var/*
@@ -58,5 +58,3 @@ target/
5858
# IDEs
5959
.idea
6060
.idea/*
61-
62-
test_helpers/

Changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ Drag and Drop XBlock changelog
44
Unreleased
55
---------------------------
66

7+
Version 3.3.0 (2023-10-24)
8+
---------------------------
9+
10+
* Removed xblock-utils package
11+
* Replace `xblockutils.*` imports with `xblock.utils.*`. The old imports are used as a fallback for compatibility with older releases.
12+
* Removed bok-choy package along with all integration tests.
13+
14+
715
Version 3.2.2 (2023-10-19)
816
---------------------------
917

Makefile

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.PHONY: clean help compile_translations dummy_translations extract_translations detect_changed_source_translations \
22
build_dummy_translations validate_translations pull_translations push_translations check_translations_up_to_date \
3-
install_firefox requirements selfcheck test test.python test.unit test.quality upgrade mysql
3+
requirements selfcheck test test.python test.unit test.quality upgrade
44

55
.DEFAULT_GOAL := help
66

@@ -11,8 +11,6 @@ EXTRACTED_DJANGO_PARTIAL := $(EXTRACT_DIR)/django-partial.po
1111
EXTRACTED_DJANGOJS_PARTIAL := $(EXTRACT_DIR)/djangojs-partial.po
1212
EXTRACTED_DJANGO := $(EXTRACT_DIR)/django.po
1313

14-
FIREFOX_VERSION := "43.0"
15-
1614
help: ## display this help message
1715
@echo "Please use \`make <target>' where <target> is one of"
1816
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}'
@@ -62,36 +60,26 @@ push_translations: ## push translations to transifex
6260

6361
check_translations_up_to_date: extract_translations compile_translations dummy_translations detect_changed_source_translations ## extract, compile, and check if translation files are up-to-date
6462

65-
install_firefox:
66-
@mkdir -p test_helpers
67-
@test -f ./test_helpers/firefox/firefox && echo "Firefox already installed." || \
68-
(cd test_helpers && \
69-
wget -N "https://archive.mozilla.org/pub/firefox/releases/$(FIREFOX_VERSION)/linux-x86_64/en-US/firefox-$(FIREFOX_VERSION).tar.bz2" && \
70-
tar -xjf firefox-$(FIREFOX_VERSION).tar.bz2)
71-
7263
piptools: ## install pinned version of pip-compile and pip-sync
7364
pip install -r requirements/pip.txt
7465
pip install -r requirements/pip-tools.txt
7566

7667
requirements: piptools ## install test requirements locally
7768
pip-sync requirements/ci.txt
7869

79-
requirements_python: install_firefox piptools ## install all requirements locally
70+
requirements_python: piptools ## install all requirements locally
8071
pip-sync requirements/dev.txt requirements/private.*
8172

8273
test.quality: selfcheck ## run quality checkers on the codebase
8374
tox -e quality
8475

85-
test.python: ## run python unit and integration tests
86-
PATH=test_helpers/firefox:$$PATH xvfb-run python run_tests.py $(TEST)
76+
test.python: ## run python unit tests in the local virtualenv
77+
pytest --cov drag_and_drop_v2 $(TEST)
8778

8879
test.unit: ## run all unit tests
89-
tox -- $(TEST)
80+
tox $(TEST)
9081

91-
test.integration: ## run all integration tests
92-
tox -e integration -- $(TEST)
93-
94-
test: test.unit test.integration test.quality ## Run all tests
82+
test: test.unit test.quality ## Run all tests
9583
tox -e translations
9684

9785
# Define PIP_COMPILE_OPTS=-v to get more information during make upgrade.
@@ -108,14 +96,9 @@ upgrade: ## update the requirements/*.txt files with the latest packages satisfy
10896
$(PIP_COMPILE) -o requirements/base.txt requirements/base.in
10997
$(PIP_COMPILE) -o requirements/test.txt requirements/test.in
11098
$(PIP_COMPILE) -o requirements/quality.txt requirements/quality.in
111-
$(PIP_COMPILE) -o requirements/workbench.txt requirements/workbench.in
11299
$(PIP_COMPILE) -o requirements/ci.txt requirements/ci.in
113100
$(PIP_COMPILE) -o requirements/dev.txt requirements/dev.in
114101
sed -i '/^[dD]jango==/d' requirements/test.txt
115-
sed -i '/^[dD]jango==/d' requirements/workbench.txt
116-
117-
mysql: ## run mysql database for integration tests
118-
docker run --rm -it --name mysql -p 3307:3306 -e MYSQL_ROOT_PASSWORD=rootpw -e MYSQL_DATABASE=db mysql:8
119102

120103
selfcheck: ## check that the Makefile is well-formed
121104
@echo "The Makefile is well-formed."

README.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,6 @@ Inside a fresh virtualenv, `cd` into the root folder of this repository
465465
$ make requirements
466466
```
467467

468-
To run integration tests, you need to start MySQL first:
469-
```bash
470-
$ make mysql
471-
```
472468

473469
You can then run the entire test suite via:
474470

@@ -480,7 +476,6 @@ To run specific test groups, use one of the following commands:
480476

481477
```bash
482478
$ make test.unit
483-
$ make test.integration
484479
$ make test.quality
485480
$ make test.translations
486481
```
@@ -490,21 +485,15 @@ To run individual unit tests, use:
490485
```bash
491486
$ make test.unit TEST=tests/unit/test_basics.py::BasicTests::test_student_view_data
492487
```
493-
To run individual integration tests, use:
494-
495-
```bash
496-
$ make test.integration TEST=tests.integration.test_studio.TestStudio.test_custom_image
497-
```
498488

499489
Manual testing (without tox)
500490
----------------------------
501491

502492
To run tests without tox, use:
503493

504494
```bash
505-
$ make mysql
506495
$ make requirements_python
507-
$ make test.python TEST=tests.unit.test_basics.BasicTests.test_student_view_data
496+
$ make test.python TEST=tests/unit/test_basics.py::BasicTests::test_student_view_data
508497
```
509498

510499

drag_and_drop_v2/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
""" Drag and Drop v2 XBlock """
22
from .drag_and_drop_v2 import DragAndDropBlock
33

4-
__version__ = "3.2.2"
4+
__version__ = "3.3.0"

drag_and_drop_v2/drag_and_drop_v2.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@
2323
from xblock.exceptions import JsonHandlerError
2424
from xblock.fields import Boolean, Dict, Float, Integer, Scope, String
2525
from xblock.scorable import ScorableXBlockMixin, Score
26+
try:
27+
from xblock.utils.resources import ResourceLoader
28+
from xblock.utils.settings import ThemableXBlockMixin, XBlockWithSettingsMixin
29+
except ModuleNotFoundError: # For backward compatibility with releases older than Quince.
30+
from xblockutils.resources import ResourceLoader
31+
from xblockutils.settings import ThemableXBlockMixin, XBlockWithSettingsMixin
2632
from web_fragments.fragment import Fragment
27-
from xblockutils.resources import ResourceLoader
28-
from xblockutils.settings import ThemableXBlockMixin, XBlockWithSettingsMixin
2933

3034
from .compat import get_grading_ignore_decoys_waffle_flag
3135
from .default_data import DEFAULT_DATA

requirements/base.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
django-statici18n
55
bleach[css]
6-
xblock-utils
6+
XBlock[django]

requirements/base.txt

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ asgiref==3.7.2
1010
# via django
1111
bleach[css]==6.1.0
1212
# via -r requirements/base.in
13-
boto3==1.28.68
13+
boto3==1.28.69
1414
# via fs-s3fs
15-
botocore==1.31.68
15+
botocore==1.31.69
1616
# via
1717
# boto3
1818
# s3transfer
@@ -42,9 +42,7 @@ lazy==1.6
4242
lxml==4.9.3
4343
# via xblock
4444
mako==1.2.4
45-
# via
46-
# xblock
47-
# xblock-utils
45+
# via xblock
4846
markupsafe==2.1.3
4947
# via
5048
# mako
@@ -64,9 +62,7 @@ pyyaml==6.0.1
6462
s3transfer==0.7.0
6563
# via boto3
6664
simplejson==3.19.2
67-
# via
68-
# xblock
69-
# xblock-utils
65+
# via xblock
7066
six==1.16.0
7167
# via
7268
# bleach
@@ -82,18 +78,14 @@ typing-extensions==4.8.0
8278
urllib3==1.26.18
8379
# via botocore
8480
web-fragments==2.1.0
85-
# via
86-
# xblock
87-
# xblock-utils
81+
# via xblock
8882
webencodings==0.5.1
8983
# via
9084
# bleach
9185
# tinycss2
9286
webob==1.8.7
9387
# via xblock
9488
xblock[django]==1.8.1
95-
# via xblock-utils
96-
xblock-utils==4.0.0
9789
# via -r requirements/base.in
9890

9991
# The following packages are considered to be unsafe in a requirements file:

requirements/ci.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ tox==3.28.0
2929
# tox-battery
3030
tox-battery==0.6.2
3131
# via -r requirements/ci.in
32-
virtualenv==20.24.5
32+
virtualenv==20.24.6
3333
# via tox

requirements/dev.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@
44
-r pip-tools.txt # pip-tools and its dependencies, for managing requirements files
55
-r quality.txt # Core and quality check dependencies
66
-r ci.txt # dependencies for setting up testing in CI
7-
-r workbench.txt # workbench dependencies

0 commit comments

Comments
 (0)