Skip to content

Commit

Permalink
TMP
Browse files Browse the repository at this point in the history
  • Loading branch information
mih committed Feb 23, 2023
1 parent 72d98fe commit 0b48cae
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 82 deletions.
156 changes: 78 additions & 78 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,84 +70,84 @@ environment:
INSTALL_GITANNEX: git-annex -m snapshot
CODECOV_BINARY: https://uploader.codecov.io/latest/linux/codecov
DEPLOY_HTTPBIN: yes
# Windows core tests
- ID: WinP39core
# ~35 min
DTS: datalad_next
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
# Python version specification is non-standard on windows
PY: 39-x64
INSTALL_GITANNEX: git-annex -m datalad/packages
# MacOS core tests
- ID: MacP38core
DTS: datalad_next
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
PY: 3.8
INSTALL_GITANNEX: git-annex
DATALAD_LOCATIONS_SOCKETS: /Users/appveyor/DLTMP/sockets
CODECOV_BINARY: https://uploader.codecov.io/latest/macos/codecov

# run a subset of the core tests on the oldest supported Python version
- ID: CORE1
DTS: >
datalad.cli
datalad.core
# do not run tests that ensure behavior we intentionally changed
# - test_gh1811: is included in next in an alternative implementation
KEYWORDS: not test_gh1811
APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
PY: 3.7
INSTALL_SYSPKGS: python3-virtualenv
# datalad-annex git remote needs something after git-annex_8.20211x
INSTALL_GITANNEX: git-annex -m snapshot
CODECOV_BINARY: https://uploader.codecov.io/latest/linux/codecov
- ID: CORE2
DTS: >
datalad.customremotes
datalad.dataset
datalad.distributed
datalad.downloaders
datalad.interface
# do not run tests that ensure behavior we intentionally changed
# - test_gh1811: is included in next in an alternative implementation
KEYWORDS: not test_gh1811
APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
PY: 3.7
INSTALL_SYSPKGS: python3-virtualenv
# datalad-annex git remote needs something after git-annex_8.20211x
INSTALL_GITANNEX: git-annex -m snapshot
CODECOV_BINARY: https://uploader.codecov.io/latest/linux/codecov
- ID: CORE3
DTS: >
datalad.distribution
KEYWORDS: not test_invalid_args
APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
PY: 3.7
INSTALL_SYSPKGS: python3-virtualenv
# datalad-annex git remote needs something after git-annex_8.20211x
INSTALL_GITANNEX: git-annex -m snapshot
CODECOV_BINARY: https://uploader.codecov.io/latest/linux/codecov
- ID: CORE4
DTS: >
datalad.local
APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
PY: 3.7
INSTALL_SYSPKGS: python3-virtualenv
# datalad-annex git remote needs something after git-annex_8.20211x
INSTALL_GITANNEX: git-annex -m snapshot
CODECOV_BINARY: https://uploader.codecov.io/latest/linux/codecov
- ID: CORE5
DTS: >
datalad.runner
datalad.support
datalad.tests
datalad.ui
APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
PY: 3.7
INSTALL_SYSPKGS: python3-virtualenv
# datalad-annex git remote needs something after git-annex_8.20211x
INSTALL_GITANNEX: git-annex -m snapshot
CODECOV_BINARY: https://uploader.codecov.io/latest/linux/codecov
# # Windows core tests
# - ID: WinP39core
# # ~35 min
# DTS: datalad_next
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
# # Python version specification is non-standard on windows
# PY: 39-x64
# INSTALL_GITANNEX: git-annex -m datalad/packages
# # MacOS core tests
# - ID: MacP38core
# DTS: datalad_next
# APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
# PY: 3.8
# INSTALL_GITANNEX: git-annex
# DATALAD_LOCATIONS_SOCKETS: /Users/appveyor/DLTMP/sockets
# CODECOV_BINARY: https://uploader.codecov.io/latest/macos/codecov
#
# # run a subset of the core tests on the oldest supported Python version
# - ID: CORE1
# DTS: >
# datalad.cli
# datalad.core
# # do not run tests that ensure behavior we intentionally changed
# # - test_gh1811: is included in next in an alternative implementation
# KEYWORDS: not test_gh1811
# APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
# PY: 3.7
# INSTALL_SYSPKGS: python3-virtualenv
# # datalad-annex git remote needs something after git-annex_8.20211x
# INSTALL_GITANNEX: git-annex -m snapshot
# CODECOV_BINARY: https://uploader.codecov.io/latest/linux/codecov
# - ID: CORE2
# DTS: >
# datalad.customremotes
# datalad.dataset
# datalad.distributed
# datalad.downloaders
# datalad.interface
# # do not run tests that ensure behavior we intentionally changed
# # - test_gh1811: is included in next in an alternative implementation
# KEYWORDS: not test_gh1811
# APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
# PY: 3.7
# INSTALL_SYSPKGS: python3-virtualenv
# # datalad-annex git remote needs something after git-annex_8.20211x
# INSTALL_GITANNEX: git-annex -m snapshot
# CODECOV_BINARY: https://uploader.codecov.io/latest/linux/codecov
# - ID: CORE3
# DTS: >
# datalad.distribution
# KEYWORDS: not test_invalid_args
# APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
# PY: 3.7
# INSTALL_SYSPKGS: python3-virtualenv
# # datalad-annex git remote needs something after git-annex_8.20211x
# INSTALL_GITANNEX: git-annex -m snapshot
# CODECOV_BINARY: https://uploader.codecov.io/latest/linux/codecov
# - ID: CORE4
# DTS: >
# datalad.local
# APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
# PY: 3.7
# INSTALL_SYSPKGS: python3-virtualenv
# # datalad-annex git remote needs something after git-annex_8.20211x
# INSTALL_GITANNEX: git-annex -m snapshot
# CODECOV_BINARY: https://uploader.codecov.io/latest/linux/codecov
# - ID: CORE5
# DTS: >
# datalad.runner
# datalad.support
# datalad.tests
# datalad.ui
# APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004
# PY: 3.7
# INSTALL_SYSPKGS: python3-virtualenv
# # datalad-annex git remote needs something after git-annex_8.20211x
# INSTALL_GITANNEX: git-annex -m snapshot
# CODECOV_BINARY: https://uploader.codecov.io/latest/linux/codecov

