test_native_upload.py is failing with a no-op PR: https://github.com/gdcc/python-dvuploader/pull/37
Why? :thinking:
I wonder if it's related to this:
allow for tag replacement #11359
I am also puzzled, it is working fine locally with the latest 6.7 release, but it fails in the CI.
I'm trying to run it locally. Need poetry set up first: #python > poetry not working for python-dvuploader
It seems like either the directoryLabel is not passed correctly or something is failing on the DV-side
You can use pip install -e . as well
From within a venv, right? That is, I'll run python -m venv venv first, right?
Yes, you can use the venv in that case
Hmm, I ranpip install -e . but I'm getting this:
% python -m pytest -v
/Users/PDurbin/github/gdcc/python-dvuploader/venv/bin/python: No module named pytest
So I ran pip install pytest. But now I'm getting this:
% python -m pytest -v
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: --cov=dvuploader
inifile: /Users/PDurbin/github/gdcc/python-dvuploader/pyproject.toml
rootdir: /Users/PDurbin/github/gdcc/python-dvuploader
Sorry, since you are not using poetry you need to install the test-dependencies first:
pip install pytest-cov pytest-asyncio pytest-httpx
Will add this to the Readme to prevent confusion :slight_smile:
Thanks, I can run python -m pytest -v now.
I can replicate the error:
===================================== short test summary info =====================================
FAILED tests/integration/test_native_upload.py::TestNativeUpload::test_native_upload_by_handler - AssertionError: Directory label does not match for file {"description": "", "label": "file.txt", "restricted": false, "version": 1, "datasetVersionId": 4, "categories": ["DATA"], "dataFile": {"id": 16, "persistentId": "", "filename": "file.txt", "contentType": "text/plain", "friendlyType": "Plain Text", "filesize": 13, "description": "", "categories": ["DATA"], "storageIdentifier": "local://198c79fc9ca-f998aa3fe2fa", "rootDataFileId": -1, "md5": "65a8e27d8879283831b664bd8b7f0ad4", "checksum": {"type": "MD5", "value": "65a8e27d8879283831b664bd8b7f0ad4"}, "tabularData": false, "creationDate": "2025-08-20", "lastUpdateTime": "2025-08-20T13:16:35Z", "fileAccessRequest": false}}
assert '' == 'subdir'
- subdir
====================== 1 failed, 33 passed, 13 warnings in 107.59s (0:01:47) ======================
I created an issue: https://github.com/gdcc/python-dvuploader/issues/39
@Jan Range what if you delete your local "unstable" image and re-download it? Can you reproduce the problem then?
Good idea! Will try it after our meeting :slight_smile:
I was able to reproduce the error :slight_smile: Will give it a deeper dive asap
Nice! It's only a matter of time now!
My money is on something that changed on the backend. :grimacing:
But we'll see, I guess!
Philip Durbin π said:
I'm trying to run it locally. Need poetry set up first: #python > poetry not working for python-dvuploader
This part is resolved.
export $(grep "API_TOKEN" "dv/bootstrap.exposed.env") doesn't work for me. From https://github.com/gdcc/python-dvuploader#running-tests-locally
Nothing there:
pdurbin@beamish python-dvuploader % file dv/bootstrap.exposed.env
dv/bootstrap.exposed.env: directory
pdurbin@beamish python-dvuploader % ls -al dv/bootstrap.exposed.env
total 0
drwxr-xr-x 2 pdurbin staff 64 Sep 18 16:01 .
drwxr-xr-x 4 pdurbin staff 128 Sep 18 16:01 ..
pdurbin@beamish python-dvuploader %
Am I missing something? :thinking:
The Docker compose should actually expose the .env from which you can grab the token. Did this change?
buh, not sure
Is there supposed to be a .env file in that directory?
I think this is the way the GitHub Action makes it possible to grab the token. In the compose within dvuploader the corresponding directory is exposed:
volumes:
- ${PWD}/dv/data:/dv
- ${PWD}:/secrets
Maybe it has changed and is not exposed anymore. If so, the Readme should be changed to manually add the token to the env.
That's what I did last time. I manually grabbed the API token.
I think this is more stable and straight forward
I created an issue: https://github.com/gdcc/python-dvuploader/issues/41
Here's where Oliver Bertuch added saving the targetEnvFile: https://github.com/IQSS/dataverse/pull/9935
Right, here's more of the config:
volumes:
- ${PWD}/dv/bootstrap.exposed.env:/.env
command:
- sh
- -c
- "bootstrap.sh -e /.env dev"
File /.env not found, is a directory or not writeable
I think that explains it :point_of_information:
Not sure what the fix is though :thinking:
% python3 -m pytest -v
/opt/homebrew/opt/python@3.13/bin/python3.13: No module named pytest
Should poetry have installed pytest for me? :thinking:
Did you run the installation with poetry install --with test?
yep!
Okay, I guess the terminal python is not using the poetry env. In the CI I am using poetry run pytest, which should use the correct environment.
yes! working! do you want a PR?
That would be awesome! ![]()
here you go: https://github.com/gdcc/python-dvuploader/pull/42
Thanks :slight_smile:
I can reproduce the failure: fail.txt
I think this is old news, though. You were able to reproduce it too, if memory serves.
That is good news
And so was I, a while ago: https://github.com/gdcc/python-dvuploader/issues/39
I just wasn't using poetry back then.
I was looking into this too today, but I am still puzzled what the source problem is. FYI: in the non-direct upload, files are zipped and uploaded for efficiency. When inspecting the Zip that is sent, it correctly contains the directory structure. Even so, when I upload the archive using python-dvuploader, the directory labels are fine.
I think that the last step, which updates the metadata of each file could cause the problem. Will comment that part out and see if it overwrites the directory labels in some way.
I have also cross-checked with DVCLI, which also supports uploading entire directories as zip, but there everything is fine.
Ok, cool. We suspect something changed upstream, right? In Dataverse itself, I mean.
It could be, havent changed that part of the code. Maybe sending None as directory label removes it, which may not happened in previous versions.
Let's see, you're using DATAVERSE_IMAGE=docker.io/gdcc/dataverse:unstable
Let's take a look at 6.8 (unreleased) at https://preview.guides.gdcc.io/en/develop/api/changelog.html
Okay nice, that explains it!
Will try it now
I noticed that while writing the release notes the other day (#community > Release 6.8 Timeline)
This is the 6.8 PR by the way: File Metadata Update - Empty values clear fields #11439
Fixed it!
Nice! ![]()
The File class directory label defaults to empty literals, causing the metadata update to clear out the directory label all the time. I have now added an explicit check to only include the directory label when it is non-empty.
Perfect. I suppose the PR should close this issue: https://github.com/gdcc/python-dvuploader/issues/39
So awesome, thanks for the help!
I will open a PR
Oh sure :smile:
Once we fix this we can get back to the contributors, who first let us know about it. :sweat_smile:
Poor things. Failing tests weren't their fault! :upside_down:
True that, all those red x's are nerve wracking :smile:
I guess this is the main one to follow up on, from bnavigator: https://github.com/gdcc/python-dvuploader/pull/34
But I'm getting ahead of myself :smile:
I will mention his PR in mine and notify him to merge the main branch into his PR, once the fix has been merged
Done https://github.com/gdcc/python-dvuploader/pull/43
Great work. You've even merged his PR already. We can probably resolve this topic. :tada:
Last updated: Nov 01 2025 at 14:11 UTC