matrix:
allow_failures:
Expand Down
13 changes: 10 additions & 3 deletions datalad_next/commands/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ def __init__(self):
param_constraints=dict(
action=EnsureChoice(*credential_actions),
dataset=EnsureDataset(
# we do not actually require it
installed=None,
# if given, it must also exist as a source for
# configuration items and/or credentials
installed=True,
purpose='manage credentials',
),
name=EnsureStr(),
prompt=EnsureStr(),
),
validate_defaults=('dataset',),
# order in joint_constraints is relevant!
joint_constraints={
ParameterConstraintContext(('action', 'name', 'spec'),
Expand Down Expand Up @@ -296,7 +296,12 @@ class Credentials(ValidatedInterface):
def __call__(action='query', spec=None, *, name=None, prompt=None,
dataset=None):
# which config manager to use: global or from dataset
# It makes no sense to work with a non-existing dataset's config,
# due to https://github.com/datalad/datalad/issues/7299
# so the `dataset` validator must not run for the default value
# ``None``
cfg = dataset.ds.config if dataset else dlcfg
print("HAVEGLOBALCFG", cfg == dlcfg, dataset if not dataset else dataset.ds.is_installed())

credman = CredentialManager(cfg)

Expand All @@ -322,6 +327,7 @@ def __call__(action='query', spec=None, *, name=None, prompt=None,
**_prefix_result_keys(updated if updated else spec),
)
elif action == 'get':
print("CREDMANGET", repr(name), repr(prompt), repr(spec))
cred = credman.get(name=name, _prompt=prompt, **spec)
if not cred:
yield get_status_dict(
Expand All @@ -331,6 +337,7 @@ def __call__(action='query', spec=None, *, name=None, prompt=None,
message='credential not found',
)
else:
print("CREDMANGOT", repr(cred))
yield get_status_dict(
action='credentials',
status='ok',
Expand Down
16 changes: 15 additions & 1 deletion datalad_next/commands/tests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,23 @@ def test_download_no_credential_leak_to_http(capsys):
# after download, it asks for a name
'dataladtest_test_download_new_bearer_token',
])
def test_download_new_bearer_token(capsys):
def test_download_new_bearer_token(memory_keyring, capsys):
try:
download({f'{hbsurl}/bearer': '-'})
import os
import pathlib
from datalad_next.credman import CredentialManager
print("WTF===================================")
print(memory_keyring.store)
print(os.environ['GIT_CONFIG_GLOBAL'])
print(pathlib.Path(os.environ['GIT_CONFIG_GLOBAL']).read_text())
print(CredentialManager().get('dataladtest_test_download_new_bearer_token'))
print(credentials('get', name='dataladtest_test_download_new_bearer_token'))
from datalad import cfg
cfg.reload(force=False)
print('UNFORCED', credentials('get', name='dataladtest_test_download_new_bearer_token'))
cfg.reload(force=True)
print('FORCED', credentials('get', name='dataladtest_test_download_new_bearer_token'))
# and it was saved under this name
assert_result_count(
credentials(
Expand Down

0 comments on commit 0b48cae

Please sign in to comment.