instance_id
stringlengths 10
57
| base_commit
stringlengths 40
40
| created_at
stringdate 2016-04-05 08:28:29
2025-03-31 17:49:59
| environment_setup_commit
stringlengths 40
40
| hints_text
stringlengths 0
196k
| patch
stringlengths 261
213k
| problem_statement
stringlengths 33
51.5k
| repo
stringlengths 7
52
| test_patch
stringlengths 283
997k
| meta
dict | version
stringclasses 590
values | install_config
dict | requirements
stringlengths 96
34.2k
| environment
stringlengths 810
20.5k
| FAIL_TO_PASS
listlengths 1
2.36k
| FAIL_TO_FAIL
listlengths 0
589
| PASS_TO_PASS
listlengths 0
2.98k
| PASS_TO_FAIL
listlengths 0
25
| license_name
stringclasses 43
values | __index_level_0__
int64 492
21.3k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Azure__azure-cli-2467
|
d79710730933432d2c8ccd722d31fbbf75845ce0
|
2017-03-11 06:05:00
|
eb12ac454cbe1ddb59c86cdf2045e1912660e750
|
codecov-io: # [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2467?src=pr&el=h1) Report
> Merging [#2467](https://codecov.io/gh/Azure/azure-cli/pull/2467?src=pr&el=desc) into [master](https://codecov.io/gh/Azure/azure-cli/commit/d79710730933432d2c8ccd722d31fbbf75845ce0?src=pr&el=desc) will **increase** coverage by `0.01%`.
> The diff coverage is `n/a`.
```diff
@@ Coverage Diff @@
## master #2467 +/- ##
==========================================
+ Coverage 72.44% 72.45% +0.01%
==========================================
Files 362 362
Lines 19547 19547
Branches 2865 2865
==========================================
+ Hits 14160 14162 +2
+ Misses 4475 4472 -3
- Partials 912 913 +1
```
| [Impacted Files](https://codecov.io/gh/Azure/azure-cli/pull/2467?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...zure-cli-vm/azure/cli/command_modules/vm/custom.py](https://codecov.io/gh/Azure/azure-cli/compare/d79710730933432d2c8ccd722d31fbbf75845ce0...47b28ad2c4278b0ec927820cf60d22de1d63b596?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktdm0vYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy92bS9jdXN0b20ucHk=) | `74.5% <ø> (+0.22%)` | :white_check_mark: |
| [...dback/azure/cli/command_modules/feedback/custom.py](https://codecov.io/gh/Azure/azure-cli/compare/d79710730933432d2c8ccd722d31fbbf75845ce0...47b28ad2c4278b0ec927820cf60d22de1d63b596?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktZmVlZGJhY2svYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy9mZWVkYmFjay9jdXN0b20ucHk=) | `34.69% <0%> (ø)` | :white_check_mark: |
| [src/azure-cli-core/azure/cli/core/_util.py](https://codecov.io/gh/Azure/azure-cli/compare/d79710730933432d2c8ccd722d31fbbf75845ce0...47b28ad2c4278b0ec927820cf60d22de1d63b596?src=pr&el=tree#diff-c3JjL2F6dXJlLWNsaS1jb3JlL2F6dXJlL2NsaS9jb3JlL191dGlsLnB5) | `66.66% <0%> (ø)` | :white_check_mark: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2467?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2467?src=pr&el=footer). Last update [d797107...47b28ad](https://codecov.io/gh/Azure/azure-cli/compare/d79710730933432d2c8ccd722d31fbbf75845ce0...47b28ad2c4278b0ec927820cf60d22de1d63b596?src=pr&el=footer&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
|
diff --git a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_help.py b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_help.py
index 3df308105..bcff81d87 100644
--- a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_help.py
+++ b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_help.py
@@ -160,7 +160,7 @@ helps['feature'] = """
helps['group'] = """
type: group
- short-summary: Manage resource groups.
+ short-summary: Manage resource groups and template deployments.
"""
helps['group exists'] = """
diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py
index da2c20927..22e31d7a2 100644
--- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py
+++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py
@@ -1291,7 +1291,9 @@ def get_vmss_instance_view(resource_group_name, vm_scale_set_name, instance_id=N
if instance_id:
if instance_id == '*':
return client.virtual_machine_scale_set_vms.list(resource_group_name,
- vm_scale_set_name)
+ vm_scale_set_name,
+ select='instanceView',
+ expand='instanceView')
else:
return client.virtual_machine_scale_set_vms.get_instance_view(resource_group_name,
vm_scale_set_name,
|
az vmss get-instance-view returns model view when specifying all VMs
If you run the following to get the instance view for all VMs in a scale set:
```
az vmss get-instance-view -g rgname -n vmssname --instance-id \*
```
CLI does:
```
requests.packages.urllib3.connectionpool : https://management.azure.com:443 "GET /subscriptions/<subid>/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/vmssname/virtualMachines?api-version=2016-04-30-preview”
```
which returns the model view for all VMs.
It should be doing:
```
requests.packages.urllib3.connectionpool : https://management.azure.com:443 "GET /subscriptions/<subid>/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachineScaleSets/vmssname/virtualMachines?$expand=instanceView&$select=instanceView&api-version=2016-04-30-preview”
```
The instance-view command works fine if you just query one VM.
|
Azure/azure-cli
|
diff --git a/src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py b/src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py
index 54809d1d5..b6ff5ac31 100644
--- a/src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py
+++ b/src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py
@@ -14,7 +14,7 @@ from azure.cli.command_modules.vm.custom import (_get_access_extension_upgrade_i
_LINUX_ACCESS_EXT,
_WINDOWS_ACCESS_EXT)
from azure.cli.command_modules.vm.custom import \
- (attach_unmanaged_data_disk, detach_data_disk)
+ (attach_unmanaged_data_disk, detach_data_disk, get_vmss_instance_view)
from azure.cli.command_modules.vm.disk_encryption import enable, disable
from azure.mgmt.compute.models import (NetworkProfile, StorageProfile, DataDisk, OSDisk,
OperatingSystemTypes, InstanceViewStatus,
@@ -196,6 +196,17 @@ class Test_Vm_Custom(unittest.TestCase):
mock_vm_set.assert_called_once_with(vm)
self.assertEqual(len(vm.storage_profile.data_disks), 0)
+ @mock.patch('azure.cli.command_modules.vm.custom._compute_client_factory')
+ def test_show_vmss_instance_view(self, factory_mock):
+ vm_client = mock.MagicMock()
+ factory_mock.return_value = vm_client
+
+ # execute
+ get_vmss_instance_view('rg1', 'vmss1', '*')
+ # assert
+ vm_client.virtual_machine_scale_set_vms.list.assert_called_once_with('rg1', 'vmss1', expand='instanceView',
+ select='instanceView')
+
# pylint: disable=line-too-long
@mock.patch('azure.cli.command_modules.vm.disk_encryption._compute_client_factory', autospec=True)
@mock.patch('azure.cli.command_modules.vm.disk_encryption._get_keyvault_key_url', autospec=True)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 2
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "python scripts/dev_setup.py",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.5",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
adal==0.4.3
applicationinsights==0.10.0
argcomplete==1.8.0
astroid==1.4.9
attrs==22.2.0
autopep8==1.2.4
azure-batch==2.0.0
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli&subdirectory=src/azure-cli
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_core&subdirectory=src/azure-cli-core
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_datalake&subdirectory=src/command_modules/azure-cli-datalake
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_documentdb&subdirectory=src/command_modules/azure-cli-documentdb
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_find&subdirectory=src/command_modules/azure-cli-find
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_testsdk&subdirectory=src/azure-cli-testsdk
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_utility_automation&subdirectory=scripts
-e git+https://github.com/Azure/azure-cli.git@d79710730933432d2c8ccd722d31fbbf75845ce0#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm
azure-common==1.1.4
azure-core==1.24.2
azure-datalake-store==0.0.5
azure-graphrbac==0.30.0rc6
azure-keyvault==0.1.0
azure-mgmt-authorization==0.30.0rc6
azure-mgmt-batch==3.0.0
azure-mgmt-compute==0.33.1rc1
azure-mgmt-containerregistry==0.1.1
azure-mgmt-datalake-analytics==0.1.3
azure-mgmt-datalake-nspkg==3.0.1
azure-mgmt-datalake-store==0.1.3
azure-mgmt-dns==1.0.0
azure-mgmt-documentdb==0.1.0
azure-mgmt-iothub==0.2.1
azure-mgmt-keyvault==0.30.0
azure-mgmt-network==0.30.0
azure-mgmt-nspkg==3.0.2
azure-mgmt-redis==1.0.0
azure-mgmt-resource==0.30.2
azure-mgmt-sql==0.3.1
azure-mgmt-storage==0.31.0
azure-mgmt-trafficmanager==0.30.0rc6
azure-mgmt-web==0.31.0
azure-nspkg==3.0.2
azure-storage==0.33.0
certifi==2021.5.30
cffi==1.15.1
colorama==0.3.7
coverage==4.2
cryptography==40.0.2
flake8==3.2.1
importlib-metadata==4.8.3
iniconfig==1.1.1
isodate==0.7.0
jeepney==0.7.1
jmespath==0.10.0
keyring==23.4.1
lazy-object-proxy==1.7.1
mccabe==0.5.3
mock==1.3.0
msrest==0.4.29
msrestazure==0.4.34
nose==1.3.7
oauthlib==3.2.2
packaging==21.3
paramiko==2.0.2
pbr==6.1.1
pep8==1.7.1
pluggy==1.0.0
py==1.11.0
pyasn1==0.5.1
pycodestyle==2.2.0
pycparser==2.21
pyflakes==1.3.0
Pygments==2.1.3
PyJWT==2.4.0
pylint==1.5.4
pyOpenSSL==16.1.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
PyYAML==3.11
requests==2.9.1
requests-oauthlib==2.0.0
scp==0.15.0
SecretStorage==3.3.3
six==1.10.0
sshtunnel==0.4.0
tabulate==0.7.5
tomli==1.2.3
typing-extensions==4.1.1
urllib3==1.16
vcrpy==1.10.3
Whoosh==2.7.4
wrapt==1.16.0
zipp==3.6.0
|
name: azure-cli
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- adal==0.4.3
- applicationinsights==0.10.0
- argcomplete==1.8.0
- astroid==1.4.9
- attrs==22.2.0
- autopep8==1.2.4
- azure-batch==2.0.0
- azure-common==1.1.4
- azure-core==1.24.2
- azure-datalake-store==0.0.5
- azure-graphrbac==0.30.0rc6
- azure-keyvault==0.1.0
- azure-mgmt-authorization==0.30.0rc6
- azure-mgmt-batch==3.0.0
- azure-mgmt-compute==0.33.1rc1
- azure-mgmt-containerregistry==0.1.1
- azure-mgmt-datalake-analytics==0.1.3
- azure-mgmt-datalake-nspkg==3.0.1
- azure-mgmt-datalake-store==0.1.3
- azure-mgmt-dns==1.0.0
- azure-mgmt-documentdb==0.1.0
- azure-mgmt-iothub==0.2.1
- azure-mgmt-keyvault==0.30.0
- azure-mgmt-network==0.30.0
- azure-mgmt-nspkg==3.0.2
- azure-mgmt-redis==1.0.0
- azure-mgmt-resource==0.30.2
- azure-mgmt-sql==0.3.1
- azure-mgmt-storage==0.31.0
- azure-mgmt-trafficmanager==0.30.0rc6
- azure-mgmt-web==0.31.0
- azure-nspkg==3.0.2
- azure-storage==0.33.0
- cffi==1.15.1
- colorama==0.3.7
- coverage==4.2
- cryptography==40.0.2
- flake8==3.2.1
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- isodate==0.7.0
- jeepney==0.7.1
- jmespath==0.10.0
- keyring==23.4.1
- lazy-object-proxy==1.7.1
- mccabe==0.5.3
- mock==1.3.0
- msrest==0.4.29
- msrestazure==0.4.34
- nose==1.3.7
- oauthlib==3.2.2
- packaging==21.3
- paramiko==2.0.2
- pbr==6.1.1
- pep8==1.7.1
- pip==9.0.1
- pluggy==1.0.0
- py==1.11.0
- pyasn1==0.5.1
- pycodestyle==2.2.0
- pycparser==2.21
- pyflakes==1.3.0
- pygments==2.1.3
- pyjwt==2.4.0
- pylint==1.5.4
- pyopenssl==16.1.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pyyaml==3.11
- requests==2.9.1
- requests-oauthlib==2.0.0
- scp==0.15.0
- secretstorage==3.3.3
- setuptools==30.4.0
- six==1.10.0
- sshtunnel==0.4.0
- tabulate==0.7.5
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.16
- vcrpy==1.10.3
- whoosh==2.7.4
- wrapt==1.16.0
- zipp==3.6.0
prefix: /opt/conda/envs/azure-cli
|
[
"src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py::Test_Vm_Custom::test_show_vmss_instance_view"
] |
[] |
[
"src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py::Test_Vm_Custom::test_attach_existing_datadisk_on_vm",
"src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py::Test_Vm_Custom::test_attach_new_datadisk_custom_on_vm",
"src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py::Test_Vm_Custom::test_attach_new_datadisk_default_on_vm",
"src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py::Test_Vm_Custom::test_deattach_disk_on_vm",
"src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py::Test_Vm_Custom::test_disable_boot_diagnostics_on_vm",
"src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py::Test_Vm_Custom::test_disable_encryption_error_cases_handling",
"src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py::Test_Vm_Custom::test_enable_boot_diagnostics_on_vm_never_enabled",
"src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py::Test_Vm_Custom::test_enable_boot_diagnostics_skip_when_enabled_already",
"src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py::Test_Vm_Custom::test_enable_encryption_error_cases_handling",
"src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py::Test_Vm_Custom::test_get_access_extension_upgrade_info",
"src/command_modules/azure-cli-vm/tests/test_custom_vm_commands.py::Test_Vm_Custom::test_merge_secrets"
] |
[] |
MIT License
| 1,078 |
cherrypy__cherrypy-1578
|
8c635f55c3634b722260fef501ee49fb440be3ac
|
2017-03-11 14:37:20
|
2c5643367147bae270e83dfba25c1897f37dbe18
|
codacy-bot:
 Here is an overview of what got changed by this pull request:
```diff
Complexity increasing per file
==============================
- cherrypy/_cperror.py 8
```
See the complete overview on [Codacy](https://www.codacy.com/app/cherrypy/cherrypy/pullRequest?prid=554915&bid=4292032)
mar10: Concerning the tests, it would go something like
```py
class RedirectApp(object):
def index(self, **kwargs):
raise cherrypy.HTTPRedirect("example.com?redir=<script>alert(1);</script>")
index.exposed = True
cherrypy.quickstart(RedirectApp())
```
and
```py
import requests
res = requests.get("http://127.0.0.1:8080?redir=<abc>", allow_redirects=False)
assert res.status_code == 303
assert '<' not in res.content
```
But I don't know where and how to add it.
webknjaz: Regarding tests, please check [`cherrypy/test/test_request_obj.py`](https://github.com/cherrypy/cherrypy/blob/master/cherrypy/test/test_request_obj.py), I don't see tests for 3xx status codes, but it should be relatively easy to add them there :)
P.S. Please note `getPage()`, `assertStatus()` and `assertBody()` helpers.
mar10: Looking at the code I would not consider this change harmful and we already invested quite a bit of time on this one-liner ;)
But I'll see what I can do (may take a while until I find time though).
|
diff --git a/cherrypy/_cperror.py b/cherrypy/_cperror.py
index 6c952e91..b597c645 100644
--- a/cherrypy/_cperror.py
+++ b/cherrypy/_cperror.py
@@ -271,7 +271,7 @@ class HTTPRedirect(CherryPyException):
307: 'This resource has moved temporarily to ',
}[status]
msg += '<a href=%s>%s</a>.'
- msgs = [msg % (saxutils.quoteattr(u), u) for u in self.urls]
+ msgs = [msg % (saxutils.quoteattr(u), escape_html(u)) for u in self.urls]
response.body = ntob('<br />\n'.join(msgs), 'utf-8')
# Previous code may have set C-L, so we have to reset it
# (allow finalize to set it).
|
Encode URLs in redirect responses
* **I'm submitting a ...**
[x] bug report
[ ] feature request
[ ] question about the decisions made in the repository
* **What is the current behavior?**
The standard response page for 30x errors contains the target URL as `href` as well as clear text.
* **What is the expected behavior?**
Even though browsers *mostly* will not display the result, but redirect instead, you never know:
Any input from unknown sources should be html-escaped.
* **Please tell us about your environment:**
CherryPy 3.8 until 10.1
|
cherrypy/cherrypy
|
diff --git a/cherrypy/test/test_core.py b/cherrypy/test/test_core.py
index 2e590a9d..f16efd58 100644
--- a/cherrypy/test/test_core.py
+++ b/cherrypy/test/test_core.py
@@ -150,6 +150,9 @@ class CoreRequestHandlingTest(helper.CPWebCase):
def url_with_quote(self):
raise cherrypy.HTTPRedirect("/some\"url/that'we/want")
+ def url_with_xss(self):
+ raise cherrypy.HTTPRedirect("/some<script>alert(1);</script>url/that'we/want")
+
def url_with_unicode(self):
raise cherrypy.HTTPRedirect(ntou('тест', 'utf-8'))
@@ -435,6 +438,13 @@ class CoreRequestHandlingTest(helper.CPWebCase):
self.assertStatus(303)
assertValidXHTML()
+ def test_redirect_with_xss(self):
+ """A redirect to a URL with HTML injected should result in page contents escaped."""
+ self.getPage('/redirect/url_with_xss')
+ self.assertStatus(303)
+ assert b'<script>' not in self.body
+ assert b'<script>' in self.body
+
def test_redirect_with_unicode(self):
"""
A redirect to a URL with Unicode should return a Location
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
10.2
|
{
"env_vars": null,
"env_yml_path": [],
"install": "pip install -e .[testing]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "",
"pip_packages": [],
"pre_install": [],
"python": "3.9",
"reqs_path": [],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
backports.unittest-mock==1.5.1
cheroot==10.0.1
-e git+https://github.com/cherrypy/cherrypy.git@8c635f55c3634b722260fef501ee49fb440be3ac#egg=CherryPy
coverage==7.8.0
exceptiongroup==1.2.2
iniconfig==2.1.0
jaraco.functools==4.1.0
more-itertools==10.6.0
nose==1.3.7
nose-testconfig==0.10
objgraph==3.6.2
packaging==24.2
pluggy==1.5.0
portend==3.2.0
pytest==8.3.5
python-dateutil==2.9.0.post0
six==1.17.0
tempora==5.8.0
tomli==2.2.1
|
name: cherrypy
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- backports-unittest-mock==1.5.1
- cheroot==10.0.1
- coverage==7.8.0
- exceptiongroup==1.2.2
- iniconfig==2.1.0
- jaraco-functools==4.1.0
- more-itertools==10.6.0
- nose==1.3.7
- nose-testconfig==0.10
- objgraph==3.6.2
- packaging==24.2
- pluggy==1.5.0
- portend==3.2.0
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- six==1.17.0
- tempora==5.8.0
- tomli==2.2.1
prefix: /opt/conda/envs/cherrypy
|
[
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_redirect_with_xss"
] |
[] |
[
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testCookies",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testDefaultContentType",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testFavicon",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testFlatten",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testRanges",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testRedirect",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testSlashes",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testStatus",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_InternalRedirect",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_cherrypy_url",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_expose_decorator",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_multiple_headers",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_on_end_resource_status",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_redirect_with_unicode",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_gc",
"cherrypy/test/test_core.py::ErrorTests::test_contextmanager",
"cherrypy/test/test_core.py::ErrorTests::test_start_response_error",
"cherrypy/test/test_core.py::ErrorTests::test_gc",
"cherrypy/test/test_core.py::TestBinding::test_bind_ephemeral_port"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 1,080 |
scrapy__scrapy-2649
|
cfb56400b29316a43208053a8ef6d48eb0eb499e
|
2017-03-13 14:15:42
|
dfe6d3d59aa3de7a96c1883d0f3f576ba5994aa9
|
diff --git a/scrapy/logformatter.py b/scrapy/logformatter.py
index e7bf7942e..075a6d862 100644
--- a/scrapy/logformatter.py
+++ b/scrapy/logformatter.py
@@ -43,6 +43,8 @@ class LogFormatter(object):
'request_flags' : request_flags,
'referer': referer_str(request),
'response_flags': response_flags,
+ # backward compatibility with Scrapy logformatter below 1.4 version
+ 'flags': response_flags
}
}
|
After adding request flags subclasses of logformatter that rely on 'flags' format string are broken
#2082 added flags to request but it also renamed formatting string key from flags to response_flags/request_flags
```
CRAWLEDMSG = u"Crawled (%(status)s) %(request)s (referer: %(referer)s)%(flags)s"
+CRAWLEDMSG = u"Crawled (%(status)s) %(request)s%(request_flags)s (referer: %(referer)s)%(response_flags)s"
```
Scrapy allows you to override logformatter and this is what I have in my project. I have logformatter looking rouhgly like this
```python
# dirbot/logf.py
from scrapy.logformatter import LogFormatter
class CustomLogFormatter(LogFormatter):
def crawled(self, request, response, spider):
kwargs = super(CustomLogFormatter, self).crawled(
request, response, spider)
kwargs['msg'] = (
u"Crawled (%(status)s) %(request)s "
u"(referer: %(referer)s, latency: %(latency).2f s)%(flags)s"
)
kwargs['args']['latency'] = response.meta.get('download_latency', 0)
return kwargs
```
now if you enable it in settings `LOG_FORMATTER = 'dirbot.logf.CustomLogFormatter'
` and try to run it with recent master you'll get KeyError
```
2017-03-13 14:15:26 [scrapy.extensions.telnet] DEBUG: Telnet console listening on 127.0.0.1:6023
Traceback (most recent call last):
File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
msg = self.format(record)
File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
return fmt.format(record)
File "/usr/lib/python2.7/logging/__init__.py", line 464, in format
record.message = record.getMessage()
File "/usr/lib/python2.7/logging/__init__.py", line 328, in getMessage
msg = msg % self.args
KeyError: u'flags'
Logged from file engine.py, line 238
Traceback (most recent call last):
File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
msg = self.format(record)
File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
return fmt.format(record)
File "/usr/lib/python2.7/logging/__init__.py", line 464, in format
record.message = record.getMessage()
File "/usr/lib/python2.7/logging/__init__.py", line 328, in getMessage
msg = msg % self.args
KeyError: u'flags'
Logged from file engine.py, line 238
2017-03-13 14:15:27 [scrapy.core.scraper] DEBUG: Scraped from <200 http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/>
```
So this change that renamed `flags` to `response_flags/request_flags` seems backward incompatible.
|
scrapy/scrapy
|
diff --git a/tests/test_logformatter.py b/tests/test_logformatter.py
index 11fe7b653..94e6c9fde 100644
--- a/tests/test_logformatter.py
+++ b/tests/test_logformatter.py
@@ -64,5 +64,30 @@ class LoggingContribTest(unittest.TestCase):
assert all(isinstance(x, six.text_type) for x in lines)
self.assertEqual(lines, [u"Scraped from <200 http://www.example.com>", u'name: \xa3'])
+
+class LogFormatterSubclass(LogFormatter):
+ def crawled(self, request, response, spider):
+ kwargs = super(LogFormatterSubclass, self).crawled(
+ request, response, spider)
+ CRAWLEDMSG = (
+ u"Crawled (%(status)s) %(request)s (referer: "
+ u"%(referer)s)%(flags)s"
+ )
+ return {
+ 'level': kwargs['level'],
+ 'msg': CRAWLEDMSG,
+ 'args': kwargs['args']
+ }
+
+
+class LogformatterSubclassTest(LoggingContribTest):
+ def setUp(self):
+ self.formatter = LogFormatterSubclass()
+ self.spider = Spider('default')
+
+ def test_flags_in_request(self):
+ pass
+
+
if __name__ == "__main__":
unittest.main()
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 1
}
|
1.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==25.3.0
Automat==24.8.1
cffi==1.17.1
constantly==23.10.4
coverage==7.8.0
cryptography==44.0.2
cssselect==1.3.0
exceptiongroup==1.2.2
execnet==2.1.1
hyperlink==21.0.0
idna==3.10
incremental==24.7.2
iniconfig==2.1.0
jmespath==1.0.1
lxml==5.3.1
packaging==24.2
parsel==1.10.0
pluggy==1.5.0
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
PyDispatcher==2.0.7
pyOpenSSL==25.0.0
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
queuelib==1.7.0
-e git+https://github.com/scrapy/scrapy.git@cfb56400b29316a43208053a8ef6d48eb0eb499e#egg=Scrapy
service-identity==24.2.0
six==1.17.0
tomli==2.2.1
Twisted==24.11.0
typing_extensions==4.13.0
w3lib==2.3.1
zope.interface==7.2
|
name: scrapy
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==25.3.0
- automat==24.8.1
- cffi==1.17.1
- constantly==23.10.4
- coverage==7.8.0
- cryptography==44.0.2
- cssselect==1.3.0
- exceptiongroup==1.2.2
- execnet==2.1.1
- hyperlink==21.0.0
- idna==3.10
- incremental==24.7.2
- iniconfig==2.1.0
- jmespath==1.0.1
- lxml==5.3.1
- packaging==24.2
- parsel==1.10.0
- pluggy==1.5.0
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pydispatcher==2.0.7
- pyopenssl==25.0.0
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- queuelib==1.7.0
- service-identity==24.2.0
- six==1.17.0
- tomli==2.2.1
- twisted==24.11.0
- typing-extensions==4.13.0
- w3lib==2.3.1
- zope-interface==7.2
prefix: /opt/conda/envs/scrapy
|
[
"tests/test_logformatter.py::LogformatterSubclassTest::test_crawled"
] |
[] |
[
"tests/test_logformatter.py::LoggingContribTest::test_crawled",
"tests/test_logformatter.py::LoggingContribTest::test_dropped",
"tests/test_logformatter.py::LoggingContribTest::test_flags_in_request",
"tests/test_logformatter.py::LoggingContribTest::test_scraped",
"tests/test_logformatter.py::LogformatterSubclassTest::test_dropped",
"tests/test_logformatter.py::LogformatterSubclassTest::test_flags_in_request",
"tests/test_logformatter.py::LogformatterSubclassTest::test_scraped"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 1,085 |
|
dpkp__kafka-python-1029
|
899f11730db5f209c03cfad20111ec131ee4c70b
|
2017-03-13 17:32:28
|
618c5051493693c1305aa9f08e8a0583d5fcf0e3
|
diff --git a/kafka/consumer/group.py b/kafka/consumer/group.py
index f2b1699..32f4556 100644
--- a/kafka/consumer/group.py
+++ b/kafka/consumer/group.py
@@ -819,7 +819,7 @@ class KafkaConsumer(six.Iterator):
Returns:
set: {topic, ...}
"""
- return self._subscription.subscription
+ return self._subscription.subscription.copy()
def unsubscribe(self):
"""Unsubscribe from all topics and clear all assigned partitions."""
|
KafkaConsumer.subscribe() should return copy
When calling ``consumer.subscription()`` a reference to the internal ``set()`` object ``self._subscription.subscription`` is returned.
If that is modified (eg to add a new topic) and then passed to ``consumer.subscribe(topics)`` then ``SubscriptionState.change_subscription`` will hit ``subscription unchanged by change_subscription`` and therefor not call ``self._group_subscription.update``.
It should not be so easy to modify the internal state of the ``SubscriptionState`` therefor consumer.subscription() should return a copy of ``self._subscription.subscription``
Example code, that does not work as expected:
```
consumer = KafkaConsumer()
topics = consumer.subscription()
topics.add('new-topic')
consumer.subscribe(topics) # Will log that subscription is unchanged
```
|
dpkp/kafka-python
|
diff --git a/test/test_consumer.py b/test/test_consumer.py
index 073a3af..e5dd946 100644
--- a/test/test_consumer.py
+++ b/test/test_consumer.py
@@ -24,6 +24,14 @@ class TestKafkaConsumer(unittest.TestCase):
with self.assertRaises(KafkaConfigurationError):
KafkaConsumer(bootstrap_servers='localhost:9092', fetch_max_wait_ms=41000, request_timeout_ms=40000)
+ def test_subscription_copy(self):
+ consumer = KafkaConsumer('foo', api_version=(0, 10))
+ sub = consumer.subscription()
+ assert sub is not consumer.subscription()
+ assert sub == set(['foo'])
+ sub.add('fizz')
+ assert consumer.subscription() == set(['foo'])
+
class TestMultiProcessConsumer(unittest.TestCase):
@unittest.skipIf(sys.platform.startswith('win'), 'test mocking fails on windows')
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 1
}
|
1.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-catchlog",
"pytest-sugar",
"pytest-mock",
"mock",
"python-snappy",
"lz4tools",
"xxhash"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc libsnappy-dev"
],
"python": "3.6",
"reqs_path": [
"docs/requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
attrs==22.2.0
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
cramjam==2.5.0
docutils==0.18.1
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==3.0.3
-e git+https://github.com/dpkp/kafka-python.git@899f11730db5f209c03cfad20111ec131ee4c70b#egg=kafka_python
lz4tools==1.3.1.2
MarkupSafe==2.0.1
mock==5.2.0
packaging==21.3
pluggy==1.0.0
pockets==0.9.1
py==1.11.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytest-catchlog==1.2.2
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-sugar==0.9.6
python-snappy==0.7.3
pytz==2025.2
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-napoleon==0.7
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
termcolor==1.1.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
xxhash==3.2.0
zipp==3.6.0
|
name: kafka-python
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- attrs==22.2.0
- babel==2.11.0
- charset-normalizer==2.0.12
- coverage==6.2
- cramjam==2.5.0
- docutils==0.18.1
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- jinja2==3.0.3
- lz4tools==1.3.1.2
- markupsafe==2.0.1
- mock==5.2.0
- packaging==21.3
- pluggy==1.0.0
- pockets==0.9.1
- py==1.11.0
- pygments==2.14.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-catchlog==1.2.2
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-sugar==0.9.6
- python-snappy==0.7.3
- pytz==2025.2
- requests==2.27.1
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==5.3.0
- sphinx-rtd-theme==2.0.0
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-napoleon==0.7
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- termcolor==1.1.0
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- xxhash==3.2.0
- zipp==3.6.0
prefix: /opt/conda/envs/kafka-python
|
[
"test/test_consumer.py::TestKafkaConsumer::test_subscription_copy"
] |
[] |
[
"test/test_consumer.py::TestKafkaConsumer::test_fetch_max_wait_larger_than_request_timeout_raises",
"test/test_consumer.py::TestKafkaConsumer::test_non_integer_partitions",
"test/test_consumer.py::TestKafkaConsumer::test_session_timeout_larger_than_request_timeout_raises",
"test/test_consumer.py::TestMultiProcessConsumer::test_partition_list",
"test/test_consumer.py::TestSimpleConsumer::test_simple_consumer_commit_does_not_raise",
"test/test_consumer.py::TestSimpleConsumer::test_simple_consumer_failed_payloads",
"test/test_consumer.py::TestSimpleConsumer::test_simple_consumer_leader_change",
"test/test_consumer.py::TestSimpleConsumer::test_simple_consumer_reset_partition_offset",
"test/test_consumer.py::TestSimpleConsumer::test_simple_consumer_unknown_topic_partition"
] |
[] |
Apache License 2.0
| 1,086 |
|
asottile__pyupgrade-9
|
47f2b57f4b8ea963617199885ff46e0af7e63e45
|
2017-03-13 22:27:20
|
c5f1eb3fd850fc793cd0208cc449f3be5718f052
|
diff --git a/pyupgrade.py b/pyupgrade.py
index d2a6990..eafc8a3 100644
--- a/pyupgrade.py
+++ b/pyupgrade.py
@@ -46,6 +46,7 @@ def unparse_parsed_string(parsed):
UNIMPORTANT_WS = 'UNIMPORTANT_WS'
+NON_CODING_TOKENS = frozenset(('COMMENT', 'NL', UNIMPORTANT_WS))
Token = collections.namedtuple(
'Token', ('name', 'src', 'line', 'utf8_byte_offset'),
)
@@ -145,7 +146,7 @@ def _fix_format_literals(contents_text):
to_replace.append((string_start, string_end))
string_start, string_end, seen_dot = None, None, False
# NL is the non-breaking newline token
- elif token.name not in ('COMMENT', 'NL', UNIMPORTANT_WS):
+ elif token.name not in NON_CODING_TOKENS:
string_start, string_end, seen_dot = None, None, False
for start, end in reversed(to_replace):
@@ -291,6 +292,13 @@ def _get_victims(tokens, start, arg):
i += 1
+ # May need to remove a trailing comma
+ i -= 2
+ while tokens[i].name in NON_CODING_TOKENS:
+ i -= 1
+ if tokens[i].src == ',':
+ ends = sorted(set(ends + [i]))
+
return Victims(starts, ends, first_comma_index, arg_index)
|
SyntaxError rewriting dict(thing,) or set(thing,) (trailing comma)
For example
```python
>>> set(x for x in range(1),)
{0}
>>> {x for x in range(1),}
File "<stdin>", line 1
{x for x in range(1),}
^
SyntaxError: invalid syntax
```
|
asottile/pyupgrade
|
diff --git a/tests/pyupgrade_test.py b/tests/pyupgrade_test.py
index b2ff30f..7b48712 100644
--- a/tests/pyupgrade_test.py
+++ b/tests/pyupgrade_test.py
@@ -130,6 +130,17 @@ def test_roundtrip_tokenize(filename):
# Remove trailing commas on inline things
('set((1,))', '{1}'),
('set((1, ))', '{1}'),
+ # Remove trailing commas after things
+ ('set([1, 2, 3,],)', '{1, 2, 3}'),
+ ('set(x for x in y,)', '{x for x in y}'),
+ (
+ 'set(\n'
+ ' x for x in y,\n'
+ ')',
+ '{\n'
+ ' x for x in y\n'
+ '}',
+ ),
),
)
def test_sets(s, expected):
@@ -167,6 +178,25 @@ def test_sets(s, expected):
),
# This doesn't get fixed by autopep8 and can cause a syntax error
('dict((a, b)for a, b in y)', '{a: b for a, b in y}'),
+ # Need to remove trailing commas on the element
+ (
+ 'dict(\n'
+ ' (\n'
+ ' a,\n'
+ ' b,\n'
+ ' )\n'
+ ' for a, b in y\n'
+ ')',
+ # Ideally, this'll go through some other formatting tool before
+ # being committed. Shrugs!
+ '{\n'
+ ' \n'
+ ' a:\n'
+ ' b\n'
+ ' \n'
+ ' for a, b in y\n'
+ '}',
+ ),
),
)
def test_dictcomps(s, expected):
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 1
}
|
1.0
|
{
"env_vars": null,
"env_yml_path": [],
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [],
"python": "3.6",
"reqs_path": [
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
cfgv==3.3.1
coverage==6.2
distlib==0.3.9
filelock==3.4.1
flake8==5.0.4
identify==2.4.4
importlib-metadata==4.2.0
importlib-resources==5.2.3
iniconfig==1.1.1
mccabe==0.7.0
nodeenv==1.6.0
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
pre-commit==2.17.0
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
pyparsing==3.1.4
pytest==7.0.1
-e git+https://github.com/asottile/pyupgrade.git@47f2b57f4b8ea963617199885ff46e0af7e63e45#egg=pyupgrade
PyYAML==6.0.1
toml==0.10.2
tomli==1.2.3
typing_extensions==4.1.1
virtualenv==20.16.2
zipp==3.6.0
|
name: pyupgrade
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- cfgv==3.3.1
- coverage==6.2
- distlib==0.3.9
- filelock==3.4.1
- flake8==5.0.4
- identify==2.4.4
- importlib-metadata==4.2.0
- importlib-resources==5.2.3
- iniconfig==1.1.1
- mccabe==0.7.0
- nodeenv==1.6.0
- packaging==21.3
- platformdirs==2.4.0
- pluggy==1.0.0
- pre-commit==2.17.0
- py==1.11.0
- pycodestyle==2.9.1
- pyflakes==2.5.0
- pyparsing==3.1.4
- pytest==7.0.1
- pyyaml==6.0.1
- toml==0.10.2
- tomli==1.2.3
- typing-extensions==4.1.1
- virtualenv==20.16.2
- zipp==3.6.0
prefix: /opt/conda/envs/pyupgrade
|
[
"tests/pyupgrade_test.py::test_sets[set(\\n",
"tests/pyupgrade_test.py::test_dictcomps[dict(\\n"
] |
[] |
[
"tests/pyupgrade_test.py::test_roundtrip_text[]",
"tests/pyupgrade_test.py::test_roundtrip_text[foo]",
"tests/pyupgrade_test.py::test_roundtrip_text[{}]",
"tests/pyupgrade_test.py::test_roundtrip_text[{0}]",
"tests/pyupgrade_test.py::test_roundtrip_text[{named}]",
"tests/pyupgrade_test.py::test_roundtrip_text[{!r}]",
"tests/pyupgrade_test.py::test_roundtrip_text[{:>5}]",
"tests/pyupgrade_test.py::test_roundtrip_text[{{]",
"tests/pyupgrade_test.py::test_roundtrip_text[}}]",
"tests/pyupgrade_test.py::test_roundtrip_text[{0!s:15}]",
"tests/pyupgrade_test.py::test_intentionally_not_round_trip[{:}-{}]",
"tests/pyupgrade_test.py::test_intentionally_not_round_trip[{0:}-{0}]",
"tests/pyupgrade_test.py::test_intentionally_not_round_trip[{0!r:}-{0!r}]",
"tests/pyupgrade_test.py::test_tokenize_src_simple",
"tests/pyupgrade_test.py::test_roundtrip_tokenize[testing/resources/empty.py]",
"tests/pyupgrade_test.py::test_roundtrip_tokenize[testing/resources/unicode_snowman.py]",
"tests/pyupgrade_test.py::test_roundtrip_tokenize[testing/resources/backslash_continuation.py]",
"tests/pyupgrade_test.py::test_sets[set()-set()]",
"tests/pyupgrade_test.py::test_sets[set((\\n))-set((\\n))]",
"tests/pyupgrade_test.py::test_sets[set",
"tests/pyupgrade_test.py::test_sets[set(())-set()]",
"tests/pyupgrade_test.py::test_sets[set([])-set()]",
"tests/pyupgrade_test.py::test_sets[set((",
"tests/pyupgrade_test.py::test_sets[set((1,",
"tests/pyupgrade_test.py::test_sets[set([1,",
"tests/pyupgrade_test.py::test_sets[set(x",
"tests/pyupgrade_test.py::test_sets[set([x",
"tests/pyupgrade_test.py::test_sets[set((x",
"tests/pyupgrade_test.py::test_sets[set(((1,",
"tests/pyupgrade_test.py::test_sets[set((a,",
"tests/pyupgrade_test.py::test_sets[set([(1,",
"tests/pyupgrade_test.py::test_sets[set([((1,",
"tests/pyupgrade_test.py::test_sets[set((((1,",
"tests/pyupgrade_test.py::test_sets[set(\\n(1,",
"tests/pyupgrade_test.py::test_sets[set((\\n1,\\n2,\\n))\\n-{\\n1,\\n2,\\n}\\n]",
"tests/pyupgrade_test.py::test_sets[set((frozenset(set((1,",
"tests/pyupgrade_test.py::test_sets[set((1,))-{1}]",
"tests/pyupgrade_test.py::test_dictcomps[x",
"tests/pyupgrade_test.py::test_dictcomps[dict()-dict()]",
"tests/pyupgrade_test.py::test_dictcomps[(-(]",
"tests/pyupgrade_test.py::test_dictcomps[dict",
"tests/pyupgrade_test.py::test_dictcomps[dict((a,",
"tests/pyupgrade_test.py::test_dictcomps[dict([a,",
"tests/pyupgrade_test.py::test_dictcomps[dict(((a,",
"tests/pyupgrade_test.py::test_dictcomps[dict([(a,",
"tests/pyupgrade_test.py::test_dictcomps[dict(((a),",
"tests/pyupgrade_test.py::test_dictcomps[dict((k,",
"tests/pyupgrade_test.py::test_format_literals['{}'.format(1)-'{}'.format(1)]",
"tests/pyupgrade_test.py::test_format_literals['{'.format(1)-'{'.format(1)]",
"tests/pyupgrade_test.py::test_format_literals['}'.format(1)-'}'.format(1)]",
"tests/pyupgrade_test.py::test_format_literals[x",
"tests/pyupgrade_test.py::test_format_literals['{0}'.format(1)-'{}'.format(1)]",
"tests/pyupgrade_test.py::test_format_literals['''{0}\\n{1}\\n'''.format(1,",
"tests/pyupgrade_test.py::test_format_literals['{0}'",
"tests/pyupgrade_test.py::test_format_literals[print(\\n",
"tests/pyupgrade_test.py::test_imports_unicode_literals[import",
"tests/pyupgrade_test.py::test_imports_unicode_literals[from",
"tests/pyupgrade_test.py::test_imports_unicode_literals[x",
"tests/pyupgrade_test.py::test_imports_unicode_literals[\"\"\"docstring\"\"\"\\nfrom",
"tests/pyupgrade_test.py::test_unicode_literals[(-False-(]",
"tests/pyupgrade_test.py::test_unicode_literals[u''-False-u'']",
"tests/pyupgrade_test.py::test_unicode_literals[u''-True-'']",
"tests/pyupgrade_test.py::test_unicode_literals[from",
"tests/pyupgrade_test.py::test_unicode_literals[\"\"\"with",
"tests/pyupgrade_test.py::test_main_trivial",
"tests/pyupgrade_test.py::test_main_noop",
"tests/pyupgrade_test.py::test_main_changes_a_file",
"tests/pyupgrade_test.py::test_main_syntax_error",
"tests/pyupgrade_test.py::test_main_non_utf8_bytes",
"tests/pyupgrade_test.py::test_py3_only_argument_unicode_literals"
] |
[] |
MIT License
| 1,089 |
|
networkx__networkx-2386
|
464bf8fc08ffa09cfd0183fb5cae1adfe6839e12
|
2017-03-14 15:36:14
|
3f4fd85765bf2d88188cfd4c84d0707152e6cd1e
|
diff --git a/networkx/algorithms/bipartite/matching.py b/networkx/algorithms/bipartite/matching.py
index 85f40a6eb..20a26f222 100644
--- a/networkx/algorithms/bipartite/matching.py
+++ b/networkx/algorithms/bipartite/matching.py
@@ -300,7 +300,8 @@ def eppstein_matching(G, top_nodes=None):
recurse(v)
-def _is_connected_by_alternating_path(G, v, matching, targets):
+def _is_connected_by_alternating_path(G, v, matched_edges, unmatched_edges,
+ targets):
"""Returns True if and only if the vertex `v` is connected to one of
the target vertices by an alternating path in `G`.
@@ -314,65 +315,56 @@ def _is_connected_by_alternating_path(G, v, matching, targets):
`v` is a vertex in `G`.
- `matching` is a dictionary representing a maximum matching in `G`, as
- returned by, for example, :func:`maximum_matching`.
+ `matched_edges` is a set of edges present in a maximum matching in `G`.
+
+ `unmatched_edges` is a set of edges not present in a maximum
+ matching in `G`.
`targets` is a set of vertices.
"""
- # Get the set of matched edges and the set of unmatched edges. Only include
- # one version of each undirected edge (for example, include edge (1, 2) but
- # not edge (2, 1)).
- matched_edges = {(u, v) for u, v in matching.items() if u <= v}
- unmatched_edges = set(G.edges()) - matched_edges
-
- def _alternating_dfs(u, depth, along_matched=True):
+ def _alternating_dfs(u, along_matched=True):
"""Returns True if and only if `u` is connected to one of the
targets by an alternating path.
`u` is a vertex in the graph `G`.
- `depth` specifies the maximum recursion depth of the depth-first
- search.
-
If `along_matched` is True, this step of the depth-first search
will continue only through edges in the given matching. Otherwise, it
will continue only through edges *not* in the given matching.
"""
- # Base case 1: u is one of the target vertices. `u` is connected to one
- # of the target vertices by an alternating path of length zero.
- if u in targets:
- return True
- # Base case 2: we have exceeded are allowed depth. In this case, we
- # have looked at a path of length `n`, so looking any further won't
- # help.
- if depth < 0:
- return False
- # Determine which set of edges to look across.
- valid_edges = matched_edges if along_matched else unmatched_edges
- for v in G[u]:
- # Consider only those neighbors connected via a valid edge.
- if (u, v) in valid_edges or (v, u) in valid_edges:
- # Recursively perform a depth-first search starting from the
- # neighbor. Decrement the depth limit and switch which set of
- # vertices will be valid for next time.
- return _alternating_dfs(v, depth - 1, not along_matched)
- # If there are no more vertices to look through and we haven't yet
- # found a target vertex, simply say that no path exists.
+ if along_matched:
+ edges = itertools.cycle([matched_edges, unmatched_edges])
+ else:
+ edges = itertools.cycle([unmatched_edges, matched_edges])
+ visited = set()
+ stack = [(u, iter(G[u]), next(edges))]
+ while stack:
+ parent, children, valid_edges = stack[-1]
+ try:
+ child = next(children)
+ if child not in visited:
+ if ((parent, child) in valid_edges
+ or (child, parent) in valid_edges):
+ if child in targets:
+ return True
+ visited.add(child)
+ stack.append((child, iter(G[child]), next(edges)))
+ except StopIteration:
+ stack.pop()
return False
# Check for alternating paths starting with edges in the matching, then
# check for alternating paths starting with edges not in the
- # matching. Initiate the depth-first search with the current depth equal to
- # the number of nodes in the graph.
- return (_alternating_dfs(v, len(G), along_matched=True) or
- _alternating_dfs(v, len(G), along_matched=False))
+ # matching.
+ return (_alternating_dfs(v, along_matched=True) or
+ _alternating_dfs(v, along_matched=False))
def _connected_by_alternating_paths(G, matching, targets):
"""Returns the set of vertices that are connected to one of the target
- vertices by an alternating path in `G`.
+ vertices by an alternating path in `G` or are themselves a target.
An *alternating path* is a path in which every other edge is in the
specified maximum matching (and the remaining edges in the path are not in
@@ -388,9 +380,18 @@ def _connected_by_alternating_paths(G, matching, targets):
`targets` is a set of vertices.
"""
- # TODO This can be parallelized.
- return {v for v in G if _is_connected_by_alternating_path(G, v, matching,
- targets)}
+ # Get the set of matched edges and the set of unmatched edges. Only include
+ # one version of each undirected edge (for example, include edge (1, 2) but
+ # not edge (2, 1)). Using frozensets as an intermediary step we do not
+ # require nodes to be orderable.
+ edge_sets = {frozenset((u, v)) for u, v in matching.items()}
+ matched_edges = {tuple(edge) for edge in edge_sets}
+ unmatched_edges = {(u, v) for (u, v) in G.edges()
+ if frozenset((u, v)) not in edge_sets}
+
+ return {v for v in G if v in targets or
+ _is_connected_by_alternating_path(G, v, matched_edges,
+ unmatched_edges, targets)}
def to_vertex_cover(G, matching, top_nodes=None):
|
bipartite.to_vertex_cover() gives incorrect results
This program:
```python
import networkx as nx
print('Using version ' + nx.__version__)
G = nx.Graph([(0, 3), (1, 3), (1, 4), (2, 3)])
print('Edges: ' + repr(list(G.edges())))
assert nx.is_bipartite(G)
assert nx.is_connected(G)
matching = nx.bipartite.maximum_matching(G)
print('Matching: ' + repr(matching))
for u, v in matching.items():
assert matching[v] == u
vertex_cover = nx.bipartite.to_vertex_cover(G, matching)
print('Vertex cover: ' + repr(vertex_cover))
for u, v in G.edges():
assert u in vertex_cover or v in vertex_cover
```
produces:
```
$ python2.7 vertex_cover.py
Using version 1.11
Edges: [(0, 3), (1, 3), (1, 4), (2, 3)]
Matching: {0: 3, 1: 4, 3: 0, 4: 1}
Vertex cover: set([0, 1])
Traceback (most recent call last):
File "vertex_cover.py", line 16, in <module>
assert u in vertex_cover or v in vertex_cover
AssertionError
$ python3.6 vertex_cover.py
Using version 1.11
Edges: [(0, 3), (3, 1), (3, 2), (1, 4)]
Matching: {0: 3, 1: 4, 3: 0, 4: 1}
Vertex cover: {0, 1}
Traceback (most recent call last):
File "vertex_cover.py", line 16, in <module>
assert u in vertex_cover or v in vertex_cover
AssertionError
```
The vertex cover is incorrect, as verified by the `assert`s.
Current git version (21114082) fails in the same way.
|
networkx/networkx
|
diff --git a/networkx/algorithms/bipartite/tests/test_matching.py b/networkx/algorithms/bipartite/tests/test_matching.py
index c30582a19..22944c2c1 100644
--- a/networkx/algorithms/bipartite/tests/test_matching.py
+++ b/networkx/algorithms/bipartite/tests/test_matching.py
@@ -166,6 +166,25 @@ class TestMatching():
independent_set = set(G) - {v for _, v in vertex_cover}
assert_equal({'B', 'D', 'F', 'I', 'H'}, independent_set)
+ def test_vertex_cover_issue_2384(self):
+ G = nx.Graph([(0, 3), (1, 3), (1, 4), (2, 3)])
+ matching = maximum_matching(G)
+ vertex_cover = to_vertex_cover(G, matching)
+ for u, v in G.edges():
+ assert_true(u in vertex_cover or v in vertex_cover)
+
+ def test_unorderable_nodes(self):
+ a = object()
+ b = object()
+ c = object()
+ d = object()
+ e = object()
+ G = nx.Graph([(a, d), (b, d), (b, e), (c, d)])
+ matching = maximum_matching(G)
+ vertex_cover = to_vertex_cover(G, matching)
+ for u, v in G.edges():
+ assert_true(u in vertex_cover or v in vertex_cover)
+
def test_eppstein_matching():
"""Test in accordance to issue #1927"""
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 1
}
|
help
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"nose",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y libgdal-dev graphviz"
],
"python": "3.6",
"reqs_path": [
"requirements/default.txt",
"requirements/test.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
decorator==5.1.1
importlib-metadata==4.8.3
iniconfig==1.1.1
-e git+https://github.com/networkx/networkx.git@464bf8fc08ffa09cfd0183fb5cae1adfe6839e12#egg=networkx
nose==1.3.7
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: networkx
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- decorator==5.1.1
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- nose==1.3.7
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/networkx
|
[
"networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_vertex_cover_issue_2384",
"networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_unorderable_nodes"
] |
[] |
[
"networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_eppstein_matching",
"networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_hopcroft_karp_matching",
"networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_to_vertex_cover",
"networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_eppstein_matching_simple",
"networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_hopcroft_karp_matching_simple",
"networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_eppstein_matching_disconnected",
"networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_hopcroft_karp_matching_disconnected",
"networkx/algorithms/bipartite/tests/test_matching.py::TestMatching::test_issue_2127",
"networkx/algorithms/bipartite/tests/test_matching.py::test_eppstein_matching"
] |
[] |
BSD 3-Clause
| 1,093 |
|
Telefonica__toolium-70
|
e35c53831bd3a61c40cd3e13dd972783c24ff664
|
2017-03-17 09:19:45
|
e35c53831bd3a61c40cd3e13dd972783c24ff664
|
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 355d22e..8ecab67 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,6 +1,13 @@
Toolium Changelog
=================
+v1.2.4
+------
+
+*Release date: 2017-03-17*
+
+- Fix NoSuchElementException error finding elements in nested groups
+
v1.2.3
------
diff --git a/VERSION b/VERSION
index 0495c4a..e8ea05d 100644
--- a/VERSION
+++ b/VERSION
@@ -1,1 +1,1 @@
-1.2.3
+1.2.4
diff --git a/toolium/pageelements/group_page_element.py b/toolium/pageelements/group_page_element.py
index ae5c376..8f0c0d2 100644
--- a/toolium/pageelements/group_page_element.py
+++ b/toolium/pageelements/group_page_element.py
@@ -50,11 +50,12 @@ class Group(PageObject, PageElement):
:param driver_wrapper: driver wrapper instance
"""
+ from toolium.pageelements.page_elements import PageElements
if driver_wrapper:
self.driver_wrapper = driver_wrapper
self._web_element = None
for element in self._get_page_elements():
element.reset_object(driver_wrapper)
- if not isinstance(element, PageObject):
+ if isinstance(element, (PageElement, PageElements)):
# If element is not a page object, update element parent
element.parent = self
diff --git a/toolium/pageobjects/page_object.py b/toolium/pageobjects/page_object.py
index d367d0c..84d4a4f 100644
--- a/toolium/pageobjects/page_object.py
+++ b/toolium/pageobjects/page_object.py
@@ -60,10 +60,8 @@ class PageObject(CommonObject):
:returns: list of page elements and page objects
"""
- from toolium.pageelements.page_element import PageElement
- from toolium.pageelements.page_elements import PageElements
page_elements = []
for attribute, value in list(self.__dict__.items()) + list(self.__class__.__dict__.items()):
- if attribute != 'parent' and isinstance(value, (PageElement, PageElements, PageObject)):
+ if attribute != 'parent' and isinstance(value, CommonObject):
page_elements.append(value)
return page_elements
|
Elements not found in nested groups
When you have several nested groups the parent parameter is not correctly filled and sometimes the elements of a group cannot be found and "NoSuchElementException" is given.
Defined groups example:
class ThirdGroup(Group):
def init_page_elements(self):
self.element3 = Button(By.XPATH, './/button[@class="three"]')
class SecondGroup(Group):
def init_page_elements(self):
self.element2 = ThirdGroup(By.XPATH, './/button[@class="two"]')
self.test_element = Button(By.XPATH, './/button[@class="two"]//button[@class="three"]')
class FirstGroup(Group):
def init_page_elements(self):
self.element1 = SecondGroup(By.XPATH, './/button[@class="first"]')
class ThisPageObject(PageObject):
def init_page_elements(self):
self.my_first_group` = FirstGroup(By.XPATH, '//div')
Elements accessing example:
visible1 = self.my_first_group.element1.element2.element3.web_element.is_displayed()
visible2 = self.my_first_group.element1.test_element.web_element.is_displayed()
That first line (visible1) gives a NoSuchElementException, but the last line (visible2) finds the element and returns the correct result. The element accessed in both cases has the same XPATH, but in the first case there is one more nested group than in the second one.
|
Telefonica/toolium
|
diff --git a/toolium/test/pageelements/test_derived_page_element.py b/toolium/test/pageelements/test_derived_page_element.py
index 57ef942..5701f3e 100644
--- a/toolium/test/pageelements/test_derived_page_element.py
+++ b/toolium/test/pageelements/test_derived_page_element.py
@@ -150,18 +150,18 @@ def test_group_reset_object(driver_wrapper):
# Check that web elements are empty
assert login_page.menu._web_element is None
assert login_page.menu.logo._web_element is None
- assert login_page.menu.logo.parent._web_element is None
+ assert login_page.menu.logo.parent == login_page.menu
login_page.menu.logo.web_element
# Check that web elements are filled
assert login_page.menu._web_element is not None
assert login_page.menu.logo._web_element is not None
- assert login_page.menu.logo.parent._web_element is not None
+ assert login_page.menu.logo.parent == login_page.menu
login_page.menu.reset_object()
# Check that web elements are empty
assert login_page.menu._web_element is None
assert login_page.menu.logo._web_element is None
- assert login_page.menu.logo.parent._web_element is None
+ assert login_page.menu.logo.parent == login_page.menu
diff --git a/toolium/test/pageelements/test_page_elements_groups.py b/toolium/test/pageelements/test_page_elements_groups.py
index 347d67a..bcea69c 100644
--- a/toolium/test/pageelements/test_page_elements_groups.py
+++ b/toolium/test/pageelements/test_page_elements_groups.py
@@ -108,6 +108,15 @@ def test_reset_object_page_elements_groups(driver_wrapper):
assert column_21.input._web_element is not None
assert column_21.link._web_element is not None
assert column_21.input_with_parent._web_element is not None
+ # Check that the group elements have the group as parent
+ assert column_11.parent == row_1
+ assert column_21.parent == row_2
+ assert column_11.input.parent == column_11
+ assert column_11.link.parent == column_11
+ assert column_11.input_with_parent.parent == column_11
+ assert column_21.input.parent == column_21
+ assert column_21.link.parent == column_21
+ assert column_21.input_with_parent.parent == column_21
table_page.reset_object()
@@ -128,3 +137,12 @@ def test_reset_object_page_elements_groups(driver_wrapper):
assert column_21.input._web_element is None
assert column_21.link._web_element is None
assert column_21.input_with_parent._web_element is None
+ # Check that the group elements have the group as parent
+ assert column_11.parent == row_1
+ assert column_21.parent == row_2
+ assert column_11.input.parent == column_11
+ assert column_11.link.parent == column_11
+ assert column_11.input_with_parent.parent == column_11
+ assert column_21.input.parent == column_21
+ assert column_21.link.parent == column_21
+ assert column_21.input_with_parent.parent == column_21
diff --git a/toolium/test/pageelements/test_page_nested_groups.py b/toolium/test/pageelements/test_page_nested_groups.py
new file mode 100644
index 0000000..4a4b0cf
--- /dev/null
+++ b/toolium/test/pageelements/test_page_nested_groups.py
@@ -0,0 +1,99 @@
+# -*- coding: utf-8 -*-
+u"""
+Copyright 2017 Telefónica Investigación y Desarrollo, S.A.U.
+This file is part of Toolium.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+import mock
+import pytest
+from selenium.webdriver.common.by import By
+from selenium.webdriver.remote.webelement import WebElement
+
+from toolium.driver_wrapper import DriverWrapper
+from toolium.driver_wrappers_pool import DriverWrappersPool
+from toolium.pageelements import PageElements, Group, InputText, Link
+from toolium.pageobjects.page_object import PageObject
+
+
+class InnerGroup(Group):
+ def init_page_elements(self):
+ self.input = InputText(By.XPATH, './/input')
+ self.input_with_parent = InputText(By.XPATH, './/input', (By.XPATH, './/parent'))
+
+
+class OuterGroup(Group):
+ def init_page_elements(self):
+ self.inner = InnerGroup(By.XPATH, './/div')
+
+
+class NestedPageObject(PageObject):
+ def init_page_elements(self):
+ self.outer = OuterGroup(By.XPATH, '//div')
+
+
[email protected]
+def driver_wrapper():
+ # Reset wrappers pool values
+ DriverWrappersPool._empty_pool()
+ DriverWrapper.config_properties_filenames = None
+
+ # Create a new wrapper
+ driver_wrapper = DriverWrappersPool.get_default_wrapper()
+ driver_wrapper.driver = mock.MagicMock()
+
+ return driver_wrapper
+
+
+def test_reset_object_nested_groups(driver_wrapper):
+ # Mock Driver.save_web_element = True
+ driver_wrapper.config = mock.MagicMock()
+ driver_wrapper.config.getboolean_optional.return_value = True
+ # Create mock element
+ mock_element = mock.MagicMock(spec=WebElement)
+ driver_wrapper.driver.find_element.return_value = mock_element
+
+ nested_page = NestedPageObject()
+
+ # Check that web elements are empty
+ assert nested_page.outer._web_element is None
+ assert nested_page.outer.inner._web_element is None
+ assert nested_page.outer.inner.input._web_element is None
+ assert nested_page.outer.inner.input_with_parent._web_element is None
+ assert nested_page.outer.inner.parent == nested_page.outer
+ assert nested_page.outer.inner.input.parent == nested_page.outer.inner
+ assert nested_page.outer.inner.input_with_parent.parent == nested_page.outer.inner
+
+ nested_page.outer.inner.input.web_element
+ nested_page.outer.inner.input_with_parent.web_element
+
+ # Check that web elements are filled
+ assert nested_page.outer._web_element is not None
+ assert nested_page.outer.inner._web_element is not None
+ assert nested_page.outer.inner.input._web_element is not None
+ assert nested_page.outer.inner.input_with_parent._web_element is not None
+ assert nested_page.outer.inner.parent == nested_page.outer
+ assert nested_page.outer.inner.input.parent == nested_page.outer.inner
+ assert nested_page.outer.inner.input_with_parent.parent == nested_page.outer.inner
+
+ nested_page.outer.reset_object()
+
+ # Check that web elements are empty
+ assert nested_page.outer._web_element is None
+ assert nested_page.outer.inner._web_element is None
+ assert nested_page.outer.inner.input._web_element is None
+ assert nested_page.outer.inner.input_with_parent._web_element is None
+ assert nested_page.outer.inner.parent == nested_page.outer
+ assert nested_page.outer.inner.input.parent == nested_page.outer.inner
+ assert nested_page.outer.inner.input_with_parent.parent == nested_page.outer.inner
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 4
}
|
1.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements.txt",
"requirements_dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
Appium-Python-Client==1.3.0
attrs==22.2.0
Babel==2.11.0
behave==1.2.5
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
coveralls==1.1
docopt==0.6.2
docutils==0.18.1
execnet==1.9.0
extras==1.0.0
fixtures==4.0.1
fuzzywuzzy==0.18.0
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==3.0.3
lettuce==0.2.23
MarkupSafe==2.0.1
mock==2.0.0
needle==0.4.1
nose==1.3.7
packaging==21.3
parse==1.20.2
parse_type==0.6.4
pbr==6.1.1
Pillow==8.4.0
pluggy==1.0.0
py==1.11.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
python-subunit==1.4.2
pytz==2025.2
requests==2.27.1
requests-mock==1.2.0
selenium==3.141.0
six==1.17.0
snowballstemmer==2.2.0
Sphinx==1.5.1
sure==2.0.1
testtools==2.6.0
tomli==1.2.3
-e git+https://github.com/Telefonica/toolium.git@e35c53831bd3a61c40cd3e13dd972783c24ff664#egg=toolium
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0
|
name: toolium
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- appium-python-client==1.3.0
- attrs==22.2.0
- babel==2.11.0
- behave==1.2.5
- charset-normalizer==2.0.12
- coverage==6.2
- coveralls==1.1
- docopt==0.6.2
- docutils==0.18.1
- execnet==1.9.0
- extras==1.0.0
- fixtures==4.0.1
- fuzzywuzzy==0.18.0
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- jinja2==3.0.3
- lettuce==0.2.23
- markupsafe==2.0.1
- mock==2.0.0
- needle==0.4.1
- nose==1.3.7
- packaging==21.3
- parse==1.20.2
- parse-type==0.6.4
- pbr==6.1.1
- pillow==8.4.0
- pluggy==1.0.0
- py==1.11.0
- pygments==2.14.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-asyncio==0.16.0
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-xdist==3.0.2
- python-subunit==1.4.2
- pytz==2025.2
- requests==2.27.1
- requests-mock==1.2.0
- selenium==3.141.0
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==1.5.1
- sure==2.0.1
- testtools==2.6.0
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- zipp==3.6.0
prefix: /opt/conda/envs/toolium
|
[
"toolium/test/pageelements/test_page_nested_groups.py::test_reset_object_nested_groups"
] |
[] |
[
"toolium/test/pageelements/test_derived_page_element.py::test_locator",
"toolium/test/pageelements/test_derived_page_element.py::test_get_text",
"toolium/test/pageelements/test_derived_page_element.py::test_get_input_text",
"toolium/test/pageelements/test_derived_page_element.py::test_set_input_text",
"toolium/test/pageelements/test_derived_page_element.py::test_get_selected_option",
"toolium/test/pageelements/test_derived_page_element.py::test_set_option",
"toolium/test/pageelements/test_derived_page_element.py::test_click_button",
"toolium/test/pageelements/test_derived_page_element.py::test_group_reset_object",
"toolium/test/pageelements/test_page_elements_groups.py::test_reset_object_page_elements_groups"
] |
[] |
Apache License 2.0
| 1,098 |
|
Backblaze__B2_Command_Line_Tool-332
|
26ba7c389b732b2202da62a28826a893a8d47749
|
2017-03-20 21:04:08
|
4e3ee3d1d9bdaf7bbd164dfaa812868aa92c2d32
|
diff --git a/b2/sync/policy.py b/b2/sync/policy.py
index b8e7435..5b74f97 100644
--- a/b2/sync/policy.py
+++ b/b2/sync/policy.py
@@ -240,7 +240,6 @@ def make_b2_keep_days_actions(
only the 25-day old version can be deleted. The 15 day-old version
was visible 10 days ago.
"""
- prev_age_days = None
deleting = False
if dest_file is None:
# B2 does not really store folders, so there is no need to hide
@@ -250,8 +249,17 @@ def make_b2_keep_days_actions(
# How old is this version?
age_days = (now_millis - version.mod_time) / ONE_DAY_IN_MS
- # We assume that the versions are ordered by time, newest first.
- assert prev_age_days is None or prev_age_days <= age_days
+ # Mostly, the versions are ordered by time, newest first,
+ # BUT NOT ALWAYS. The mod time we have is the src_last_modified_millis
+ # from the file info (if present), or the upload start time
+ # (if not present). The user-specified src_last_modified_millis
+ # may not be in order. Because of that, we no longer
+ # assert that age_days is non-decreasing.
+ #
+ # Note that if there is an out-of-order date that is old enough
+ # to trigger deletions, all of the versions uploaded before that
+ # (the ones after it in the list) will be deleted, even if they
+ # aren't over the age threshold.
# Do we need to hide this version?
if version_index == 0 and source_file is None and version.action == 'upload':
@@ -275,6 +283,3 @@ def make_b2_keep_days_actions(
# age of this one?
if keep_days < age_days:
deleting = True
-
- # Remember this age for next time around the loop.
- prev_age_days = age_days
|
CLI Sync errors
Hi all,
after i finished my first sync to Cloud after 3 weeks, i have now errors while syncing new files to the Cloud.
The following lines occurs after a few seconds when i start my CLI Command
```
C:\Program Files\Python36\Scripts>b2.exe sync --excludeRegex DfsrPrivate --threads 10 --keepDays 30 --replaceNewer \\?\D:\DFS\Daten b2://Nuernberg01/Daten
ERROR:b2.console_tool:ConsoleTool unexpected exception
Traceback (most recent call last):
File "c:\program files\python36\lib\site-packages\b2\console_tool.py", line 992, in run_command
return command.run(args)
File "c:\program files\python36\lib\site-packages\b2\console_tool.py", line 781, in run
dry_run=args.dryRun,
File "c:\program files\python36\lib\site-packages\logfury\v0_1\trace_call.py", line 84, in wrapper
return function(*wrapee_args, **wrapee_kwargs)
File "c:\program files\python36\lib\site-packages\b2\sync\sync.py", line 251, in sync_folders
source_folder, dest_folder, args, now_millis, reporter
File "c:\program files\python36\lib\site-packages\b2\sync\sync.py", line 150, in make_folder_sync_actions
sync_type, source_file, dest_file, source_folder, dest_folder, args, now_millis
File "c:\program files\python36\lib\site-packages\b2\sync\sync.py", line 106, in make_file_sync_actions
for action in policy.get_all_actions():
File "c:\program files\python36\lib\site-packages\b2\sync\policy.py", line 104, in get_all_actions
for action in self._get_hide_delete_actions():
File "c:\program files\python36\lib\site-packages\b2\sync\policy.py", line 177, in _get_hide_delete_actions
self._keepDays, self._now_millis
File "c:\program files\python36\lib\site-packages\b2\sync\policy.py", line 254, in make_b2_keep_days_actions
assert prev_age_days is None or prev_age_days <= age_days
AssertionError
Traceback (most recent call last):
File "C:\Program Files\Python36\Scripts\b2-script.py", line 11, in <module>
load_entry_point('b2==0.7.0', 'console_scripts', 'b2')()
File "c:\program files\python36\lib\site-packages\b2\console_tool.py", line 1104, in main
exit_status = ct.run_command(decoded_argv)
File "c:\program files\python36\lib\site-packages\b2\console_tool.py", line 992, in run_command
return command.run(args)
File "c:\program files\python36\lib\site-packages\b2\console_tool.py", line 781, in run
dry_run=args.dryRun,
File "c:\program files\python36\lib\site-packages\logfury\v0_1\trace_call.py", line 84, in wrapper
return function(*wrapee_args, **wrapee_kwargs)
File "c:\program files\python36\lib\site-packages\b2\sync\sync.py", line 251, in sync_folders
source_folder, dest_folder, args, now_millis, reporter
File "c:\program files\python36\lib\site-packages\b2\sync\sync.py", line 150, in make_folder_sync_actions
sync_type, source_file, dest_file, source_folder, dest_folder, args, now_millis
File "c:\program files\python36\lib\site-packages\b2\sync\sync.py", line 106, in make_file_sync_actions
for action in policy.get_all_actions():
File "c:\program files\python36\lib\site-packages\b2\sync\policy.py", line 104, in get_all_actions
for action in self._get_hide_delete_actions():
File "c:\program files\python36\lib\site-packages\b2\sync\policy.py", line 177, in _get_hide_delete_actions
self._keepDays, self._now_millis
File "c:\program files\python36\lib\site-packages\b2\sync\policy.py", line 254, in make_b2_keep_days_actions
assert prev_age_days is None or prev_age_days <= age_days
AssertionError
```
I have no Idea what to do?
|
Backblaze/B2_Command_Line_Tool
|
diff --git a/test/test_policy.py b/test/test_policy.py
new file mode 100644
index 0000000..bcc0ec4
--- /dev/null
+++ b/test/test_policy.py
@@ -0,0 +1,77 @@
+######################################################################
+#
+# File: test_policy
+#
+# Copyright 2017, Backblaze Inc. All Rights Reserved.
+#
+# License https://www.backblaze.com/using_b2_code.html
+#
+######################################################################
+
+from b2.sync.file import File, FileVersion
+from b2.sync.folder import B2Folder
+from b2.sync.policy import make_b2_keep_days_actions
+from .test_base import TestBase
+
+try:
+ from unittest.mock import MagicMock
+except ImportError:
+ from mock import MagicMock
+
+
+class TestMakeB2KeepDaysActions(TestBase):
+ def setUp(self):
+ self.keep_days = 7
+ self.today = 100 * 86400
+ self.one_day_millis = 86400 * 1000
+
+ def test_no_versions(self):
+ self.check_one_answer(True, [], [])
+
+ def test_new_version_no_action(self):
+ self.check_one_answer(True, [(1, -5, 'upload')], [])
+
+ def test_no_source_one_old_version_hides(self):
+ # An upload that is old gets deleted if there is no source file.
+ self.check_one_answer(False, [(1, -10, 'upload')], ['b2_hide(folder/a)'])
+
+ def test_old_hide_causes_delete(self):
+ # A hide marker that is old gets deleted, as do the things after it.
+ self.check_one_answer(
+ True, [(1, -5, 'upload'), (2, -10, 'hide'), (3, -20, 'upload')],
+ ['b2_delete(folder/a, 2, (hide marker))', 'b2_delete(folder/a, 3, (old version))']
+ )
+
+ def test_old_upload_causes_delete(self):
+ # An upload that is old stays if there is a source file, but things
+ # behind it go away.
+ self.check_one_answer(
+ True, [(1, -5, 'upload'), (2, -10, 'upload'), (3, -20, 'upload')],
+ ['b2_delete(folder/a, 3, (old version))']
+ )
+
+ def test_out_of_order_dates(self):
+ # The one at date -3 will get deleted because the one before it is old.
+ self.check_one_answer(
+ True, [(1, -5, 'upload'), (2, -10, 'upload'), (3, -3, 'upload')],
+ ['b2_delete(folder/a, 3, (old version))']
+ )
+
+ def check_one_answer(self, has_source, id_relative_date_action_list, expected_actions):
+ source_file = File('a', []) if has_source else None
+ dest_file_versions = [
+ FileVersion(id_, 'a', self.today + relative_date * self.one_day_millis, action, 100)
+ for (id_, relative_date, action) in id_relative_date_action_list
+ ]
+ dest_file = File('a', dest_file_versions)
+ bucket = MagicMock()
+ api = MagicMock()
+ api.get_bucket_by_name.return_value = bucket
+ dest_folder = B2Folder('bucket-1', 'folder', api)
+ actual_actions = list(
+ make_b2_keep_days_actions(
+ source_file, dest_file, dest_folder, dest_folder, self.keep_days, self.today
+ )
+ )
+ actual_action_strs = [str(a) for a in actual_actions]
+ self.assertEqual(expected_actions, actual_action_strs)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 1
}
|
0.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"nose",
"mock",
"pyflakes",
"yapf",
"pytest"
],
"pre_install": null,
"python": "3.5",
"reqs_path": [
"requirements.txt",
"requirements-test.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
arrow==1.2.3
attrs==22.2.0
-e git+https://github.com/Backblaze/B2_Command_Line_Tool.git@26ba7c389b732b2202da62a28826a893a8d47749#egg=b2
certifi==2021.5.30
charset-normalizer==2.0.12
idna==3.10
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
logfury==1.0.1
mock==5.2.0
nose==1.3.7
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyflakes==3.0.1
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
requests==2.27.1
six==1.17.0
tomli==1.2.3
tqdm==4.64.1
typing_extensions==4.1.1
urllib3==1.26.20
yapf==0.32.0
zipp==3.6.0
|
name: B2_Command_Line_Tool
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- arrow==1.2.3
- attrs==22.2.0
- charset-normalizer==2.0.12
- idna==3.10
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- iniconfig==1.1.1
- logfury==1.0.1
- mock==5.2.0
- nose==1.3.7
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyflakes==3.0.1
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- requests==2.27.1
- six==1.17.0
- tomli==1.2.3
- tqdm==4.64.1
- typing-extensions==4.1.1
- urllib3==1.26.20
- yapf==0.32.0
- zipp==3.6.0
prefix: /opt/conda/envs/B2_Command_Line_Tool
|
[
"test/test_policy.py::TestMakeB2KeepDaysActions::test_out_of_order_dates"
] |
[] |
[
"test/test_policy.py::TestMakeB2KeepDaysActions::test_new_version_no_action",
"test/test_policy.py::TestMakeB2KeepDaysActions::test_no_source_one_old_version_hides",
"test/test_policy.py::TestMakeB2KeepDaysActions::test_no_versions",
"test/test_policy.py::TestMakeB2KeepDaysActions::test_old_hide_causes_delete",
"test/test_policy.py::TestMakeB2KeepDaysActions::test_old_upload_causes_delete"
] |
[] |
MIT License
| 1,104 |
|
amueller__word_cloud-242
|
4fc252d97045fa3616a7f13cbdd56eddca8ff008
|
2017-03-21 15:49:32
|
6b76b8d58df02cfe4a3a7a5ba668a60a478e6190
|
diff --git a/wordcloud/wordcloud.py b/wordcloud/wordcloud.py
index ae5d107..e63d922 100644
--- a/wordcloud/wordcloud.py
+++ b/wordcloud/wordcloud.py
@@ -348,7 +348,11 @@ class WordCloud(object):
"""
# make sure frequencies are sorted and normalized
frequencies = sorted(frequencies.items(), key=item1, reverse=True)
+ if len(frequencies) <= 0:
+ raise ValueError("We need at least 1 word to plot a word cloud, "
+ "got %d." % len(frequencies))
frequencies = frequencies[:self.max_words]
+
# largest entry will be 1
max_frequency = float(frequencies[0][1])
@@ -360,10 +364,6 @@ class WordCloud(object):
else:
random_state = Random()
- if len(frequencies) <= 0:
- print("We need at least 1 word to plot a word cloud, got %d."
- % len(frequencies))
-
if self.mask is not None:
mask = self.mask
width = mask.shape[1]
|
Checking 'frequencies' list in function WordCloud.generate_from_frequencies()
I'm having an issue related to the generation of the word_cloud from a list of frequencies per word. As you can see below, the function is trying to retrieve the max frequency from a list 'frecuencies', but it doesn't check before if there is some element in that list:
https://github.com/amueller/word_cloud/blob/master/wordcloud/wordcloud.py#L350
That kind of check is done after, in the following snippet (but it's too late, because we already tried to access to the first element on a probably empty list):
https://github.com/amueller/word_cloud/blob/master/wordcloud/wordcloud.py#L360-L362
In my own version, I've done the following correction related to the first snippet in order to avoid some crashes (just as an example):
```
try:
max_frequency = float(frequencies[0][1])
except:
print "ERROR with list 'frecuencies'=", frequencies
```
Best regards!
|
amueller/word_cloud
|
diff --git a/test/test_wordcloud.py b/test/test_wordcloud.py
index ee91f2e..2d2662b 100644
--- a/test/test_wordcloud.py
+++ b/test/test_wordcloud.py
@@ -76,6 +76,16 @@ def test_multiple_s():
assert_in("flosss", wc.words_)
+def test_empty_text():
+ # test originally empty text raises an exception
+ wc = WordCloud(stopwords=[])
+ assert_raises(ValueError, wc.generate, '')
+
+ # test empty-after-filtering text raises an exception
+ wc = WordCloud(stopwords=['a', 'b'])
+ assert_raises(ValueError, wc.generate, 'a b a')
+
+
def test_default():
# test that default word cloud creation and conversions work
wc = WordCloud(max_words=50)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 1
},
"num_modified_files": 1
}
|
1.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"nose",
"mock",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc g++"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
cycler==0.11.0
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
kiwisolver==1.3.1
matplotlib==3.3.4
mock==5.2.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
nose==1.3.7
numpy==1.19.5
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
Pillow==8.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
python-dateutil==2.9.0.post0
six==1.17.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
-e git+https://github.com/amueller/word_cloud.git@4fc252d97045fa3616a7f13cbdd56eddca8ff008#egg=wordcloud
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: word_cloud
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- cycler==0.11.0
- kiwisolver==1.3.1
- matplotlib==3.3.4
- mock==5.2.0
- nose==1.3.7
- numpy==1.19.5
- pillow==8.4.0
- python-dateutil==2.9.0.post0
- six==1.17.0
prefix: /opt/conda/envs/word_cloud
|
[
"test/test_wordcloud.py::test_empty_text"
] |
[] |
[
"test/test_wordcloud.py::test_collocations",
"test/test_wordcloud.py::test_plurals_numbers",
"test/test_wordcloud.py::test_multiple_s",
"test/test_wordcloud.py::test_default",
"test/test_wordcloud.py::test_stopwords_lowercasing",
"test/test_wordcloud.py::test_writing_to_file",
"test/test_wordcloud.py::test_check_errors",
"test/test_wordcloud.py::test_recolor",
"test/test_wordcloud.py::test_random_state",
"test/test_wordcloud.py::test_mask",
"test/test_wordcloud.py::test_single_color_func",
"test/test_wordcloud.py::test_single_color_func_grey",
"test/test_wordcloud.py::test_process_text",
"test/test_wordcloud.py::test_generate_from_frequencies",
"test/test_wordcloud.py::test_relative_scaling_zero"
] |
[] |
MIT License
| 1,106 |
|
amueller__word_cloud-243
|
2b868941a71e0ad6efac3b25433b97e8776e381b
|
2017-03-21 16:29:49
|
6b76b8d58df02cfe4a3a7a5ba668a60a478e6190
|
amueller: This PR only adds the flag, but keeps the default as "true", right?
That seems like a good solution to me. The program is more "here is some text, make a word-cloud out of it". And separating two words that always appear together isn't that intuitive to me.
cjmay: Okay, I'll change it: the default behavior in the CLI would be switched in the current PR.
amueller: thanks :)
|
diff --git a/wordcloud/wordcloud.py b/wordcloud/wordcloud.py
index e63d922..ae5d107 100644
--- a/wordcloud/wordcloud.py
+++ b/wordcloud/wordcloud.py
@@ -348,11 +348,7 @@ class WordCloud(object):
"""
# make sure frequencies are sorted and normalized
frequencies = sorted(frequencies.items(), key=item1, reverse=True)
- if len(frequencies) <= 0:
- raise ValueError("We need at least 1 word to plot a word cloud, "
- "got %d." % len(frequencies))
frequencies = frequencies[:self.max_words]
-
# largest entry will be 1
max_frequency = float(frequencies[0][1])
@@ -364,6 +360,10 @@ class WordCloud(object):
else:
random_state = Random()
+ if len(frequencies) <= 0:
+ print("We need at least 1 word to plot a word cloud, got %d."
+ % len(frequencies))
+
if self.mask is not None:
mask = self.mask
width = mask.shape[1]
diff --git a/wordcloud/wordcloud_cli.py b/wordcloud/wordcloud_cli.py
index 2a54deb..cc105fe 100644
--- a/wordcloud/wordcloud_cli.py
+++ b/wordcloud/wordcloud_cli.py
@@ -16,7 +16,8 @@ def main(args):
wordcloud = wc.WordCloud(stopwords=args.stopwords, mask=args.mask,
width=args.width, height=args.height, font_path=args.font_path,
margin=args.margin, relative_scaling=args.relative_scaling,
- color_func=args.color_func, background_color=args.background_color).generate(args.text)
+ color_func=args.color_func, background_color=args.background_color,
+ collocations=args.collocations).generate(args.text)
image = wordcloud.to_image()
with args.imagefile:
@@ -51,6 +52,8 @@ def parse_args(arguments):
help='use given color as coloring for the image - accepts any value from PIL.ImageColor.getcolor')
parser.add_argument('--background', metavar='color', default='black', type=str, dest='background_color',
help='use given color as background color for the image - accepts any value from PIL.ImageColor.getcolor')
+ parser.add_argument('--no_collocations', action='store_true',
+ help='do not add collocations (bigrams) to word cloud (default: add unigrams and bigrams)')
args = parser.parse_args(arguments)
if args.colormask and args.color:
@@ -74,6 +77,8 @@ def parse_args(arguments):
if args.color:
color_func = wc.get_single_color_func(args.color)
+ args.collocations = not args.no_collocations
+
args.color_func = color_func
return args
|
Some text distributions yield duplicate words in image
As a workaround for #226 I tried generating text according to the desired distribution: [food.txt](https://github.com/amueller/word_cloud/files/858596/food.txt)
Note in particular there are few word types but relatively high number of tokens per type compared to natural language. Tokens of each word type are also grouped. (My guess would be one or both of these properties are causing the issue.)
However, `wordcloud_cli.py` (from master) on this generated text file, with default options, yielded a word cloud with each word duplicated conspicuously: 
|
amueller/word_cloud
|
diff --git a/test/test_wordcloud.py b/test/test_wordcloud.py
index 2d2662b..ee91f2e 100644
--- a/test/test_wordcloud.py
+++ b/test/test_wordcloud.py
@@ -76,16 +76,6 @@ def test_multiple_s():
assert_in("flosss", wc.words_)
-def test_empty_text():
- # test originally empty text raises an exception
- wc = WordCloud(stopwords=[])
- assert_raises(ValueError, wc.generate, '')
-
- # test empty-after-filtering text raises an exception
- wc = WordCloud(stopwords=['a', 'b'])
- assert_raises(ValueError, wc.generate, 'a b a')
-
-
def test_default():
# test that default word cloud creation and conversions work
wc = WordCloud(max_words=50)
diff --git a/test/test_wordcloud_cli.py b/test/test_wordcloud_cli.py
index bdfef88..d350d81 100644
--- a/test/test_wordcloud_cli.py
+++ b/test/test_wordcloud_cli.py
@@ -17,7 +17,10 @@ ARGUMENT_SPEC_TYPED = [
ArgOption(cli_name='width', init_name='width', pass_value=13, fail_value=1.),
ArgOption(cli_name='height', init_name='height', pass_value=15, fail_value=1.),
ArgOption(cli_name='margin', init_name='margin', pass_value=17, fail_value=1.),
- ArgOption(cli_name='relative_scaling', init_name='relative_scaling', pass_value=1, fail_value='c')
+ ArgOption(cli_name='relative_scaling', init_name='relative_scaling', pass_value=1, fail_value='c'),
+]
+ARGUMENT_SPEC_UNARY = [
+ ArgOption(cli_name='no_collocations', init_name='collocations', pass_value=True, fail_value=1)
]
ARGUMENT_SPEC_REMAINING = [
ArgOption(cli_name='stopwords', init_name='stopwords', pass_value=temp.name, fail_value=None),
@@ -26,10 +29,12 @@ ARGUMENT_SPEC_REMAINING = [
ArgOption(cli_name='color', init_name='color_func', pass_value='red', fail_value=None),
ArgOption(cli_name='background', init_name='background_color', pass_value='grey', fail_value=None)
]
+ARGUMENT_CLI_NAMES_UNARY = [arg_opt.cli_name for arg_opt in ARGUMENT_SPEC_UNARY]
def all_arguments():
arguments = []
arguments.extend(ARGUMENT_SPEC_TYPED)
+ arguments.extend(ARGUMENT_SPEC_UNARY)
arguments.extend(ARGUMENT_SPEC_REMAINING)
return arguments
@@ -56,6 +61,13 @@ def check_argument(name, result_name, value):
assert_in(result_name, vars(args))
+def check_argument_unary(name, result_name):
+ text = NamedTemporaryFile()
+
+ args = cli.parse_args(['--text', text.name, '--' + name])
+ assert_in(result_name, vars(args))
+
+
def check_argument_type(name, value):
text = NamedTemporaryFile()
@@ -71,7 +83,9 @@ def check_argument_type(name, value):
def test_parse_args_are_passed_along():
for option in all_arguments():
- if option.cli_name != 'mask':
+ if option.cli_name in ARGUMENT_CLI_NAMES_UNARY:
+ yield check_argument_unary, option.cli_name, option.init_name
+ elif option.cli_name != 'mask':
yield check_argument, option.cli_name, option.init_name, option.pass_value
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_issue_reference",
"has_media",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 2
}
|
1.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"nose",
"mock",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc g++"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
cycler==0.11.0
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
kiwisolver==1.3.1
matplotlib==3.3.4
mock==5.2.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
nose==1.3.7
numpy==1.19.5
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
Pillow==8.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
python-dateutil==2.9.0.post0
six==1.17.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
-e git+https://github.com/amueller/word_cloud.git@2b868941a71e0ad6efac3b25433b97e8776e381b#egg=wordcloud
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: word_cloud
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- cycler==0.11.0
- kiwisolver==1.3.1
- matplotlib==3.3.4
- mock==5.2.0
- nose==1.3.7
- numpy==1.19.5
- pillow==8.4.0
- python-dateutil==2.9.0.post0
- six==1.17.0
prefix: /opt/conda/envs/word_cloud
|
[
"test/test_wordcloud_cli.py::test_main_passes_arguments_through"
] |
[] |
[
"test/test_wordcloud.py::test_collocations",
"test/test_wordcloud.py::test_plurals_numbers",
"test/test_wordcloud.py::test_multiple_s",
"test/test_wordcloud.py::test_default",
"test/test_wordcloud.py::test_stopwords_lowercasing",
"test/test_wordcloud.py::test_writing_to_file",
"test/test_wordcloud.py::test_check_errors",
"test/test_wordcloud.py::test_recolor",
"test/test_wordcloud.py::test_random_state",
"test/test_wordcloud.py::test_mask",
"test/test_wordcloud.py::test_single_color_func",
"test/test_wordcloud.py::test_single_color_func_grey",
"test/test_wordcloud.py::test_process_text",
"test/test_wordcloud.py::test_generate_from_frequencies",
"test/test_wordcloud.py::test_relative_scaling_zero",
"test/test_wordcloud_cli.py::test_check_duplicate_color_error",
"test/test_wordcloud_cli.py::test_parse_args_defaults_to_random_color",
"test/test_wordcloud_cli.py::test_cli_writes_image"
] |
[] |
MIT License
| 1,107 |
mardiros__aioxmlrpc-10
|
5480f35630d166bfa686e2e02b28c581e16bb723
|
2017-03-23 00:48:03
|
5480f35630d166bfa686e2e02b28c581e16bb723
|
diff --git a/aioxmlrpc/client.py b/aioxmlrpc/client.py
index 35bca86..5ed292b 100644
--- a/aioxmlrpc/client.py
+++ b/aioxmlrpc/client.py
@@ -79,8 +79,14 @@ class AioTransport(xmlrpc.Transport):
raise
except Exception as exc:
log.error('Unexpected error', exc_info=True)
- raise ProtocolError(url, response.status,
- str(exc), response.headers)
+ if response is not None:
+ errcode = response.status
+ headers = response.headers
+ else:
+ errcode = 0
+ headers = {}
+
+ raise ProtocolError(url, errcode, str(exc), headers)
return self.parse_response(body)
def parse_response(self, body):
|
AttributeError when server closes socket
If the XMLRPC server closes the socket, which is rather common if it's Apache, I get this error:
```
Traceback (most recent call last):
File "/usr/share/routest/env/lib/python3.5/site-packages/aioxmlrpc/client.py", line 71, in request
connector=self._connector, loop=self._loop)
File "/usr/share/routest/env/lib/python3.5/site-packages/aiohttp/client.py", line 605, in __iter__
return (yield from self._coro)
File "/usr/share/routest/env/lib/python3.5/site-packages/aiohttp/client.py", line 161, in _request
raise RuntimeError('Session is closed')
RuntimeError: Session is closed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/share/routest/env/lib/python3.5/site-packages/routest/resource/space/serializers.py", line 159, in check_job_status
self.job_status = await self.lava.scheduler.job_status(self.job_id)
File "/usr/share/routest/env/lib/python3.5/site-packages/aioxmlrpc/client.py", line 37, in __call__
ret = yield from self.__send(self.__name, args)
File "/usr/share/routest/env/lib/python3.5/site-packages/aioxmlrpc/client.py", line 130, in __request
verbose=self.__verbose
File "/usr/share/routest/env/lib/python3.5/site-packages/aioxmlrpc/client.py", line 80, in request
raise ProtocolError(url, response.status,
AttributeError: 'NoneType' object has no attribute 'status'
```
|
mardiros/aioxmlrpc
|
diff --git a/aioxmlrpc/tests/test_client.py b/aioxmlrpc/tests/test_client.py
index 304045d..98fef6b 100644
--- a/aioxmlrpc/tests/test_client.py
+++ b/aioxmlrpc/tests/test_client.py
@@ -128,3 +128,28 @@ class ServerProxyTestCase(TestCase):
self.assertEqual(response, 1)
self.assertIs(self.loop, client._loop)
self.assertTrue(transp._connector.close.called)
+
+
[email protected]
+def failing_request(*args, **kwargs):
+ raise OSError
+
+
+class HTTPErrorTestCase(TestCase):
+
+ def setUp(self):
+ self.loop = asyncio.new_event_loop()
+ asyncio.set_event_loop(None)
+ self.aiohttp_request = mock.patch('aiohttp.request', new=failing_request)
+ self.aiohttp_request.start()
+
+ def tearDown(self):
+ self.aiohttp_request.stop()
+
+ def test_http_error(self):
+ from aioxmlrpc.client import ServerProxy, ProtocolError
+ client = ServerProxy('http://nonexistent/nonexistent', loop=self.loop)
+ self.assertRaises(ProtocolError,
+ self.loop.run_until_complete,
+ client.name.space.proxfyiedcall()
+ )
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 1
}
|
0.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.5",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
aiohttp==3.8.6
aiosignal==1.2.0
-e git+https://github.com/mardiros/aioxmlrpc.git@5480f35630d166bfa686e2e02b28c581e16bb723#egg=aioxmlrpc
async-timeout==4.0.2
asynctest==0.13.0
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
charset-normalizer==3.0.1
frozenlist==1.2.0
idna==3.10
idna-ssl==1.1.0
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
multidict==5.2.0
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
yarl==1.7.2
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: aioxmlrpc
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- aiohttp==3.8.6
- aiosignal==1.2.0
- async-timeout==4.0.2
- asynctest==0.13.0
- charset-normalizer==3.0.1
- frozenlist==1.2.0
- idna==3.10
- idna-ssl==1.1.0
- multidict==5.2.0
- yarl==1.7.2
prefix: /opt/conda/envs/aioxmlrpc
|
[
"aioxmlrpc/tests/test_client.py::HTTPErrorTestCase::test_http_error"
] |
[] |
[
"aioxmlrpc/tests/test_client.py::ServerProxyTestCase::test_close_transport",
"aioxmlrpc/tests/test_client.py::ServerProxyTestCase::test_http_500",
"aioxmlrpc/tests/test_client.py::ServerProxyTestCase::test_xmlrpc_fault",
"aioxmlrpc/tests/test_client.py::ServerProxyTestCase::test_xmlrpc_ok",
"aioxmlrpc/tests/test_client.py::ServerProxyTestCase::test_xmlrpc_ok_global_loop"
] |
[] |
MIT License
| 1,111 |
|
google__mobly-164
|
464a16aee403100025085846f0b6a5e29620e5b6
|
2017-03-23 02:48:42
|
777e2f766959889d12108024be0070fd0939dd6a
|
xpconanfan:
Review status: 0 of 4 files reviewed at latest revision, 1 unresolved discussion.
---
*[tests/mobly/utils_test.py, line 33 at r1](https://reviewable.io:443/reviews/google/mobly/164#-Kft4IlohqXOZQbkgvwN:-Kft4IlpLhgfHHd6AJ8z:b-a1kill) ([raw file](https://github.com/google/mobly/blob/7b01a61aa1a22614e0e70eae04eb10370a4c8f4f/tests/mobly/utils_test.py#L33)):*
> ```Python
> "Process .* has terminated"):
> utils.start_standing_subprocess(
> ['sleep','0'], check_health_delay=0.5)
> ```
why the change from 0.1 to 0.5 and str to list?
this does not seem to be related to `exe_cmd`?
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/164)*
<!-- Sent from Reviewable.io -->
adorokhine:
Review status: 0 of 4 files reviewed at latest revision, 1 unresolved discussion.
---
*[tests/mobly/utils_test.py, line 33 at r1](https://reviewable.io:443/reviews/google/mobly/164#-Kft4IlohqXOZQbkgvwN:-Kft95spFobm0QYGR4uD:b-896fix) ([raw file](https://github.com/google/mobly/blob/454b556b53133176e6e1f02ae6e0b3f41739bcb1/tests/mobly/utils_test.py#L33)):*
<details><summary><i>Previously, xpconanfan (Ang Li) wrote…</i></summary><blockquote>
why the change from 0.1 to 0.5 and str to list?
this does not seem to be related to `exe_cmd`?
</blockquote></details>
Done.
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/164)*
<!-- Sent from Reviewable.io -->
dthkao: <img class="emoji" title=":lgtm:" alt=":lgtm:" align="absmiddle" src="https://reviewable.io/lgtm.png" height="20" width="61"/>
---
Review status: 0 of 4 files reviewed at latest revision, 1 unresolved discussion.
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/164#-:-KftHytyvUUIumc_97NM:bnfp4nl)*
<!-- Sent from Reviewable.io -->
xpconanfan:
Review status: 0 of 4 files reviewed at latest revision, 1 unresolved discussion.
---
*[tests/mobly/utils_test.py, line 33 at r1](https://reviewable.io:443/reviews/google/mobly/164#-Kft4IlohqXOZQbkgvwN:-Kg0s0bj_r8a4fdh3Uew:b-yz7gkv) ([raw file](https://github.com/google/mobly/blob/454b556b53133176e6e1f02ae6e0b3f41739bcb1/tests/mobly/utils_test.py#L33)):*
<details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote>
Done.
</blockquote></details>
I still see this being changed to a list.
Is this a leak from the start standing subprocess change?
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/164)*
<!-- Sent from Reviewable.io -->
adorokhine:
Reviewed 3 of 4 files at r1, 1 of 1 files at r2.
Review status: all files reviewed at latest revision, 1 unresolved discussion.
---
*[tests/mobly/utils_test.py, line 33 at r1](https://reviewable.io:443/reviews/google/mobly/164#-Kft4IlohqXOZQbkgvwN:-Kg1Ig0bDteHmFq-Yszy:brssb8g) ([raw file](https://github.com/google/mobly/blob/454b556b53133176e6e1f02ae6e0b3f41739bcb1/tests/mobly/utils_test.py#L33)):*
<details><summary><i>Previously, xpconanfan (Ang Li) wrote…</i></summary><blockquote>
I still see this being changed to a list.
Is this a leak from the start standing subprocess change?
</blockquote></details>
Thanks, good catch. Done.
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/164)*
<!-- Sent from Reviewable.io -->
xpconanfan: <img class="emoji" title=":lgtm:" alt=":lgtm:" align="absmiddle" src="https://reviewable.io/lgtm.png" height="20" width="61"/>
---
Review status: all files reviewed at latest revision, 1 unresolved discussion.
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/164#-:-KgFrMky1iYJR0yzvtbz:bnfp4nl)*
<!-- Sent from Reviewable.io -->
|
diff --git a/mobly/controllers/sniffer_lib/local/local_base.py b/mobly/controllers/sniffer_lib/local/local_base.py
index 859c242..781e4b6 100644
--- a/mobly/controllers/sniffer_lib/local/local_base.py
+++ b/mobly/controllers/sniffer_lib/local/local_base.py
@@ -54,9 +54,10 @@ class SnifferLocalBase(sniffer.Sniffer):
self._base_configs = base_configs
try:
- utils.exe_cmd("ifconfig", self._interface, "down")
- utils.exe_cmd("iwconfig", self._interface, "mode", "monitor")
- utils.exe_cmd("ifconfig", self._interface, "up")
+ subprocess.check_call(['ifconfig', self._interface, 'down'])
+ subprocess.check_call(
+ ['iwconfig', self._interface, 'mode', 'monitor'])
+ subprocess.check_call(['ifconfig', self._interface, 'up'])
except Exception as err:
raise sniffer.ExecutionError(err)
@@ -87,8 +88,11 @@ class SnifferLocalBase(sniffer.Sniffer):
if sniffer.Sniffer.CONFIG_KEY_CHANNEL in final_configs:
try:
- utils.exe_cmd("iwconfig", self._interface, "channel",
- str(final_configs[sniffer.Sniffer.CONFIG_KEY_CHANNEL]))
+ subprocess.check_call([
+ 'iwconfig',
+ self._interface,
+ 'channel',
+ str(final_configs[sniffer.Sniffer.CONFIG_KEY_CHANNEL])])
except Exception as err:
raise sniffer.ExecutionError(err)
diff --git a/mobly/utils.py b/mobly/utils.py
index ba47c60..c9be01e 100644
--- a/mobly/utils.py
+++ b/mobly/utils.py
@@ -280,27 +280,6 @@ def concurrent_exec(func, param_list):
return return_vals
-def exe_cmd(*cmds):
- """Executes commands in a new shell.
-
- Args:
- cmds: A sequence of commands and arguments.
-
- Returns:
- The output of the command run.
-
- Raises:
- OSError is raised if an error occurred during the command execution.
- """
- cmd = ' '.join(cmds)
- proc = subprocess.Popen(
- cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
- (out, err) = proc.communicate()
- if not err:
- return out
- raise OSError(err)
-
-
def _assert_subprocess_running(proc):
"""Checks if a subprocess has terminated on its own.
@@ -368,14 +347,21 @@ def stop_standing_subprocess(proc, kill_signal=signal.SIGTERM):
_assert_subprocess_running(proc)
process = psutil.Process(pid)
success = True
- for child in process.children(recursive=True):
+ try:
+ children = process.children(recursive=True)
+ except AttributeError:
+ # Handle versions <3.0.0 of psutil.
+ children = process.get_children(recursive=True)
+ for child in children:
try:
child.kill()
+ child.wait(timeout=10)
except:
success = False
logging.exception('Failed to kill standing subprocess %d', child.pid)
try:
process.kill()
+ process.wait(timeout=10)
except:
success = False
logging.exception('Failed to kill standing subprocess %d', pid)
|
Flake in unit tests
Reported in #87
https://travis-ci.org/google/mobly/jobs/197104959
=================================== FAILURES ===================================
____________________ UtilsTest.test_start_standing_subproc _____________________
self = <tests.mobly.utils_test.UtilsTest testMethod=test_start_standing_subproc>
def test_start_standing_subproc(self):
with self.assertRaisesRegexp(utils.Error,
"Process .* has terminated"):
\> utils.start_standing_subprocess("sleep 0", check_health_delay=0.1)
E AssertionError: Error not raised
tests/mobly/utils_test.py:32: AssertionErro
|
google/mobly
|
diff --git a/tests/mobly/controllers/android_device_test.py b/tests/mobly/controllers/android_device_test.py
index c5b3733..3a0940e 100755
--- a/tests/mobly/controllers/android_device_test.py
+++ b/tests/mobly/controllers/android_device_test.py
@@ -209,8 +209,7 @@ class AndroidDeviceTest(unittest.TestCase):
@mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
return_value=mock_android_device.MockFastbootProxy(1))
@mock.patch('mobly.utils.create_dir')
- @mock.patch('mobly.utils.exe_cmd')
- def test_AndroidDevice_take_bug_report(self, exe_mock, create_dir_mock,
+ def test_AndroidDevice_take_bug_report(self, create_dir_mock,
FastbootProxy, MockAdbProxy):
"""Verifies AndroidDevice.take_bug_report calls the correct adb command
and writes the bugreport file to the correct path.
@@ -227,8 +226,7 @@ class AndroidDeviceTest(unittest.TestCase):
@mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
return_value=mock_android_device.MockFastbootProxy(1))
@mock.patch('mobly.utils.create_dir')
- @mock.patch('mobly.utils.exe_cmd')
- def test_AndroidDevice_take_bug_report_fail(self, exe_mock, create_dir_mock,
+ def test_AndroidDevice_take_bug_report_fail(self, create_dir_mock,
FastbootProxy, MockAdbProxy):
"""Verifies AndroidDevice.take_bug_report writes out the correct message
when taking bugreport fails.
@@ -245,8 +243,7 @@ class AndroidDeviceTest(unittest.TestCase):
@mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
return_value=mock_android_device.MockFastbootProxy(1))
@mock.patch('mobly.utils.create_dir')
- @mock.patch('mobly.utils.exe_cmd')
- def test_AndroidDevice_take_bug_report_fallback(self, exe_mock,
+ def test_AndroidDevice_take_bug_report_fallback(self,
create_dir_mock, FastbootProxy, MockAdbProxy):
"""Verifies AndroidDevice.take_bug_report falls back to traditional
bugreport on builds that do not have bugreportz.
diff --git a/tests/mobly/utils_test.py b/tests/mobly/utils_test.py
index fb2f519..de618a5 100755
--- a/tests/mobly/utils_test.py
+++ b/tests/mobly/utils_test.py
@@ -32,6 +32,11 @@ class UtilsTest(unittest.TestCase):
utils.start_standing_subprocess("sleep 0", check_health_delay=0.1)
def test_stop_standing_subproc(self):
+ p = utils.start_standing_subprocess('sleep 5')
+ utils.stop_standing_subprocess(p)
+ self.assertIsNotNone(p.poll())
+
+ def test_stop_standing_subproc_already_dead(self):
p = utils.start_standing_subprocess("sleep 0")
time.sleep(0.1)
with self.assertRaisesRegexp(utils.Error,
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 2
}
|
1.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
exceptiongroup==1.2.2
future==1.0.0
iniconfig==2.1.0
-e git+https://github.com/google/mobly.git@464a16aee403100025085846f0b6a5e29620e5b6#egg=mobly
mock==1.0.1
packaging==24.2
pluggy==1.5.0
psutil==7.0.0
pytest==8.3.5
pytz==2025.2
PyYAML==6.0.2
tomli==2.2.1
|
name: mobly
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- exceptiongroup==1.2.2
- future==1.0.0
- iniconfig==2.1.0
- mock==1.0.1
- packaging==24.2
- pluggy==1.5.0
- psutil==7.0.0
- pytest==8.3.5
- pytz==2025.2
- pyyaml==6.0.2
- tomli==2.2.1
prefix: /opt/conda/envs/mobly
|
[
"tests/mobly/utils_test.py::UtilsTest::test_stop_standing_subproc"
] |
[] |
[
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_build_info",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_cat_adb_log",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_debug_tag",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_instantiation",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet_dup_attribute_name",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet_dup_package",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet_dup_snippet_name",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_snippet_cleanup",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_bug_report",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_bug_report_fail",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_bug_report_fallback",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_logcat",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_logcat_with_user_param",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_dict_list",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_empty_config",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_no_valid_config",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_not_list_config",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_pickup_all",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_string_list",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_no_match",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_success_with_serial",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_success_with_serial_and_extra_field",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_too_many_matches",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_start_services_on_ads",
"tests/mobly/utils_test.py::UtilsTest::test_is_port_available_negative",
"tests/mobly/utils_test.py::UtilsTest::test_is_port_available_positive",
"tests/mobly/utils_test.py::UtilsTest::test_start_standing_subproc",
"tests/mobly/utils_test.py::UtilsTest::test_stop_standing_subproc_already_dead"
] |
[] |
Apache License 2.0
| 1,112 |
google__mobly-165
|
464a16aee403100025085846f0b6a5e29620e5b6
|
2017-03-23 03:39:23
|
777e2f766959889d12108024be0070fd0939dd6a
|
dthkao: <img class="emoji" title=":lgtm:" alt=":lgtm:" align="absmiddle" src="https://reviewable.io/lgtm.png" height="20" width="61"/>
---
Review status: 0 of 1 files reviewed at latest revision, all discussions resolved.
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/165#-:-KftLp8GHK_38kOJw7je:bnfp4nl)*
<!-- Sent from Reviewable.io -->
dthkao: THANKS!
---
Review status: 0 of 1 files reviewed at latest revision, all discussions resolved.
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/165#-:-KftLtV6H66npyt40ciz:bp121n7)*
<!-- Sent from Reviewable.io -->
|
diff --git a/mobly/controllers/sniffer_lib/local/local_base.py b/mobly/controllers/sniffer_lib/local/local_base.py
index 859c242..781e4b6 100644
--- a/mobly/controllers/sniffer_lib/local/local_base.py
+++ b/mobly/controllers/sniffer_lib/local/local_base.py
@@ -54,9 +54,10 @@ class SnifferLocalBase(sniffer.Sniffer):
self._base_configs = base_configs
try:
- utils.exe_cmd("ifconfig", self._interface, "down")
- utils.exe_cmd("iwconfig", self._interface, "mode", "monitor")
- utils.exe_cmd("ifconfig", self._interface, "up")
+ subprocess.check_call(['ifconfig', self._interface, 'down'])
+ subprocess.check_call(
+ ['iwconfig', self._interface, 'mode', 'monitor'])
+ subprocess.check_call(['ifconfig', self._interface, 'up'])
except Exception as err:
raise sniffer.ExecutionError(err)
@@ -87,8 +88,11 @@ class SnifferLocalBase(sniffer.Sniffer):
if sniffer.Sniffer.CONFIG_KEY_CHANNEL in final_configs:
try:
- utils.exe_cmd("iwconfig", self._interface, "channel",
- str(final_configs[sniffer.Sniffer.CONFIG_KEY_CHANNEL]))
+ subprocess.check_call([
+ 'iwconfig',
+ self._interface,
+ 'channel',
+ str(final_configs[sniffer.Sniffer.CONFIG_KEY_CHANNEL])])
except Exception as err:
raise sniffer.ExecutionError(err)
diff --git a/mobly/utils.py b/mobly/utils.py
index ba47c60..338c4e8 100644
--- a/mobly/utils.py
+++ b/mobly/utils.py
@@ -280,27 +280,6 @@ def concurrent_exec(func, param_list):
return return_vals
-def exe_cmd(*cmds):
- """Executes commands in a new shell.
-
- Args:
- cmds: A sequence of commands and arguments.
-
- Returns:
- The output of the command run.
-
- Raises:
- OSError is raised if an error occurred during the command execution.
- """
- cmd = ' '.join(cmds)
- proc = subprocess.Popen(
- cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
- (out, err) = proc.communicate()
- if not err:
- return out
- raise OSError(err)
-
-
def _assert_subprocess_running(proc):
"""Checks if a subprocess has terminated on its own.
@@ -339,10 +318,16 @@ def start_standing_subprocess(cmd, check_health_delay=0):
"""
proc = subprocess.Popen(
cmd,
+ stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True)
logging.debug('Start standing subprocess with cmd: %s', cmd)
+ # Leaving stdin open causes problems for input, e.g. breaking the
+ # code.inspect() shell (http://stackoverflow.com/a/25512460/1612937), so
+ # explicitly close it assuming it is not needed for standing subprocesses.
+ proc.stdin.close()
+ proc.stdin = None
if check_health_delay > 0:
time.sleep(check_health_delay)
_assert_subprocess_running(proc)
@@ -368,14 +353,21 @@ def stop_standing_subprocess(proc, kill_signal=signal.SIGTERM):
_assert_subprocess_running(proc)
process = psutil.Process(pid)
success = True
- for child in process.children(recursive=True):
+ try:
+ children = process.children(recursive=True)
+ except AttributeError:
+ # Handle versions <3.0.0 of psutil.
+ children = process.get_children(recursive=True)
+ for child in children:
try:
child.kill()
+ child.wait(timeout=10)
except:
success = False
logging.exception('Failed to kill standing subprocess %d', child.pid)
try:
process.kill()
+ process.wait(timeout=10)
except:
success = False
logging.exception('Failed to kill standing subprocess %d', pid)
|
Flake in unit tests
Reported in #87
https://travis-ci.org/google/mobly/jobs/197104959
=================================== FAILURES ===================================
____________________ UtilsTest.test_start_standing_subproc _____________________
self = <tests.mobly.utils_test.UtilsTest testMethod=test_start_standing_subproc>
def test_start_standing_subproc(self):
with self.assertRaisesRegexp(utils.Error,
"Process .* has terminated"):
\> utils.start_standing_subprocess("sleep 0", check_health_delay=0.1)
E AssertionError: Error not raised
tests/mobly/utils_test.py:32: AssertionErro
|
google/mobly
|
diff --git a/tests/mobly/controllers/android_device_test.py b/tests/mobly/controllers/android_device_test.py
index c5b3733..3a0940e 100755
--- a/tests/mobly/controllers/android_device_test.py
+++ b/tests/mobly/controllers/android_device_test.py
@@ -209,8 +209,7 @@ class AndroidDeviceTest(unittest.TestCase):
@mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
return_value=mock_android_device.MockFastbootProxy(1))
@mock.patch('mobly.utils.create_dir')
- @mock.patch('mobly.utils.exe_cmd')
- def test_AndroidDevice_take_bug_report(self, exe_mock, create_dir_mock,
+ def test_AndroidDevice_take_bug_report(self, create_dir_mock,
FastbootProxy, MockAdbProxy):
"""Verifies AndroidDevice.take_bug_report calls the correct adb command
and writes the bugreport file to the correct path.
@@ -227,8 +226,7 @@ class AndroidDeviceTest(unittest.TestCase):
@mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
return_value=mock_android_device.MockFastbootProxy(1))
@mock.patch('mobly.utils.create_dir')
- @mock.patch('mobly.utils.exe_cmd')
- def test_AndroidDevice_take_bug_report_fail(self, exe_mock, create_dir_mock,
+ def test_AndroidDevice_take_bug_report_fail(self, create_dir_mock,
FastbootProxy, MockAdbProxy):
"""Verifies AndroidDevice.take_bug_report writes out the correct message
when taking bugreport fails.
@@ -245,8 +243,7 @@ class AndroidDeviceTest(unittest.TestCase):
@mock.patch('mobly.controllers.android_device_lib.fastboot.FastbootProxy',
return_value=mock_android_device.MockFastbootProxy(1))
@mock.patch('mobly.utils.create_dir')
- @mock.patch('mobly.utils.exe_cmd')
- def test_AndroidDevice_take_bug_report_fallback(self, exe_mock,
+ def test_AndroidDevice_take_bug_report_fallback(self,
create_dir_mock, FastbootProxy, MockAdbProxy):
"""Verifies AndroidDevice.take_bug_report falls back to traditional
bugreport on builds that do not have bugreportz.
diff --git a/tests/mobly/utils_test.py b/tests/mobly/utils_test.py
index fb2f519..73ea149 100755
--- a/tests/mobly/utils_test.py
+++ b/tests/mobly/utils_test.py
@@ -29,11 +29,16 @@ class UtilsTest(unittest.TestCase):
def test_start_standing_subproc(self):
with self.assertRaisesRegexp(utils.Error,
"Process .* has terminated"):
- utils.start_standing_subprocess("sleep 0", check_health_delay=0.1)
+ utils.start_standing_subprocess("sleep 0", check_health_delay=0.5)
def test_stop_standing_subproc(self):
+ p = utils.start_standing_subprocess('sleep 5')
+ utils.stop_standing_subprocess(p)
+ self.assertIsNotNone(p.poll())
+
+ def test_stop_standing_subproc_already_dead(self):
p = utils.start_standing_subprocess("sleep 0")
- time.sleep(0.1)
+ time.sleep(0.5)
with self.assertRaisesRegexp(utils.Error,
"Process .* has terminated"):
utils.stop_standing_subprocess(p)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 2
}
|
1.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
future==1.0.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
-e git+https://github.com/google/mobly.git@464a16aee403100025085846f0b6a5e29620e5b6#egg=mobly
mock==1.0.1
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
psutil==7.0.0
pytest @ file:///croot/pytest_1738938843180/work
pytz==2025.2
PyYAML==6.0.2
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
|
name: mobly
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- future==1.0.0
- mock==1.0.1
- psutil==7.0.0
- pytz==2025.2
- pyyaml==6.0.2
prefix: /opt/conda/envs/mobly
|
[
"tests/mobly/utils_test.py::UtilsTest::test_stop_standing_subproc"
] |
[] |
[
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_build_info",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_cat_adb_log",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_debug_tag",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_instantiation",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet_dup_attribute_name",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet_dup_package",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet_dup_snippet_name",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_snippet_cleanup",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_bug_report",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_bug_report_fail",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_bug_report_fallback",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_logcat",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_logcat_with_user_param",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_dict_list",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_empty_config",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_no_valid_config",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_not_list_config",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_pickup_all",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_string_list",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_no_match",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_success_with_serial",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_success_with_serial_and_extra_field",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_too_many_matches",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_start_services_on_ads",
"tests/mobly/utils_test.py::UtilsTest::test_is_port_available_negative",
"tests/mobly/utils_test.py::UtilsTest::test_is_port_available_positive",
"tests/mobly/utils_test.py::UtilsTest::test_start_standing_subproc",
"tests/mobly/utils_test.py::UtilsTest::test_stop_standing_subproc_already_dead"
] |
[] |
Apache License 2.0
| 1,113 |
colour-science__colour-314
|
c8d6d39746fc04f65306acfabe636d81229965cd
|
2017-03-23 08:27:50
|
3cd6ab8d4c3483bcdeb2d7ef33967160808c0bb2
|
diff --git a/colour/models/rgb/transfer_functions/bt_1886.py b/colour/models/rgb/transfer_functions/bt_1886.py
index 73fb873e9..a366685f9 100644
--- a/colour/models/rgb/transfer_functions/bt_1886.py
+++ b/colour/models/rgb/transfer_functions/bt_1886.py
@@ -41,7 +41,7 @@ __all__ = ['oetf_BT1886',
'eotf_BT1886']
-def oetf_BT1886(L, L_B=64, L_W=940):
+def oetf_BT1886(L, L_B=0, L_W=1):
"""
Defines *Recommendation ITU-R BT.1886* opto-electrical transfer function
(OETF / OECF).
@@ -69,7 +69,7 @@ def oetf_BT1886(L, L_B=64, L_W=940):
Examples
--------
- >>> oetf_BT1886(277.98159179331145) # doctest: +ELLIPSIS
+ >>> oetf_BT1886(0.11699185725296059) # doctest: +ELLIPSIS
0.4090077...
"""
@@ -92,7 +92,7 @@ def oetf_BT1886(L, L_B=64, L_W=940):
return V
-def eotf_BT1886(V, L_B=64, L_W=940):
+def eotf_BT1886(V, L_B=0, L_W=1):
"""
Defines *Recommendation ITU-R BT.1886* electro-optical transfer function
(EOTF / EOCF).
@@ -118,7 +118,7 @@ def eotf_BT1886(V, L_B=64, L_W=940):
Examples
--------
>>> eotf_BT1886(0.409007728864150) # doctest: +ELLIPSIS
- 277.9815917...
+ 0.1169918...
"""
V = np.asarray(V)
|
Change "L_B" and "L_W" default argument values for "BT.1886" eotf.
Current default values are 64 and 940, i.e. 10-bit black and white code values. L_B and L_W should be screen luminance in cd/m^2 if the function is to return absolute luminance, or e.g. 0 and 1 to return normalised values.
|
colour-science/colour
|
diff --git a/colour/models/rgb/transfer_functions/tests/tests_bt_1886.py b/colour/models/rgb/transfer_functions/tests/tests_bt_1886.py
index b9254dd3a..d259abb97 100644
--- a/colour/models/rgb/transfer_functions/tests/tests_bt_1886.py
+++ b/colour/models/rgb/transfer_functions/tests/tests_bt_1886.py
@@ -38,18 +38,18 @@ oetf_BT1886` definition.
"""
self.assertAlmostEqual(
- oetf_BT1886(64.0),
+ oetf_BT1886(0.0),
0.0,
places=7)
self.assertAlmostEqual(
- oetf_BT1886(184.32),
- 0.268401363726554,
+ oetf_BT1886(0.016317514686316),
+ 0.18,
places=7)
self.assertAlmostEqual(
- oetf_BT1886(940),
- 1.000000000000000,
+ oetf_BT1886(1.0),
+ 1.0,
places=7)
def test_n_dimensional_oetf_BT1886(self):
@@ -58,8 +58,8 @@ oetf_BT1886` definition.
oetf_BT1886` definition n-dimensional arrays support.
"""
- L = 184.32
- V = 0.268401363726554
+ L = 0.016317514686316
+ V = 0.18
np.testing.assert_almost_equal(
oetf_BT1886(L),
V,
@@ -111,17 +111,17 @@ eotf_BT1886` definition.
self.assertAlmostEqual(
eotf_BT1886(0.0),
- 64.0,
+ 0.0,
places=7)
self.assertAlmostEqual(
eotf_BT1886(0.18),
- 136.58617957,
+ 0.016317514686316,
places=7)
self.assertAlmostEqual(
eotf_BT1886(1.0),
- 940.00000000,
+ 1.0,
places=7)
def test_n_dimensional_eotf_BT1886(self):
@@ -131,7 +131,7 @@ eotf_BT1886` definition n-dimensional arrays support.
"""
V = 0.18
- L = 136.58617957
+ L = 0.016317514686316
np.testing.assert_almost_equal(
eotf_BT1886(V),
L,
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[tests]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.5",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
-e git+https://github.com/colour-science/colour.git@c8d6d39746fc04f65306acfabe636d81229965cd#egg=colour_science
coverage==6.2
execnet==1.9.0
flake8==5.0.4
importlib-metadata==4.2.0
iniconfig==1.1.1
mccabe==0.7.0
nose==1.3.7
numpy==1.19.5
packaging==21.3
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
pyparsing==3.1.4
pytest==7.0.1
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
scipy==1.5.4
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: colour
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- coverage==6.2
- execnet==1.9.0
- flake8==5.0.4
- importlib-metadata==4.2.0
- iniconfig==1.1.1
- mccabe==0.7.0
- nose==1.3.7
- numpy==1.19.5
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pycodestyle==2.9.1
- pyflakes==2.5.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-asyncio==0.16.0
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-xdist==3.0.2
- scipy==1.5.4
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/colour
|
[
"colour/models/rgb/transfer_functions/tests/tests_bt_1886.py::TestOetf_BT1886::test_n_dimensional_oetf_BT1886",
"colour/models/rgb/transfer_functions/tests/tests_bt_1886.py::TestOetf_BT1886::test_oetf_BT1886",
"colour/models/rgb/transfer_functions/tests/tests_bt_1886.py::TestEotf_BT1886::test_eotf_BT1886",
"colour/models/rgb/transfer_functions/tests/tests_bt_1886.py::TestEotf_BT1886::test_n_dimensional_eotf_BT1886"
] |
[] |
[
"colour/models/rgb/transfer_functions/tests/tests_bt_1886.py::TestOetf_BT1886::test_nan_oetf_BT1886",
"colour/models/rgb/transfer_functions/tests/tests_bt_1886.py::TestEotf_BT1886::test_nan_eotf_BT1886"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 1,114 |
|
openmrslab__suspect-46
|
964f2460e46378c29e78d280f999128f34e829df
|
2017-03-28 13:30:47
|
964f2460e46378c29e78d280f999128f34e829df
|
coveralls:
[](https://coveralls.io/builds/10809685)
Coverage increased (+0.5%) to 75.646% when pulling **ff8d94bd9539a608b8588295309b45ac9a9ffb5d on 45_twix_transform** into **964f2460e46378c29e78d280f999128f34e829df on master**.
|
diff --git a/suspect/_transforms.py b/suspect/_transforms.py
index 78bc68a..caddbfe 100644
--- a/suspect/_transforms.py
+++ b/suspect/_transforms.py
@@ -38,3 +38,33 @@ def transformation_matrix(x_vector, y_vector, translation, spacing):
for j in range(4):
matrix[i, j] *= spacing[j]
return matrix
+
+
+def rotation_matrix(angle, axis):
+ """
+ Creates a 3x3 matrix which rotates `angle` radians around `axis`
+
+ Parameters
+ ----------
+ angle : float
+ The angle in radians to rotate around the axis
+ axis : array
+ The unit vector around which to rotate
+
+ Returns
+ -------
+ matrix : array
+ """
+ c = numpy.cos(angle)
+ s = numpy.sin(angle)
+ matrix = numpy.zeros((3, 3))
+ matrix[0, 0] = c + axis[0] ** 2 * (1 - c)
+ matrix[0, 1] = axis[0] * axis[1] * (1 - c) - axis[2] * s
+ matrix[0, 2] = axis[0] * axis[2] * (1 - c) + axis[1] * s
+ matrix[1, 0] = axis[1] * axis[0] * (1 - c) + axis[2] * s
+ matrix[1, 1] = c + axis[1] ** 2 * (1 - c)
+ matrix[1, 2] = axis[1] * axis[2] * (1 - c) - axis[0] * s
+ matrix[2, 0] = axis[2] * axis[0] * (1 - c) - axis[1] * s
+ matrix[2, 1] = axis[2] * axis[1] * (1 - c) + axis[0] * s
+ matrix[2, 2] = c + axis[2] ** 2 * (1 - c)
+ return matrix
diff --git a/suspect/_version.py b/suspect/_version.py
index d3ec452..acafb4d 100644
--- a/suspect/_version.py
+++ b/suspect/_version.py
@@ -1,1 +1,1 @@
-__version__ = "0.2.0"
+__version__ = "0.3.0a"
diff --git a/suspect/io/twix.py b/suspect/io/twix.py
index 6f5c335..9daa82b 100644
--- a/suspect/io/twix.py
+++ b/suspect/io/twix.py
@@ -1,7 +1,8 @@
-from suspect import MRSData
+from suspect import MRSData, transformation_matrix, rotation_matrix
import struct
import numpy
+#import quaternion
import re
# This file largely relies on information from Siemens regarding the structure
@@ -58,13 +59,25 @@ class TwixBuilder(object):
"patient_id": self.header_params["patient_id"],
"patient_birthdate": self.header_params["patient_birthdate"]
}
- mrs_data = MRSData(data, self.header_params["dt"], self.header_params["f0"], metadata=metadata)
+ mrs_data = MRSData(data,
+ self.header_params["dt"],
+ self.header_params["f0"],
+ metadata=metadata,
+ transform=self.header_params["transform"])
return mrs_data
+def read_double(name, header_string):
+ substring = re.search(r"<ParamDouble.\"{}\"> {{ <Precision> \d+( -?[0-9\.]+)? }}".format(name), header_string)
+ if not substring:
+ raise KeyError(r'ParamDouble."{}" not found in header string'.format(name))
+ number_string = substring.group(1)
+ return float(number_string) if number_string else 0
+
+
def parse_twix_header(header_string):
- # print(header_string)
+ #print(header_string)
# get the name of the protocol being acquired
protocol_name_string = re.search(r"<ParamString.\"tProtocolName\"> { \".+\" }\n", header_string).group()
protocol_name = protocol_name_string.split("\"")[3]
@@ -100,12 +113,49 @@ def parse_twix_header(header_string):
break
else:
raise KeyError("Unable to identify Dwell Time from header")
+
+ # get voxel size
+ ro_fov = read_double("VoI_RoFOV", header_string)
+ pe_fov = read_double("VoI_PeFOV", header_string)
+ slice_thickness = read_double("VoI_SliceThickness", header_string)
+
+ # get position information
+ pos_sag = read_double("VoI_Position_Sag", header_string)
+ pos_cor = read_double("VoI_Position_Cor", header_string)
+ pos_tra = read_double("VoI_Position_Tra", header_string)
+
+ # get orientation information
+ in_plane_rot = read_double("VoI_InPlaneRotAngle", header_string)
+ normal_sag = read_double("VoI_Normal_Sag", header_string)
+ normal_cor = read_double("VoI_Normal_Cor", header_string)
+ normal_tra = read_double("VoI_Normal_Tra", header_string)
+
+ # the orientation is stored in a somewhat strange way - a normal vector and
+ # a rotation angle. to get the row vector, we first use Gram-Schmidt to
+ # make [-1, 0, 0] (the default row vector) orthogonal to the normal, and
+ # then rotate that vector by the rotation angle (which we do here with a
+ # quaternion (not any more, quaternion library has issues with Travis)
+ x_vector = numpy.array([-1, 0, 0])
+ normal_vector = numpy.array([normal_sag, normal_cor, normal_tra])
+ orthogonal_x = x_vector - numpy.dot(x_vector, normal_vector) * normal_vector
+ orthonormal_x = orthogonal_x / numpy.linalg.norm(orthogonal_x)
+ #rotation_quaternion = quaternion.from_rotation_vector(in_plane_rot * normal_vector)
+ #row_vector2 = quaternion.rotate_vectors(rotation_quaternion, orthonormal_x)
+ rot_matrix = rotation_matrix(in_plane_rot, normal_vector)
+ row_vector = numpy.dot(rot_matrix, orthonormal_x)
+ column_vector = numpy.cross(row_vector, normal_vector)
+ transform = transformation_matrix(row_vector,
+ column_vector,
+ [pos_sag, pos_cor, pos_tra],
+ [ro_fov, pe_fov, slice_thickness])
+
return {"protocol_name": protocol_name,
"patient_name": patient_name,
"patient_id": patient_id,
"patient_birthdate": patient_birthday,
"dt": dwell_time,
- "f0": frequency
+ "f0": frequency,
+ "transform": transform
}
|
Get spatial information out of twix files
At the moment, only rda files load a transform to enable them to be co-registered to structural MRI images. It should in theory be possible to read this information out of the twix file as well.
|
openmrslab/suspect
|
diff --git a/tests/test_mrs/test_twix.py b/tests/test_mrs/test_twix.py
index 4c95f5f..2b3b374 100644
--- a/tests/test_mrs/test_twix.py
+++ b/tests/test_mrs/test_twix.py
@@ -15,6 +15,12 @@ def test_veriofile():
assert data.np == 2048
assert data.dt == 2.5e-4
numpy.testing.assert_almost_equal(data.f0, 123.261716)
+ numpy.testing.assert_allclose(data.transform, numpy.array(
+ [[-20, 0, 0, 4.917676],
+ [0, 20, 0, 57.525424],
+ [0, 0, -20, 43.220339],
+ [0, 0, 0, 1]]
+ ))
#def test_skyra():
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 3,
"test_score": 2
},
"num_modified_files": 3
}
|
0.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"mock"
],
"pre_install": null,
"python": "3.5",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
asteval==0.9.26
async-generator==1.10
attrs==22.2.0
Babel==2.11.0
backcall==0.2.0
bleach==4.1.0
certifi==2021.5.30
charset-normalizer==2.0.12
decorator==5.1.1
defusedxml==0.7.1
docutils==0.18.1
entrypoints==0.4
future==1.0.0
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
iniconfig==1.1.1
ipykernel==5.5.6
ipython==7.16.3
ipython-genutils==0.2.0
jedi==0.17.2
Jinja2==3.0.3
jsonschema==3.2.0
jupyter-client==7.1.2
jupyter-core==4.9.2
jupyterlab-pygments==0.1.2
lmfit==1.0.3
MarkupSafe==2.0.1
mistune==0.8.4
mock==5.2.0
nbclient==0.5.9
nbconvert==6.0.7
nbformat==5.1.3
nbsphinx==0.8.8
nest-asyncio==1.6.0
numpy==1.19.5
packaging==21.3
pandocfilters==1.5.1
Parsley==1.3
parso==0.7.1
pexpect==4.9.0
pickleshare==0.7.5
pluggy==1.0.0
prompt-toolkit==3.0.36
ptyprocess==0.7.0
py==1.11.0
pydicom==2.3.1
Pygments==2.14.0
pyparsing==3.1.4
pyrsistent==0.18.0
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
PyWavelets==1.1.1
pyzmq==25.1.2
requests==2.27.1
scipy==1.5.4
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
-e git+https://github.com/openmrslab/suspect.git@964f2460e46378c29e78d280f999128f34e829df#egg=suspect
testpath==0.6.0
tomli==1.2.3
tornado==6.1
traitlets==4.3.3
typing_extensions==4.1.1
uncertainties==3.1.7
urllib3==1.26.20
wcwidth==0.2.13
webencodings==0.5.1
zipp==3.6.0
|
name: suspect
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- asteval==0.9.26
- async-generator==1.10
- attrs==22.2.0
- babel==2.11.0
- backcall==0.2.0
- bleach==4.1.0
- charset-normalizer==2.0.12
- decorator==5.1.1
- defusedxml==0.7.1
- docutils==0.18.1
- entrypoints==0.4
- future==1.0.0
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- ipykernel==5.5.6
- ipython==7.16.3
- ipython-genutils==0.2.0
- jedi==0.17.2
- jinja2==3.0.3
- jsonschema==3.2.0
- jupyter-client==7.1.2
- jupyter-core==4.9.2
- jupyterlab-pygments==0.1.2
- lmfit==1.0.3
- markupsafe==2.0.1
- mistune==0.8.4
- mock==5.2.0
- nbclient==0.5.9
- nbconvert==6.0.7
- nbformat==5.1.3
- nbsphinx==0.8.8
- nest-asyncio==1.6.0
- numpy==1.19.5
- packaging==21.3
- pandocfilters==1.5.1
- parsley==1.3
- parso==0.7.1
- pexpect==4.9.0
- pickleshare==0.7.5
- pluggy==1.0.0
- prompt-toolkit==3.0.36
- ptyprocess==0.7.0
- py==1.11.0
- pydicom==2.3.1
- pygments==2.14.0
- pyparsing==3.1.4
- pyrsistent==0.18.0
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pywavelets==1.1.1
- pyzmq==25.1.2
- requests==2.27.1
- scipy==1.5.4
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==5.3.0
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- testpath==0.6.0
- tomli==1.2.3
- tornado==6.1
- traitlets==4.3.3
- typing-extensions==4.1.1
- uncertainties==3.1.7
- urllib3==1.26.20
- wcwidth==0.2.13
- webencodings==0.5.1
- zipp==3.6.0
prefix: /opt/conda/envs/suspect
|
[
"tests/test_mrs/test_twix.py::test_veriofile"
] |
[] |
[
"tests/test_mrs/test_twix.py::test_twix_nofile"
] |
[] |
MIT License
| 1,122 |
EMCECS__python-ecsclient-30
|
546e342440f7ca0274d222179c6eca790d1d6573
|
2017-03-29 10:38:47
|
40a22c4eb202e60d1c8fe6a7f925f4783b0d6a82
|
coveralls:
[](https://coveralls.io/builds/10825849)
Coverage increased (+0.3%) to 55.697% when pulling **799e48d6f2d54291c624f05e5a8774b4fbcf0da3 on bug-logout** into **546e342440f7ca0274d222179c6eca790d1d6573 on master**.
coveralls:
[](https://coveralls.io/builds/10825849)
Coverage increased (+0.3%) to 55.697% when pulling **799e48d6f2d54291c624f05e5a8774b4fbcf0da3 on bug-logout** into **546e342440f7ca0274d222179c6eca790d1d6573 on master**.
coveralls:
[](https://coveralls.io/builds/10825849)
Coverage increased (+0.3%) to 55.697% when pulling **799e48d6f2d54291c624f05e5a8774b4fbcf0da3 on bug-logout** into **546e342440f7ca0274d222179c6eca790d1d6573 on master**.
|
diff --git a/ecsclient/authentication.py b/ecsclient/authentication.py
index 0e8ae84..31fb0c4 100644
--- a/ecsclient/authentication.py
+++ b/ecsclient/authentication.py
@@ -23,6 +23,11 @@ class Authentication(object):
:param force: If you have multiple sessions running simultaneously this
forces the termination of all tokens to the current user
"""
+
+ if not self.conn.get_current_token():
+ log.warning('Not logging out since the client has no token set up')
+ return
+
params = {
'force': force
}
diff --git a/ecsclient/baseclient.py b/ecsclient/baseclient.py
index e9dd6cf..485238a 100644
--- a/ecsclient/baseclient.py
+++ b/ecsclient/baseclient.py
@@ -84,11 +84,20 @@ class Client(object):
"""
return self._token_request.get_new_token()
+ def get_current_token(self):
+ """
+ Get the current token in use. None if the client is logged out or not yet logged in
+ """
+ return self._token_request.token
+
def remove_cached_token(self):
"""
Remove the cached token file, this is useful if you switch users
and want to use a different token
"""
+ self.token = None
+ self._token_request.token = None
+
if os.path.isfile(self.token_path):
log.debug("Removing cached token '{0}'".format(self.token_path))
os.remove(self.token_path)
|
Two logouts issued when only one logout() executed.
I am using a single logout() command, but the requests sent by the code I see two been issued. The problem is the first one succeed (200) and the second call fails (probably because the first 200).
|
EMCECS/python-ecsclient
|
diff --git a/tests/unit/test_authentication.py b/tests/unit/test_authentication.py
index 814018f..82de270 100644
--- a/tests/unit/test_authentication.py
+++ b/tests/unit/test_authentication.py
@@ -1,3 +1,4 @@
+import logging
import testtools
from mock import mock
from requests.auth import _basic_auth_str
@@ -12,6 +13,7 @@ class TestAuthentication(testtools.TestCase):
LOGOUT_URL = 'http://127.0.0.1:4443/logout'
def setUp(self, *args, **kwargs):
+ # logging.basicConfig(level=logging.DEBUG)
super(TestAuthentication, self).setUp(*args, **kwargs)
self.client = Client(username='someone',
password='password',
@@ -19,61 +21,105 @@ class TestAuthentication(testtools.TestCase):
token_endpoint='http://127.0.0.1:4443/login')
self.requests_mock = self.useFixture(fixture.Fixture())
- @mock.patch('ecsclient.baseclient.os.path.isfile')
- def test_get_token_valid_credentials(self, mock_isfile):
- mock_isfile.return_value = False
- self.requests_mock.register_uri('GET', self.LOGIN_URL, headers={'X-SDS-AUTH-TOKEN': 'token'})
+ def test_get_token_valid_credentials(self):
+ self.requests_mock.register_uri('GET', self.LOGIN_URL, headers={'X-SDS-AUTH-TOKEN': 'FAKE-TOKEN-123'})
self.assertIsNone(self.client.token)
- self.assertIsNone(self.client._token_request._get_existing_token())
token = self.client.get_token()
- self.assertEqual(token, 'token')
- self.assertEqual(self.client._token_request._get_existing_token(), 'token')
+ self.assertEqual(token, 'FAKE-TOKEN-123')
+ self.assertEqual(self.client._token_request.token, 'FAKE-TOKEN-123')
self.assertEqual(self.requests_mock.last_request.method, 'GET')
self.assertEqual(self.requests_mock.last_request.url, self.LOGIN_URL)
self.assertEqual(self.requests_mock.last_request.headers['authorization'],
_basic_auth_str('someone', 'password'))
- @mock.patch('ecsclient.baseclient.os.path.isfile')
- def test_get_token_invalid_credentials(self, mock_isfile):
- mock_isfile.return_value = False
+ def test_get_token_invalid_credentials(self):
self.requests_mock.register_uri('GET', self.LOGIN_URL, status_code=401, text='body')
with super(testtools.TestCase, self).assertRaises(ECSClientException) as error:
self.client.get_token()
exception = error.exception
+ self.assertIsNone(self.client._token_request.token)
self.assertEqual(exception.message, 'Invalid username or password')
self.assertEqual(exception.http_response_content, 'body')
self.assertEqual(exception.http_status, 401)
- self.assertIsNone(self.client._token_request._get_existing_token())
self.assertEqual(self.requests_mock.last_request.method, 'GET')
self.assertEqual(self.requests_mock.last_request.url, self.LOGIN_URL)
self.assertEqual(self.requests_mock.last_request.headers['authorization'],
_basic_auth_str('someone', 'password'))
- @mock.patch('ecsclient.common.token_request.TokenRequest.get_token')
- def test_logout(self, mock_get_token):
- mock_get_token.return_value = 'token'
+ @mock.patch('ecsclient.baseclient.os.remove')
+ @mock.patch('ecsclient.baseclient.os.path.isfile')
+ def test_logout(self, mock_isfile, mock_remove):
+ self.client.token = 'FAKE-TOKEN-123'
+ self.client._token_request.token = 'FAKE-TOKEN-123'
self.requests_mock.register_uri('GET', self.LOGOUT_URL, text="{'user': 'someone'}")
+ mock_isfile.return_value = True
+ mock_remove.return_value = True
resp = self.client.authentication.logout()
self.assertEqual(resp, "{'user': 'someone'}")
+ self.assertIsNone(self.client.token)
+ self.assertIsNone(self.client._token_request.token)
+ mock_isfile.assert_called_with('/tmp/ecsclient.tkn')
+ mock_remove.assert_called_with('/tmp/ecsclient.tkn')
self.assertEqual(self.requests_mock.last_request.method, 'GET')
self.assertEqual(self.requests_mock.last_request.url, self.LOGOUT_URL)
- self.assertEqual(self.requests_mock.last_request.headers['x-sds-auth-token'], 'token')
+ self.assertEqual(self.requests_mock.last_request.headers['x-sds-auth-token'], 'FAKE-TOKEN-123')
- @mock.patch('ecsclient.common.token_request.TokenRequest.get_token')
- def test_logout_force(self, mock_get_token):
- mock_get_token.return_value = 'token'
+ @mock.patch('ecsclient.baseclient.os.remove')
+ @mock.patch('ecsclient.baseclient.os.path.isfile')
+ def test_logout_force(self, mock_isfile, mock_remove):
+ self.client.token = 'FAKE-TOKEN-123'
+ self.client._token_request.token = 'FAKE-TOKEN-123'
self.requests_mock.register_uri('GET', self.LOGOUT_URL + '?force=True', text="{'user': 'someone'}")
+ mock_isfile.return_value = True
+ mock_remove.return_value = True
resp = self.client.authentication.logout(force=True)
self.assertEqual(resp, "{'user': 'someone'}")
+ self.assertIsNone(self.client.token)
+ self.assertIsNone(self.client._token_request.token)
+ mock_isfile.assert_called_with('/tmp/ecsclient.tkn')
+ mock_remove.assert_called_with('/tmp/ecsclient.tkn')
self.assertEqual(self.requests_mock.last_request.method, 'GET')
self.assertEqual(self.requests_mock.last_request.url, self.LOGOUT_URL + '?force=True')
self.assertEqual(self.requests_mock.last_request.qs['force'], ['true'])
- self.assertEqual(self.requests_mock.last_request.headers['x-sds-auth-token'], 'token')
+ self.assertEqual(self.requests_mock.last_request.headers['x-sds-auth-token'], 'FAKE-TOKEN-123')
+
+ def test_logout_when_logged_out(self):
+ self.client._token_request.token = 'FAKE-TOKEN-123'
+ self.client._token_request.cache_token = False
+ self.requests_mock.register_uri('GET', self.LOGOUT_URL, text="{'user': 'someone'}")
+ self.requests_mock.register_uri('GET', 'http://127.0.0.1:4443/user/whoami')
+
+ resp = self.client.authentication.logout()
+
+ self.assertEqual(resp, "{'user': 'someone'}")
+
+ resp2 = self.client.authentication.logout()
+
+ self.assertIsNone(resp2)
+
+ def test_logout_and_reconnect(self):
+ self.client.token = 'FAKE-TOKEN-123'
+ self.client._token_request.token = 'FAKE-TOKEN-123'
+ self.client._token_request.cache_token = False
+ self.requests_mock.register_uri('GET', self.LOGOUT_URL, text="{'user': 'someone'}")
+
+ self.client.authentication.logout()
+
+ self.assertIsNone(self.client.token)
+ self.assertIsNone(self.client._token_request.token)
+
+ self.requests_mock.register_uri('GET', self.LOGIN_URL, headers={'X-SDS-AUTH-TOKEN': 'NEW-TOKEN-123'})
+
+ self.client.get('login')
+
+ self.assertEqual(self.client._token_request.token, 'NEW-TOKEN-123')
+
+
diff --git a/tests/unit/test_ecsclient.py b/tests/unit/test_ecsclient.py
index 0d5cf14..d24ad9c 100644
--- a/tests/unit/test_ecsclient.py
+++ b/tests/unit/test_ecsclient.py
@@ -66,6 +66,7 @@ class TestEcsClient(unittest.TestCase):
password='password',
ecs_endpoint='https://192.168.1.10')
exception = error.exception.message
+ mock_isfile.assert_called_with('/tmp/ecsclient.tkn')
self.assertEqual("'token_endpoint' not provided and missing 'token'|'token_path'", str(exception))
def test_client_without_credentials(self):
@@ -112,6 +113,7 @@ class TestEcsClient(unittest.TestCase):
def test_client_init_with_token_path(self, mock_isfile):
mock_isfile.return_value = True
c = Client(version='3',
- token_path='/tmp/token.tkn',
+ token_path='/tmp/mytoken.tkn',
ecs_endpoint='https://192.168.1.10')
self.assertTrue(hasattr(c, 'token_path'))
+ mock_isfile.assert_called_with('/tmp/mytoken.tkn')
diff --git a/tests/unit/test_node.py b/tests/unit/test_node.py
index c6383c8..5c01719 100644
--- a/tests/unit/test_node.py
+++ b/tests/unit/test_node.py
@@ -45,29 +45,33 @@ class TestNode(testtools.TestCase):
self.response = MagicMock()
self.requests_mock = self.useFixture(fixture.Fixture())
- @mock.patch('ecsclient.common.token_request.TokenRequest.get_new_token')
- def test_get_nodes_should_throw_ecsclientexception(self, mock_get_new_token):
+ @mock.patch('ecsclient.common.token_request.TokenRequest.get_token')
+ def test_get_nodes_throw_exception(self, mock_get_token):
self.requests_mock.register_uri('GET', 'https://127.0.0.1:4443/vdc/nodes',
status_code=http_client.INTERNAL_SERVER_ERROR,
text='Server Error')
- mock_get_new_token.return_value = 'FAKE-TOKEN-123'
+ mock_get_token.return_value = 'FAKE-TOKEN-123'
with super(testtools.TestCase, self).assertRaises(ECSClientException) as error:
self.client.node.get_nodes()
exception = error.exception
+ self.assertEqual(self.requests_mock.last_request.method, 'GET')
+ self.assertEqual(self.requests_mock.last_request.url, 'https://127.0.0.1:4443/vdc/nodes')
+ self.assertEqual(self.requests_mock.last_request.headers['x-sds-auth-token'], 'FAKE-TOKEN-123')
self.assertEqual(exception.http_response_content, 'Server Error')
self.assertEqual(exception.http_status, http_client.INTERNAL_SERVER_ERROR)
- def test_get_nodes(self):
- self.response.status_code = http_client.OK
- self.response.body = self.returned_json
- self.response.json = MagicMock(return_value=self.returned_json)
- self.requests = MagicMock(return_value=self.response)
- self.requests.get.side_effect = [self.response]
+ @mock.patch('ecsclient.common.token_request.TokenRequest.get_token')
+ def test_get_nodes(self, mock_get_token):
+ mock_get_token.return_value = 'FAKE-TOKEN-123'
+ self.requests_mock.register_uri('GET', 'https://127.0.0.1:4443/vdc/nodes',
+ status_code=http_client.OK,
+ json=self.returned_json)
+
+ response = self.client.node.get_nodes()
- with patch('ecsclient.common.token_request.TokenRequest.'
- '_get_existing_token', return_value='FAKE-TOKEN-123'):
- with patch('ecsclient.baseclient.requests.Session.get', self.requests):
- returned_json = self.client.node.get_nodes()
- self.assertEqual(returned_json, self.returned_json)
+ self.assertEqual(self.requests_mock.last_request.method, 'GET')
+ self.assertEqual(self.requests_mock.last_request.url, 'https://127.0.0.1:4443/vdc/nodes')
+ self.assertEqual(self.requests_mock.last_request.headers['x-sds-auth-token'], 'FAKE-TOKEN-123')
+ self.assertEqual(response, self.returned_json)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 2
}
|
1.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"flake8==3.2.1",
"mock==2.0.0",
"nose==1.3.7",
"coverage==4.3.4",
"jsonschema==2.6.0",
"tox==2.6.0",
"testtools==2.2.0",
"requests-mock[fixture]==1.3.0",
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
coverage==4.3.4
distlib==0.3.9
extras==1.0.0
filelock==3.4.1
fixtures==4.0.1
flake8==3.2.1
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
jsonschema==2.6.0
linecache2==1.0.0
mccabe==0.5.3
mock==2.0.0
nose==1.3.7
packaging==21.3
pbr==6.1.1
platformdirs==2.4.0
pluggy==0.13.1
py==1.11.0
pycodestyle==2.2.0
pyflakes==1.3.0
pyparsing==3.1.4
pytest==7.0.1
-e git+https://github.com/EMCECS/python-ecsclient.git@546e342440f7ca0274d222179c6eca790d1d6573#egg=python_ecsclient
python-mimeparse==1.6.0
requests==2.9.1
requests-mock==1.3.0
six==1.10.0
testtools==2.2.0
tomli==1.2.3
tox==2.6.0
traceback2==1.4.0
typing_extensions==4.1.1
unittest2==1.1.0
virtualenv==20.17.1
zipp==3.6.0
|
name: python-ecsclient
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- argparse==1.4.0
- attrs==22.2.0
- coverage==4.3.4
- distlib==0.3.9
- extras==1.0.0
- filelock==3.4.1
- fixtures==4.0.1
- flake8==3.2.1
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- iniconfig==1.1.1
- jsonschema==2.6.0
- linecache2==1.0.0
- mccabe==0.5.3
- mock==2.0.0
- nose==1.3.7
- packaging==21.3
- pbr==6.1.1
- platformdirs==2.4.0
- pluggy==0.13.1
- py==1.11.0
- pycodestyle==2.2.0
- pyflakes==1.3.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-mimeparse==1.6.0
- requests==2.9.1
- requests-mock==1.3.0
- six==1.10.0
- testtools==2.2.0
- tomli==1.2.3
- tox==2.6.0
- traceback2==1.4.0
- typing-extensions==4.1.1
- unittest2==1.1.0
- virtualenv==20.17.1
- zipp==3.6.0
prefix: /opt/conda/envs/python-ecsclient
|
[
"tests/unit/test_authentication.py::TestAuthentication::test_logout",
"tests/unit/test_authentication.py::TestAuthentication::test_logout_and_reconnect",
"tests/unit/test_authentication.py::TestAuthentication::test_logout_force",
"tests/unit/test_authentication.py::TestAuthentication::test_logout_when_logged_out"
] |
[] |
[
"tests/unit/test_authentication.py::TestAuthentication::test_get_token_invalid_credentials",
"tests/unit/test_authentication.py::TestAuthentication::test_get_token_valid_credentials",
"tests/unit/test_ecsclient.py::TestEcsClient::test_client_init_with_credentials",
"tests/unit/test_ecsclient.py::TestEcsClient::test_client_init_with_token",
"tests/unit/test_ecsclient.py::TestEcsClient::test_client_init_with_token_path",
"tests/unit/test_ecsclient.py::TestEcsClient::test_client_unsupported_version",
"tests/unit/test_ecsclient.py::TestEcsClient::test_client_v2_class",
"tests/unit/test_ecsclient.py::TestEcsClient::test_client_v3_class",
"tests/unit/test_ecsclient.py::TestEcsClient::test_client_without_credentials",
"tests/unit/test_ecsclient.py::TestEcsClient::test_client_without_ecs_endpoint",
"tests/unit/test_ecsclient.py::TestEcsClient::test_client_without_token_endpoint",
"tests/unit/test_ecsclient.py::TestEcsClient::test_client_without_version",
"tests/unit/test_ecsclient.py::TestEcsClient::test_verify_attributes",
"tests/unit/test_node.py::TestNode::test_get_nodes",
"tests/unit/test_node.py::TestNode::test_get_nodes_throw_exception"
] |
[] |
Apache License 2.0
| 1,125 |
theskumar__python-dotenv-52
|
9552db8d8c25753ec4f1a724f64d895b9daa6296
|
2017-03-30 09:50:38
|
9552db8d8c25753ec4f1a724f64d895b9daa6296
|
coveralls:
[](https://coveralls.io/builds/10844638)
Coverage remained the same at 82.418% when pulling **a2096aa6fc7425ed5c8d9280cc3acd05a6fa5eab on Flimm:naive-single-quotes** into **9552db8d8c25753ec4f1a724f64d895b9daa6296 on theskumar:master**.
theskumar: @Flimm At the first look it does not seem to fix the issue where parser keeps the `'` quote around the value when reading the `.env` file. thoughts?
Flimm: Sorry, you're right, I forgot to push a third commit. 😳 Have a look now.
coveralls:
[](https://coveralls.io/builds/10845005)
Coverage remained the same at 82.418% when pulling **9b5582ea85c99f704bce9012c2741d28b46981ed on Flimm:naive-single-quotes** into **9552db8d8c25753ec4f1a724f64d895b9daa6296 on theskumar:master**.
coveralls:
[](https://coveralls.io/builds/10845005)
Coverage remained the same at 82.418% when pulling **9b5582ea85c99f704bce9012c2741d28b46981ed on Flimm:naive-single-quotes** into **9552db8d8c25753ec4f1a724f64d895b9daa6296 on theskumar:master**.
coveralls:
[](https://coveralls.io/builds/10845005)
Coverage remained the same at 82.418% when pulling **9b5582ea85c99f704bce9012c2741d28b46981ed on Flimm:naive-single-quotes** into **9552db8d8c25753ec4f1a724f64d895b9daa6296 on theskumar:master**.
theskumar: This is looks pretty good. Love the tests 😍 !
|
diff --git a/README.rst b/README.rst
index 936a5a2..8b2a039 100644
--- a/README.rst
+++ b/README.rst
@@ -126,7 +126,8 @@ update your settings on remote server, handy isn't it!
file in current working directory.
-q, --quote [always|never|auto]
Whether to quote or not the variable values.
- Default mode is always.
+ Default mode is always. This does not affect
+ parsing.
--help Show this message and exit.
Commands:
diff --git a/dotenv/cli.py b/dotenv/cli.py
index 9a99314..125a0a8 100644
--- a/dotenv/cli.py
+++ b/dotenv/cli.py
@@ -11,7 +11,7 @@ from .main import get_key, dotenv_values, set_key, unset_key
help="Location of the .env file, defaults to .env file in current working directory.")
@click.option('-q', '--quote', default='always',
type=click.Choice(['always', 'never', 'auto']),
- help="Whether to quote or not the variable values. Default mode is always.")
+ help="Whether to quote or not the variable values. Default mode is always. This does not affect parsing.")
@click.pass_context
def cli(ctx, file, quote):
'''This script is used to set, get or unset values from a .env file.'''
diff --git a/dotenv/main.py b/dotenv/main.py
index 2fe1a83..ceac3fa 100644
--- a/dotenv/main.py
+++ b/dotenv/main.py
@@ -103,7 +103,7 @@ def parse_dotenv(dotenv_path):
k, v = k.strip(), v.strip()
if len(v) > 0:
- quoted = v[0] == v[len(v) - 1] == '"'
+ quoted = v[0] == v[len(v) - 1] in ['"', "'"]
if quoted:
v = decode_escaped(v[1:-1])
|
Wrong parsing of env variables in single quotes
I have the following `.env` file:
```
DATABASE_URL='postgres://localhost:5432/myapp_development'
```
When I run `dotenv get DATABASE_URL` this is what I get:
`DATABASE_URL="'postgres://localhost:5432/simulator_development'"`
When I try to use this with [dj-database-url](https://github.com/kennethreitz/dj-database-url) it is failing to parse the `DATABASE_URL` environment variable as it is.
It seems using single quotes in the `.env` file is causing this.
It would be nice if this were documented somewhere if the behavior is intended
I spent quite a bit of time trying to figure out where the error was.
Thanks 😃
|
theskumar/python-dotenv
|
diff --git a/tests/test_cli.py b/tests/test_cli.py
index d78172b..449b54a 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -46,6 +46,18 @@ def test_key_value_without_quotes():
sh.rm(dotenv_path)
+def test_value_with_quotes():
+ with open(dotenv_path, 'w') as f:
+ f.write('TEST="two words"\n')
+ assert dotenv.get_key(dotenv_path, 'TEST') == 'two words'
+ sh.rm(dotenv_path)
+
+ with open(dotenv_path, 'w') as f:
+ f.write("TEST='two words'\n")
+ assert dotenv.get_key(dotenv_path, 'TEST') == 'two words'
+ sh.rm(dotenv_path)
+
+
def test_unset():
sh.touch(dotenv_path)
success, key_to_set, value_to_set = dotenv.set_key(dotenv_path, 'HELLO', 'WORLD')
@@ -104,6 +116,13 @@ def test_get_key_with_interpolation(cli):
dotenv.set_key(dotenv_path, 'FOO', '${HELLO}')
dotenv.set_key(dotenv_path, 'BAR', 'CONCATENATED_${HELLO}_POSIX_VAR')
+ lines = list(open(dotenv_path, "r").readlines())
+ assert lines == [
+ 'HELLO="WORLD"\n',
+ 'FOO="${HELLO}"\n',
+ 'BAR="CONCATENATED_${HELLO}_POSIX_VAR"\n',
+ ]
+
# test replace from variable in file
stored_value = dotenv.get_key(dotenv_path, 'FOO')
assert stored_value == 'WORLD'
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 3
}
|
0.6
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"flake8"
],
"pre_install": null,
"python": "3.5",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
bump2version==1.0.1
bumpversion==0.6.0
certifi==2021.5.30
click==8.0.4
coverage==6.2
flake8==5.0.4
importlib-metadata==4.2.0
iniconfig==1.1.1
mccabe==0.7.0
packaging==21.3
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
pytest-flake8==1.1.1
-e git+https://github.com/theskumar/python-dotenv.git@9552db8d8c25753ec4f1a724f64d895b9daa6296#egg=python_dotenv
sh==1.14.3
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: python-dotenv
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- bump2version==1.0.1
- bumpversion==0.6.0
- click==8.0.4
- coverage==6.2
- flake8==5.0.4
- importlib-metadata==4.2.0
- iniconfig==1.1.1
- mccabe==0.7.0
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pycodestyle==2.9.1
- pyflakes==2.5.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- pytest-flake8==1.1.1
- sh==1.14.3
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/python-dotenv
|
[
"tests/test_cli.py::test_value_with_quotes"
] |
[
"tests/test_cli.py::test_list_wo_file"
] |
[
"tests/test_cli.py::test_get_key",
"tests/test_cli.py::test_list",
"tests/test_cli.py::test_key_value_without_quotes",
"tests/test_cli.py::test_unset",
"tests/test_cli.py::test_console_script",
"tests/test_cli.py::test_default_path",
"tests/test_cli.py::test_get_key_with_interpolation",
"tests/test_cli.py::test_get_key_with_interpolation_of_unset_variable"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 1,127 |
pypa__pip-4393
|
985dd899e023fc50f18def2ff6991a25d91ebef8
|
2017-03-31 01:31:40
|
46e41dec1f30e2576a0a10abec18fb1a2150188d
|
diff --git a/news/3236.bugfix b/news/3236.bugfix
new file mode 100644
index 000000000..51d358458
--- /dev/null
+++ b/news/3236.bugfix
@@ -0,0 +1,1 @@
+"Support URL-encoded characters in URL credentials."
diff --git a/pip/download.py b/pip/download.py
index 41709db5e..894d0ff9a 100644
--- a/pip/download.py
+++ b/pip/download.py
@@ -21,6 +21,7 @@ except ImportError:
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves.urllib import request as urllib_request
+from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote
import pip
@@ -207,8 +208,9 @@ class MultiDomainBasicAuth(AuthBase):
if "@" in netloc:
userinfo = netloc.rsplit("@", 1)[0]
if ":" in userinfo:
- return userinfo.split(":", 1)
- return userinfo, None
+ user, pwd = userinfo.split(":", 1)
+ return (urllib_unquote(user), urllib_unquote(pwd))
+ return urllib_unquote(userinfo), None
return None, None
|
Failure to authenticate private repository when URL-encoded character in password
See https://github.com/pypa/pip/issues/51#issuecomment-128548720
I have this issue with pip 7.1.2. There's a symbol in the password that needs url-encoding.
With the password url-encoded, pip fails to authenticate (gets a 401 response) and prompts for username/password interactively. It then works fine if I enter the user/pass interactively. Like @bcbrown I suspect it's not url-decoding the password.
|
pypa/pip
|
diff --git a/tests/unit/test_download.py b/tests/unit/test_download.py
index ee4b11c7d..1630393f0 100644
--- a/tests/unit/test_download.py
+++ b/tests/unit/test_download.py
@@ -13,7 +13,7 @@ import pip
from pip.exceptions import HashMismatch
from pip.download import (
PipSession, SafeFileCache, path_to_url, unpack_http_url, url_to_path,
- unpack_file_url,
+ unpack_file_url, MultiDomainBasicAuth
)
from pip.index import Link
from pip.utils.hashes import Hashes
@@ -333,3 +333,14 @@ class TestPipSession:
)
assert not hasattr(session.adapters["https://example.com/"], "cache")
+
+
+def test_parse_credentials():
+ auth = MultiDomainBasicAuth()
+ assert auth.parse_credentials("foo:[email protected]") == ('foo', 'bar')
+ assert auth.parse_credentials("[email protected]") == ('foo', None)
+ assert auth.parse_credentials("example.com") == (None, None)
+
+ # URL-encoded reserved characters:
+ assert auth.parse_credentials("user%3Aname:%23%40%[email protected]") \
+ == ("user:name", "#@^")
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_added_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 1
}
|
9.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-rerunfailures",
"pytest-timeout",
"pytest-xdist",
"freezegun",
"mock",
"pretend",
"pyyaml",
"setuptools>=39.2.0",
"scripttest",
"virtualenv",
"wheel"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
coverage==7.8.0
distlib==0.3.9
exceptiongroup==1.2.0
execnet==2.1.1
filelock==3.18.0
freezegun==1.5.1
iniconfig==1.1.1
mock==5.2.0
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
pretend==1.0.9
pytest==8.3.4
pytest-cov==6.0.0
pytest-rerunfailures==15.0
pytest-timeout==2.3.1
pytest-xdist==3.6.1
python-dateutil==2.9.0.post0
PyYAML==6.0.2
scripttest==2.0
six==1.17.0
tomli==2.0.1
virtualenv==20.29.3
|
name: pip
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==7.8.0
- distlib==0.3.9
- execnet==2.1.1
- filelock==3.18.0
- freezegun==1.5.1
- mock==5.2.0
- pip==10.0.0.dev0
- platformdirs==4.3.7
- pretend==1.0.9
- pytest-cov==6.0.0
- pytest-rerunfailures==15.0
- pytest-timeout==2.3.1
- pytest-xdist==3.6.1
- python-dateutil==2.9.0.post0
- pyyaml==6.0.2
- scripttest==2.0
- six==1.17.0
- virtualenv==20.29.3
prefix: /opt/conda/envs/pip
|
[
"tests/unit/test_download.py::test_parse_credentials"
] |
[] |
[
"tests/unit/test_download.py::test_unpack_http_url_with_urllib_response_without_content_type",
"tests/unit/test_download.py::test_user_agent",
"tests/unit/test_download.py::test_unpack_http_url_bad_downloaded_checksum",
"tests/unit/test_download.py::test_path_to_url_unix",
"tests/unit/test_download.py::test_url_to_path_unix",
"tests/unit/test_download.py::Test_unpack_file_url::test_unpack_file_url_no_download",
"tests/unit/test_download.py::Test_unpack_file_url::test_unpack_file_url_and_download",
"tests/unit/test_download.py::Test_unpack_file_url::test_unpack_file_url_download_already_exists",
"tests/unit/test_download.py::Test_unpack_file_url::test_unpack_file_url_bad_hash",
"tests/unit/test_download.py::Test_unpack_file_url::test_unpack_file_url_download_bad_hash",
"tests/unit/test_download.py::Test_unpack_file_url::test_unpack_file_url_thats_a_dir",
"tests/unit/test_download.py::TestSafeFileCache::test_cache_roundtrip",
"tests/unit/test_download.py::TestSafeFileCache::test_safe_get_no_perms",
"tests/unit/test_download.py::TestSafeFileCache::test_safe_set_no_perms",
"tests/unit/test_download.py::TestSafeFileCache::test_safe_delete_no_perms",
"tests/unit/test_download.py::TestPipSession::test_cache_defaults_off",
"tests/unit/test_download.py::TestPipSession::test_cache_is_enabled",
"tests/unit/test_download.py::TestPipSession::test_http_cache_is_not_enabled",
"tests/unit/test_download.py::TestPipSession::test_insecure_host_cache_is_not_enabled"
] |
[] |
MIT License
| 1,133 |
|
Azure__WALinuxAgent-642
|
c6704cbad83b93763cf2403a77197559a67b9dca
|
2017-03-31 23:16:29
|
6e9b985c1d7d564253a1c344bab01b45093103cd
|
diff --git a/azurelinuxagent/common/event.py b/azurelinuxagent/common/event.py
index 9265820a..fb2c97c7 100644
--- a/azurelinuxagent/common/event.py
+++ b/azurelinuxagent/common/event.py
@@ -65,8 +65,17 @@ class EventLogger(object):
if not os.path.exists(self.event_dir):
os.mkdir(self.event_dir)
os.chmod(self.event_dir, 0o700)
- if len(os.listdir(self.event_dir)) > 1000:
- raise EventError("Too many files under: {0}".format(self.event_dir))
+
+ existing_events = os.listdir(self.event_dir)
+ if len(existing_events) >= 1000:
+ existing_events.sort()
+ oldest_files = existing_events[:-999]
+ logger.warn("Too many files under: {0}, removing oldest".format(self.event_dir))
+ try:
+ for f in oldest_files:
+ os.remove(os.path.join(self.event_dir, f))
+ except IOError as e:
+ raise EventError(e)
filename = os.path.join(self.event_dir,
ustr(int(time.time() * 1000000)))
diff --git a/azurelinuxagent/ga/exthandlers.py b/azurelinuxagent/ga/exthandlers.py
index 70bb246e..9d3cec3f 100644
--- a/azurelinuxagent/ga/exthandlers.py
+++ b/azurelinuxagent/ga/exthandlers.py
@@ -221,9 +221,9 @@ class ExtHandlersHandler(object):
self.log_etag = True
- state = ext_handler.properties.state
+ state = ext_handler.properties.state.lower()
ext_handler_i.logger.info("Expected handler state: {0}", state)
- if state == "enabled":
+ if state == u"enabled":
self.handle_enable(ext_handler_i)
elif state == u"disabled":
self.handle_disable(ext_handler_i)
@@ -709,7 +709,7 @@ class ExtHandlerInstance(object):
heartbeat = json.loads(heartbeat_json)[0]['heartbeat']
except IOError as e:
raise ExtensionError("Failed to get heartbeat file:{0}".format(e))
- except ValueError as e:
+ except (ValueError, KeyError) as e:
raise ExtensionError("Malformed heartbeat file: {0}".format(e))
return heartbeat
diff --git a/azurelinuxagent/ga/update.py b/azurelinuxagent/ga/update.py
index 53f01736..61d9f470 100644
--- a/azurelinuxagent/ga/update.py
+++ b/azurelinuxagent/ga/update.py
@@ -27,6 +27,7 @@ import signal
import subprocess
import sys
import time
+import traceback
import zipfile
import azurelinuxagent.common.conf as conf
@@ -250,6 +251,7 @@ class UpdateHandler(object):
except Exception as e:
logger.warn(u"Agent {0} failed with exception: {1}", CURRENT_AGENT, ustr(e))
+ logger.warn(traceback.format_exc())
sys.exit(1)
return
|
Agent crash should log traceback
When the extension handler crashes we get a generic 'agent crashed', we should log a traceback here.
|
Azure/WALinuxAgent
|
diff --git a/tests/common/test_event.py b/tests/common/test_event.py
new file mode 100644
index 00000000..726474cd
--- /dev/null
+++ b/tests/common/test_event.py
@@ -0,0 +1,90 @@
+# Copyright 2017 Microsoft Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Requires Python 2.4+ and Openssl 1.0+
+#
+
+from __future__ import print_function
+
+from tests.tools import *
+from azurelinuxagent.common.event import *
+
+
+class TestEvent(AgentTestCase):
+ def test_save_event(self):
+ tmp_evt = tempfile.mkdtemp()
+ init_event_logger(tmp_evt)
+ add_event('test', message='test event')
+ self.assertTrue(len(os.listdir(tmp_evt)) == 1)
+ shutil.rmtree(tmp_evt)
+
+ def test_save_event_rollover(self):
+ tmp_evt = tempfile.mkdtemp()
+ init_event_logger(tmp_evt)
+ add_event('test', message='first event')
+ for i in range(0, 999):
+ add_event('test', message='test event {0}'.format(i))
+
+ events = os.listdir(tmp_evt)
+ events.sort()
+ self.assertTrue(len(events) == 1000)
+
+ first_event = os.path.join(tmp_evt, events[0])
+ with open(first_event) as first_fh:
+ first_event_text = first_fh.read()
+ self.assertTrue('first event' in first_event_text)
+
+ add_event('test', message='last event')
+ events = os.listdir(tmp_evt)
+ events.sort()
+ self.assertTrue(len(events) == 1000, "{0} events found, 1000 expected".format(len(events)))
+
+ first_event = os.path.join(tmp_evt, events[0])
+ with open(first_event) as first_fh:
+ first_event_text = first_fh.read()
+ self.assertFalse('first event' in first_event_text)
+ self.assertTrue('test event 0' in first_event_text)
+
+ last_event = os.path.join(tmp_evt, events[-1])
+ with open(last_event) as last_fh:
+ last_event_text = last_fh.read()
+ self.assertTrue('last event' in last_event_text)
+
+ shutil.rmtree(tmp_evt)
+
+ def test_save_event_cleanup(self):
+ tmp_evt = tempfile.mkdtemp()
+ init_event_logger(tmp_evt)
+
+ for i in range(0, 2000):
+ evt = os.path.join(tmp_evt, '{0}.tld'.format(ustr(1491004920536531 + i)))
+ with open(evt, 'w') as fh:
+ fh.write('test event {0}'.format(i))
+
+ events = os.listdir(tmp_evt)
+ self.assertTrue(len(events) == 2000, "{0} events found, 2000 expected".format(len(events)))
+ add_event('test', message='last event')
+
+ events = os.listdir(tmp_evt)
+ events.sort()
+ self.assertTrue(len(events) == 1000, "{0} events found, 1000 expected".format(len(events)))
+ first_event = os.path.join(tmp_evt, events[0])
+ with open(first_event) as first_fh:
+ first_event_text = first_fh.read()
+ self.assertTrue('test event 1001' in first_event_text)
+
+ last_event = os.path.join(tmp_evt, events[-1])
+ with open(last_event) as last_fh:
+ last_event_text = last_fh.read()
+ self.assertTrue('last event' in last_event_text)
diff --git a/tests/ga/test_update.py b/tests/ga/test_update.py
index 46502cc7..46d06735 100644
--- a/tests/ga/test_update.py
+++ b/tests/ga/test_update.py
@@ -1083,7 +1083,6 @@ class TestUpdate(UpdateTestCase):
self._test_run_latest(mock_child=mock_child, mock_time=mock_time)
self.assertEqual(1, mock_child.poll.call_count)
self.assertEqual(0, mock_child.wait.call_count)
- self.assertEqual(2, mock_time.time_call_count)
return
def test_run_latest_defaults_to_current(self):
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 3
}
|
2.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pyasn1",
"nose",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.4",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
nose==1.3.7
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyasn1==0.5.1
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
-e git+https://github.com/Azure/WALinuxAgent.git@c6704cbad83b93763cf2403a77197559a67b9dca#egg=WALinuxAgent
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: WALinuxAgent
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- nose==1.3.7
- pyasn1==0.5.1
prefix: /opt/conda/envs/WALinuxAgent
|
[
"tests/common/test_event.py::TestEvent::test_save_event_cleanup",
"tests/common/test_event.py::TestEvent::test_save_event_rollover"
] |
[] |
[
"tests/common/test_event.py::TestEvent::test_save_event",
"tests/ga/test_update.py::TestGuestAgentError::test_clear",
"tests/ga/test_update.py::TestGuestAgentError::test_creation",
"tests/ga/test_update.py::TestGuestAgentError::test_load_preserves_error_state",
"tests/ga/test_update.py::TestGuestAgentError::test_mark_failure",
"tests/ga/test_update.py::TestGuestAgentError::test_mark_failure_permanent",
"tests/ga/test_update.py::TestGuestAgentError::test_save",
"tests/ga/test_update.py::TestGuestAgentError::test_str",
"tests/ga/test_update.py::TestGuestAgent::test_clear_error",
"tests/ga/test_update.py::TestGuestAgent::test_creation",
"tests/ga/test_update.py::TestGuestAgent::test_download",
"tests/ga/test_update.py::TestGuestAgent::test_download_fail",
"tests/ga/test_update.py::TestGuestAgent::test_download_fallback",
"tests/ga/test_update.py::TestGuestAgent::test_ensure_download_skips_blacklisted",
"tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded",
"tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded_download_fails",
"tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded_load_manifest_fails",
"tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded_unpack_fails",
"tests/ga/test_update.py::TestGuestAgent::test_is_available",
"tests/ga/test_update.py::TestGuestAgent::test_is_blacklisted",
"tests/ga/test_update.py::TestGuestAgent::test_is_downloaded",
"tests/ga/test_update.py::TestGuestAgent::test_load_error",
"tests/ga/test_update.py::TestGuestAgent::test_load_manifest",
"tests/ga/test_update.py::TestGuestAgent::test_load_manifest_is_empty",
"tests/ga/test_update.py::TestGuestAgent::test_load_manifest_is_malformed",
"tests/ga/test_update.py::TestGuestAgent::test_load_manifest_missing",
"tests/ga/test_update.py::TestGuestAgent::test_mark_failure",
"tests/ga/test_update.py::TestGuestAgent::test_unpack",
"tests/ga/test_update.py::TestGuestAgent::test_unpack_fail",
"tests/ga/test_update.py::TestUpdate::test_creation",
"tests/ga/test_update.py::TestUpdate::test_emit_restart_event_emits_event_if_not_clean_start",
"tests/ga/test_update.py::TestUpdate::test_emit_restart_event_writes_sentinal_file",
"tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans",
"tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans_ignores_exceptions",
"tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans_kills_after_interval",
"tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans_skips_if_no_orphans",
"tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_ignores_installed_agent",
"tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_raises_exception_for_restarting_agent",
"tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_resets_with_new_agent",
"tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_will_not_raise_exception_for_long_restarts",
"tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_will_not_raise_exception_too_few_restarts",
"tests/ga/test_update.py::TestUpdate::test_filter_blacklisted_agents",
"tests/ga/test_update.py::TestUpdate::test_get_latest_agent",
"tests/ga/test_update.py::TestUpdate::test_get_latest_agent_excluded",
"tests/ga/test_update.py::TestUpdate::test_get_latest_agent_no_updates",
"tests/ga/test_update.py::TestUpdate::test_get_latest_agent_skip_updates",
"tests/ga/test_update.py::TestUpdate::test_get_latest_agent_skips_unavailable",
"tests/ga/test_update.py::TestUpdate::test_get_pid_files",
"tests/ga/test_update.py::TestUpdate::test_get_pid_files_returns_previous",
"tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_false_for_current_agent",
"tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_false_for_exceptions",
"tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_true_sentinal_agent_is_not_current",
"tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_true_when_no_sentinal",
"tests/ga/test_update.py::TestUpdate::test_is_orphaned_returns_false_if_parent_exists",
"tests/ga/test_update.py::TestUpdate::test_is_orphaned_returns_true_if_parent_does_not_exist",
"tests/ga/test_update.py::TestUpdate::test_is_orphaned_returns_true_if_parent_is_init",
"tests/ga/test_update.py::TestUpdate::test_load_agents",
"tests/ga/test_update.py::TestUpdate::test_load_agents_does_reload",
"tests/ga/test_update.py::TestUpdate::test_load_agents_sorts",
"tests/ga/test_update.py::TestUpdate::test_purge_agents",
"tests/ga/test_update.py::TestUpdate::test_run",
"tests/ga/test_update.py::TestUpdate::test_run_clears_sentinal_on_successful_exit",
"tests/ga/test_update.py::TestUpdate::test_run_emits_restart_event",
"tests/ga/test_update.py::TestUpdate::test_run_keeps_running",
"tests/ga/test_update.py::TestUpdate::test_run_latest",
"tests/ga/test_update.py::TestUpdate::test_run_latest_captures_signals",
"tests/ga/test_update.py::TestUpdate::test_run_latest_creates_only_one_signal_handler",
"tests/ga/test_update.py::TestUpdate::test_run_latest_defaults_to_current",
"tests/ga/test_update.py::TestUpdate::test_run_latest_exception_blacklists",
"tests/ga/test_update.py::TestUpdate::test_run_latest_forwards_output",
"tests/ga/test_update.py::TestUpdate::test_run_latest_nonzero_code_marks_failures",
"tests/ga/test_update.py::TestUpdate::test_run_latest_polling_stops_at_failure",
"tests/ga/test_update.py::TestUpdate::test_run_latest_polling_stops_at_success",
"tests/ga/test_update.py::TestUpdate::test_run_latest_polls_and_waits_for_success",
"tests/ga/test_update.py::TestUpdate::test_run_leaves_sentinal_on_unsuccessful_exit",
"tests/ga/test_update.py::TestUpdate::test_run_stops_if_orphaned",
"tests/ga/test_update.py::TestUpdate::test_run_stops_if_update_available",
"tests/ga/test_update.py::TestUpdate::test_set_agents_sets_agents",
"tests/ga/test_update.py::TestUpdate::test_set_agents_sorts_agents",
"tests/ga/test_update.py::TestUpdate::test_set_sentinal",
"tests/ga/test_update.py::TestUpdate::test_set_sentinal_writes_current_agent",
"tests/ga/test_update.py::TestUpdate::test_shutdown",
"tests/ga/test_update.py::TestUpdate::test_shutdown_ignores_exceptions",
"tests/ga/test_update.py::TestUpdate::test_shutdown_ignores_missing_sentinal_file",
"tests/ga/test_update.py::TestUpdate::test_upgrade_available_handles_missing_family",
"tests/ga/test_update.py::TestUpdate::test_upgrade_available_includes_old_agents",
"tests/ga/test_update.py::TestUpdate::test_upgrade_available_purges_old_agents",
"tests/ga/test_update.py::TestUpdate::test_upgrade_available_returns_true_on_first_use",
"tests/ga/test_update.py::TestUpdate::test_upgrade_available_skips_if_too_frequent",
"tests/ga/test_update.py::TestUpdate::test_upgrade_available_skips_if_when_no_new_versions",
"tests/ga/test_update.py::TestUpdate::test_upgrade_available_skips_when_no_versions",
"tests/ga/test_update.py::TestUpdate::test_upgrade_available_skips_when_updates_are_disabled",
"tests/ga/test_update.py::TestUpdate::test_upgrade_available_sorts",
"tests/ga/test_update.py::TestUpdate::test_write_pid_file",
"tests/ga/test_update.py::TestUpdate::test_write_pid_file_ignores_exceptions"
] |
[] |
Apache License 2.0
| 1,139 |
|
nipy__nipype-1937
|
d68b929ae1f36f2704fa7cddd029b308acf8587a
|
2017-04-05 00:47:13
|
14161a590a3166b5a9c0f4afd42ff1acf843a960
|
diff --git a/nipype/interfaces/utility/base.py b/nipype/interfaces/utility/base.py
index 45261c998..03442df20 100644
--- a/nipype/interfaces/utility/base.py
+++ b/nipype/interfaces/utility/base.py
@@ -99,13 +99,29 @@ class IdentityInterface(IOBase):
class MergeInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec):
axis = traits.Enum('vstack', 'hstack', usedefault=True,
desc='direction in which to merge, hstack requires same number of elements in each input')
- no_flatten = traits.Bool(False, usedefault=True, desc='append to outlist instead of extending in vstack mode')
+ no_flatten = traits.Bool(False, usedefault=True,
+ desc='append to outlist instead of extending in vstack mode')
+ ravel_inputs = traits.Bool(False, usedefault=True,
+ desc='ravel inputs when no_flatten is False')
class MergeOutputSpec(TraitedSpec):
out = traits.List(desc='Merged output')
+def _ravel(in_val):
+ if not isinstance(in_val, list):
+ return in_val
+ flat_list = []
+ for val in in_val:
+ raveled_val = _ravel(val)
+ if isinstance(raveled_val, list):
+ flat_list.extend(raveled_val)
+ else:
+ flat_list.append(raveled_val)
+ return flat_list
+
+
class Merge(IOBase):
"""Basic interface class to merge inputs into a single list
@@ -123,23 +139,34 @@ class Merge(IOBase):
>>> out.outputs.out
[1, 2, 5, 3]
- >>> merge = Merge() # Or Merge(1)
- >>> merge.inputs.in_lists = [1, [2, 5], 3]
+ >>> merge = Merge(1)
+ >>> merge.inputs.in1 = [1, [2, 5], 3]
+ >>> out = merge.run()
+ >>> out.outputs.out
+ [1, [2, 5], 3]
+
+ >>> merge = Merge(1)
+ >>> merge.inputs.in1 = [1, [2, 5], 3]
+ >>> merge.inputs.ravel_inputs = True
>>> out = merge.run()
>>> out.outputs.out
[1, 2, 5, 3]
+ >>> merge = Merge(1)
+ >>> merge.inputs.in1 = [1, [2, 5], 3]
+ >>> merge.inputs.no_flatten = True
+ >>> out = merge.run()
+ >>> out.outputs.out
+ [[1, [2, 5], 3]]
"""
input_spec = MergeInputSpec
output_spec = MergeOutputSpec
- def __init__(self, numinputs=1, **inputs):
+ def __init__(self, numinputs=0, **inputs):
super(Merge, self).__init__(**inputs)
self._numinputs = numinputs
- if numinputs > 1:
+ if numinputs >= 1:
input_names = ['in%d' % (i + 1) for i in range(numinputs)]
- elif numinputs == 1:
- input_names = ['in_lists']
else:
input_names = []
add_traits(self.inputs, input_names)
@@ -150,8 +177,6 @@ class Merge(IOBase):
if self._numinputs < 1:
return outputs
- elif self._numinputs == 1:
- values = self.inputs.in_lists
else:
getval = lambda idx: getattr(self.inputs, 'in%d' % (idx + 1))
values = [getval(idx) for idx in range(self._numinputs)
@@ -160,7 +185,8 @@ class Merge(IOBase):
if self.inputs.axis == 'vstack':
for value in values:
if isinstance(value, list) and not self.inputs.no_flatten:
- out.extend(value)
+ out.extend(_ravel(value) if self.inputs.ravel_inputs else
+ value)
else:
out.append(value)
else:
|
New behaviour of Merge interface with breaks generic cases where numinputs=1 at runtime
### Summary
In the current HEAD, the new behaviour of the Merge interface when `numinputs==1` breaks cases (such as mine) where the `numinputs` is set at runtime depending on parameters of the workflow creation code. A better way to handle this would be to see if `in_lists` is defined or perhaps use `numinputs`==None.
### Actual behavior
`TypeError: '_Undefined' object is not iterable`
### Expected behavior
`in1` is taken to be the only element of the merged list
### How to replicate the behavior
```
import nipype.pipeline.engine as pe
from nipype.interfaces.utility.base import Merge
merge = pe.Node(Merge(numinputs=1), name='merge')
merge.inputs.in1 = 1
workflow = pe.Workflow(name='workflow')
workflow.add_nodes([merge])
workflow.run()
```
### Platform details:
please paste the output of: `python -c "import nipype; print(nipype.get_info()); print(nipype.__version__)"`
{'nibabel_version': '2.0.1', 'sys_executable': '/usr/local/opt/python/bin/python2.7', 'networkx_version': '1.11', 'numpy_version': '1.12.0', 'sys_platform': 'darwin', 'sys_version': '2.7.13 (default, Dec 17 2016, 23:03:43) \n[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]', 'commit_source': u'repository', 'commit_hash': '368e184', 'pkg_path': '/Users/tclose/git/nipype/nipype', 'nipype_version': u'0.13.0-g368e184.dev', 'traits_version': '4.6.0', 'scipy_version': '0.14.0'}
0.13.0-g368e184.dev
|
nipy/nipype
|
diff --git a/nipype/interfaces/utility/tests/test_base.py b/nipype/interfaces/utility/tests/test_base.py
index 68f4bed44..3d2fbd2b5 100644
--- a/nipype/interfaces/utility/tests/test_base.py
+++ b/nipype/interfaces/utility/tests/test_base.py
@@ -56,25 +56,20 @@ def test_split(tmpdir, args, expected):
([3], {}, [0, [1, 2], [3, 4, 5]], [0, 1, 2, 3, 4, 5]),
([0], {}, None, None),
([], {}, [], []),
- ([], {}, [0, [1, 2], [3, 4, 5]], [0, 1, 2, 3, 4, 5]),
+ ([], {}, [0, [1, 2], [3, 4, 5]], [0, [1, 2], [3, 4, 5]]),
([3], {'axis': 'hstack'}, [[0], [1, 2], [3, 4, 5]], [[0, 1, 3]]),
([3], {'axis': 'hstack'}, [[0, 1], [2, 3], [4, 5]],
[[0, 2, 4], [1, 3, 5]]),
([3], {'axis': 'hstack'}, [[0, 1], [2, 3], [4, 5]],
[[0, 2, 4], [1, 3, 5]]),
- ([1], {'axis': 'hstack'}, [[0], [1, 2], [3, 4, 5]], [[0, 1, 3]]),
- ([1], {'axis': 'hstack'}, [[0, 1], [2, 3], [4, 5]],
- [[0, 2, 4], [1, 3, 5]]),
])
def test_merge(tmpdir, args, kwargs, in_lists, expected):
os.chdir(str(tmpdir))
node = pe.Node(utility.Merge(*args, **kwargs), name='merge')
- numinputs = args[0] if args else 1
- if numinputs == 1:
- node.inputs.in_lists = in_lists
- elif numinputs > 1:
+ numinputs = args[0] if args else 0
+ if numinputs >= 1:
for i in range(1, numinputs + 1):
setattr(node.inputs, 'in{:d}'.format(i), in_lists[i - 1])
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
0.13
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
click==8.0.4
configparser==5.2.0
coverage==6.2
decorator==4.4.2
funcsigs==1.0.2
future==1.0.0
importlib-metadata==4.8.3
iniconfig==1.1.1
isodate==0.6.1
lxml==5.3.1
networkx==2.5.1
nibabel==3.2.2
-e git+https://github.com/nipy/nipype.git@d68b929ae1f36f2704fa7cddd029b308acf8587a#egg=nipype
numpy==1.19.5
packaging==21.3
pluggy==1.0.0
prov==2.0.1
psutil==7.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
python-dateutil==2.9.0.post0
rdflib==5.0.0
scipy==1.5.4
simplejson==3.20.1
six==1.17.0
tomli==1.2.3
traits==6.4.1
typing_extensions==4.1.1
zipp==3.6.0
|
name: nipype
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- click==8.0.4
- configparser==5.2.0
- coverage==6.2
- decorator==4.4.2
- funcsigs==1.0.2
- future==1.0.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- isodate==0.6.1
- lxml==5.3.1
- networkx==2.5.1
- nibabel==3.2.2
- numpy==1.19.5
- packaging==21.3
- pluggy==1.0.0
- prov==2.0.1
- psutil==7.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- python-dateutil==2.9.0.post0
- rdflib==5.0.0
- scipy==1.5.4
- simplejson==3.20.1
- six==1.17.0
- tomli==1.2.3
- traits==6.4.1
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/nipype
|
[
"nipype/interfaces/utility/tests/test_base.py::test_merge[args2-kwargs2-in_lists2-expected2]",
"nipype/interfaces/utility/tests/test_base.py::test_merge[args3-kwargs3-in_lists3-expected3]"
] |
[] |
[
"nipype/interfaces/utility/tests/test_base.py::test_rename",
"nipype/interfaces/utility/tests/test_base.py::test_split[args0-expected0]",
"nipype/interfaces/utility/tests/test_base.py::test_split[args1-expected1]",
"nipype/interfaces/utility/tests/test_base.py::test_merge[args0-kwargs0-in_lists0-expected0]",
"nipype/interfaces/utility/tests/test_base.py::test_merge[args1-kwargs1-None-None]",
"nipype/interfaces/utility/tests/test_base.py::test_merge[args4-kwargs4-in_lists4-expected4]",
"nipype/interfaces/utility/tests/test_base.py::test_merge[args5-kwargs5-in_lists5-expected5]",
"nipype/interfaces/utility/tests/test_base.py::test_merge[args6-kwargs6-in_lists6-expected6]"
] |
[] |
Apache License 2.0
| 1,151 |
|
jboss-dockerfiles__dogen-101
|
472aa64387e01f6fa7bc529fd8b9f5fc12b5dee7
|
2017-04-05 14:20:24
|
bc9263c5b683fdf901ac1646286ee3908b85dcdc
|
diff --git a/dogen/templates/template.jinja b/dogen/templates/template.jinja
index 84e3c4c..170fd59 100644
--- a/dogen/templates/template.jinja
+++ b/dogen/templates/template.jinja
@@ -63,9 +63,10 @@ COPY repos/*.repo /etc/yum.repos.d/
COPY *.rpm /tmp/rpms/
{% endif %}
-# Install required RPMs
+# Install required RPMs and ensure that the packages were installed
RUN yum install -y {% if additional_repos -%} --disablerepo=\* {%- for repo in additional_repos %} --enablerepo={{ repo }}{% endfor %}{% endif %} {%- for package in packages %} {{ package }}{% endfor %} {%- for rpm in rpms %} /tmp/rpms/{{ rpm }} {% endfor %} \
- && yum clean all
+ && yum clean all && \
+ rpm -q {% for package in packages %} {{ package }}{% endfor %}
{% if additional_repos %}
# Remove custom repo files
|
force a failure if a package installation fails
Yum has some annoying behaviour, if you perform `yum install foo bar baz` and at least one package exists/succeeds, then it will return success. This masks some error conditions: missing package, possible missing repos files etc.
We should generate some additional CMDs to ensure that we bail out if a package does not exist or install.
|
jboss-dockerfiles/dogen
|
diff --git a/tests/test_package.py b/tests/test_package.py
new file mode 100644
index 0000000..b742e65
--- /dev/null
+++ b/tests/test_package.py
@@ -0,0 +1,50 @@
+import argparse
+import mock
+import os
+import tempfile
+import unittest
+import shutil
+import re
+import sys
+
+from dogen.plugins.repo import Repo
+from dogen.generator import Generator
+
+class TestPackage(unittest.TestCase):
+ def setUp(self):
+ self.workdir = tempfile.mkdtemp(prefix='test_repo_plugin')
+ self.descriptor = tempfile.NamedTemporaryFile(delete=False)
+ self.target_dir = os.path.join(self.workdir, "target")
+ self.log = mock.Mock()
+
+ def teardown(self):
+ shutil.rmtree(self.workdir)
+
+ def write_config(self, config):
+ with self.descriptor as f:
+ f.write(config.encode())
+
+ def prepare_dogen(self, repo_files_dir=None):
+ args = argparse.Namespace(path=self.descriptor.name, output=self.target_dir, without_sources=None,
+ template=None, scripts_path=None, additional_script=None,
+ skip_ssl_verification=None, repo_files_dir=repo_files_dir)
+ self.dogen = Generator(self.log, args, [Repo])
+
+ def test_custom_repo_files_should_add_two(self):
+ open(os.path.join(self.workdir, "fedora.repo"), 'a').close()
+ open(os.path.join(self.workdir, "test.repo"), 'a').close()
+
+ self.write_config("release: '1'\nversion: '1'\ncmd:\n - whoami\nfrom: scratch\nname: someimage\npackages:\n - wget")
+ self.prepare_dogen(self.workdir)
+ self.dogen.run()
+
+ self.assertIsNotNone(self.dogen.cfg)
+ self.assertIsNotNone(self.dogen.cfg.get('packages'))
+ self.assertIsInstance(self.dogen.cfg.get('packages'), list)
+ self.assertIn("wget", self.dogen.cfg.get('packages'))
+
+ dockerfile = open(os.path.join(self.target_dir, "Dockerfile")).read()
+
+ sys.stderr.write("\t\t\tDEBUGDEBUG\n{}\n".format(dockerfile))
+ self.assertTrue(re.match(r'.*yum install[^\n]+wget', dockerfile, re.DOTALL))
+ self.assertTrue(re.match(r'.*rpm -q +wget', dockerfile, re.DOTALL))
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 1
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi==2025.1.31
charset-normalizer==3.4.1
coverage==7.8.0
docopt==0.6.2
-e git+https://github.com/jboss-dockerfiles/dogen.git@472aa64387e01f6fa7bc529fd8b9f5fc12b5dee7#egg=dogen
exceptiongroup==1.2.2
idna==3.10
iniconfig==2.1.0
Jinja2==3.1.6
MarkupSafe==3.0.2
mock==5.2.0
packaging==24.2
pluggy==1.5.0
pykwalify==1.8.0
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
PyYAML==6.0.2
requests==2.32.3
ruamel.yaml==0.18.10
ruamel.yaml.clib==0.2.12
six==1.17.0
tomli==2.2.1
urllib3==2.3.0
|
name: dogen
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- certifi==2025.1.31
- charset-normalizer==3.4.1
- coverage==7.8.0
- docopt==0.6.2
- exceptiongroup==1.2.2
- idna==3.10
- iniconfig==2.1.0
- jinja2==3.1.6
- markupsafe==3.0.2
- mock==5.2.0
- packaging==24.2
- pluggy==1.5.0
- pykwalify==1.8.0
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pyyaml==6.0.2
- requests==2.32.3
- ruamel-yaml==0.18.10
- ruamel-yaml-clib==0.2.12
- six==1.17.0
- tomli==2.2.1
- urllib3==2.3.0
prefix: /opt/conda/envs/dogen
|
[
"tests/test_package.py::TestPackage::test_custom_repo_files_should_add_two"
] |
[] |
[] |
[] |
MIT License
| 1,153 |
|
ARMmbed__yotta-804
|
4094b7a26c66dd64ff724d4f72da282d41ea9fca
|
2017-04-06 15:06:03
|
2575c2f7cd0977b5df2347223738629d28e5310b
|
diff --git a/yotta/lib/sourceparse.py b/yotta/lib/sourceparse.py
index 0f451ad..eb1f0b4 100644
--- a/yotta/lib/sourceparse.py
+++ b/yotta/lib/sourceparse.py
@@ -57,7 +57,7 @@ def _getNonRegistryRef(source_url):
# something/something#spec = github
# something/something@spec = github
# something/something spec = github
- github_match = re.match('^([.a-z0-9_-]+/([.a-z0-9_-]+)) *[@#]?([.a-z0-9_\-\*\^\~\>\<\=]*)$', source_url, re.I)
+ github_match = re.match(r'^([.a-z0-9_-]+/([.a-z0-9_-]+)) *[@#]?([^/:\?\[\\]*)$', source_url, re.I)
if github_match:
return github_match.group(2), VersionSource('github', github_match.group(1), github_match.group(3))
|
Semver incompatibility
Hi,
It seems the recent version has broken semantic version for any previous version, which we heavily use in our project, [microbit-dal](https://github.com/lancaster-university/microbit-dal).
We have had two new users on v18 who have reported this breakage: https://github.com/lancaster-university/microbit-dal/issues/282
Any help would be greatly appreciated :smile:
|
ARMmbed/yotta
|
diff --git a/yotta/test/test_sourceparse.py b/yotta/test/test_sourceparse.py
index 0b7af6f..2c421ba 100644
--- a/yotta/test/test_sourceparse.py
+++ b/yotta/test/test_sourceparse.py
@@ -47,6 +47,7 @@ Git_Specs = [
'~1.2.3',
'-1.2.3',
'branch-or-tag-name',
+ 'branch+or+tag+name',
'd5f5049',
]
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 1
},
"num_modified_files": 1
}
|
0.18
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[develop]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
argcomplete==1.12.3
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
colorama==0.3.9
cryptography==44.0.2
Deprecated==1.2.18
exceptiongroup==1.2.2
future==1.0.0
hgapi==1.7.4
idna==3.10
iniconfig==2.1.0
intelhex==2.3.0
intervaltree==3.1.0
Jinja2==2.11.3
jsonpointer==1.14
jsonschema==2.6.0
MarkupSafe==3.0.2
mbed_test_wrapper==1.0.0
packaging==24.2
pathlib==1.0.1
pluggy==1.5.0
project-generator-definitions==0.2.46
project_generator==0.8.17
pycparser==2.22
pyelftools==0.23
PyGithub==1.54.1
PyJWT==1.7.1
pyocd==0.15.0
pytest==8.3.5
pyusb==1.3.1
PyYAML==3.13
requests==2.32.3
semantic-version==2.10.0
six==1.17.0
sortedcontainers==2.4.0
tomli==2.2.1
urllib3==2.3.0
valinor==0.0.15
websocket-client==1.8.0
wrapt==1.17.2
xmltodict==0.14.2
-e git+https://github.com/ARMmbed/yotta.git@4094b7a26c66dd64ff724d4f72da282d41ea9fca#egg=yotta
|
name: yotta
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- argcomplete==1.12.3
- argparse==1.4.0
- certifi==2025.1.31
- cffi==1.17.1
- charset-normalizer==3.4.1
- colorama==0.3.9
- cryptography==44.0.2
- deprecated==1.2.18
- exceptiongroup==1.2.2
- future==1.0.0
- hgapi==1.7.4
- idna==3.10
- iniconfig==2.1.0
- intelhex==2.3.0
- intervaltree==3.1.0
- jinja2==2.11.3
- jsonpointer==1.14
- jsonschema==2.6.0
- markupsafe==3.0.2
- mbed-test-wrapper==1.0.0
- packaging==24.2
- pathlib==1.0.1
- pluggy==1.5.0
- project-generator==0.8.17
- project-generator-definitions==0.2.46
- pycparser==2.22
- pyelftools==0.23
- pygithub==1.54.1
- pyjwt==1.7.1
- pyocd==0.15.0
- pytest==8.3.5
- pyusb==1.3.1
- pyyaml==3.13
- requests==2.32.3
- semantic-version==2.10.0
- six==1.17.0
- sortedcontainers==2.4.0
- tomli==2.2.1
- urllib3==2.3.0
- valinor==0.0.15
- websocket-client==1.8.0
- wrapt==1.17.2
- xmltodict==0.14.2
prefix: /opt/conda/envs/yotta
|
[
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_shorthandURLs",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_ShorthandRefs"
] |
[] |
[
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_gitURLs",
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_githubURLs",
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_hgURLs",
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_invalid",
"yotta/test/test_sourceparse.py::TestParseSourceURL::test_registryURLs",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_GitRefs",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_GithubRefs",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_HGRefs",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_atVersion",
"yotta/test/test_sourceparse.py::TestParseModuleNameAndSpec::test_validNames"
] |
[] |
Apache License 2.0
| 1,155 |
|
zalando-stups__senza-462
|
d5aa551914e024e9bf0bde97455db3a4eab62896
|
2017-04-07 09:26:03
|
e9f84724628b4761f8d5da4d37a2993f11d6433b
|
coveralls:
[](https://coveralls.io/builds/10978001)
Changes Unknown when pulling **81412ebca59282719b16c1387624a0d97cbc0348 on acm-createdat-key-error** into ** on master**.
hjacobs: :+1:
|
diff --git a/senza/manaus/acm.py b/senza/manaus/acm.py
index 8d85313..f43ca8c 100644
--- a/senza/manaus/acm.py
+++ b/senza/manaus/acm.py
@@ -81,7 +81,7 @@ class ACMCertificate:
subject_alternative_name = certificate['SubjectAlternativeNames']
domain_validation_options = certificate['DomainValidationOptions']
subject = certificate['Subject']
- created_at = certificate['CreatedAt']
+ created_at = certificate.get('CreatedAt')
status = certificate['Status']
signature_algorithm = certificate['SignatureAlgorithm']
in_use_by = certificate['InUseBy']
|
resolve_ssl_certificates for ACM: KeyError: 'CreatedAt'
```
cat /tmp/senza-traceback-28v30ylh
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/senza/error_handling.py", line 105, in __call__
self.function(*args, **kwargs)
File "/usr/lib/python3.5/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3.5/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3.5/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3.5/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python3.5/site-packages/senza/cli.py", line 580, in create
data = create_cf_template(definition, region, version, parameter, force, parameter_file)
File "/usr/lib/python3.5/site-packages/senza/cli.py", line 669, in create_cf_template
data = evaluate(definition.copy(), args, account_info, force)
File "/usr/lib/python3.5/site-packages/senza/cli.py", line 237, in evaluate
definition = componentfn(definition, configuration, args, info, force, account_info)
File "/usr/lib/python3.5/site-packages/senza/components/weighted_dns_elastic_load_balancer.py", line 49, in component_weighted_dns_elastic_load_balancer
account_info)
File "/usr/lib/python3.5/site-packages/senza/components/elastic_load_balancer.py", line 135, in component_elastic_load_balancer
listeners = resolve_ssl_certificates(listeners, subdomain, main_zone, account_info)
File "/usr/lib/python3.5/site-packages/senza/components/elastic_load_balancer.py", line 95, in resolve_ssl_certificates
ssl_cert = get_ssl_cert(subdomain, main_zone, listener, account_info)
File "/usr/lib/python3.5/site-packages/senza/components/elastic_load_balancer.py", line 52, in get_ssl_cert
reverse=True)
File "/usr/lib/python3.5/site-packages/senza/manaus/acm.py", line 178, in get_certificates
certificate = ACMCertificate.get_by_arn(self.region, arn)
File "/usr/lib/python3.5/site-packages/senza/manaus/acm.py", line 110, in get_by_arn
return cls.from_boto_dict(certificate)
File "/usr/lib/python3.5/site-packages/senza/manaus/acm.py", line 84, in from_boto_dict
created_at = certificate['CreatedAt']
KeyError: 'CreatedAt'
```
Imported certs don't have `CreatedAt`:
```
>>> c.describe_certificate(CertificateArn='arn:aws:acm:eu-central-1:123456789012:certificate/f14f9718-7da8-4250-9c21-d0341da4e44f')
{'Certificate': {'NotAfter': datetime.datetime(2017, 5, 7, 10, 0, tzinfo=tzlocal()), 'SubjectAlternativeNames': ['pierone.stups.zalan.do', 'registry.opensource.zalan.do'], 'Subject': 'C=DE,L=Berlin,O=Zalando SE,OU=CDP,CN=CDP Proxy', 'Serial': '2a:d2:f6:d3:23:62:0b:5f:f8:2f:d6:3a:4a:9f:b8:c6:48:a0:11:62', 'Type': 'IMPORTED', 'ImportedAt': datetime.datetime(2017, 4, 7, 10, 12, 55, tzinfo=tzlocal()), 'SignatureAlgorithm': 'SHA256WITHRSA', 'CertificateArn': 'arn:aws:acm:eu-central-1:123456789012:certificate/f14f9718-7da8-4250-9c21-d0341da4e44f', 'NotBefore': datetime.datetime(2017, 4, 7, 10, 0, tzinfo=tzlocal()), 'DomainValidationOptions': [{'DomainName': 'pierone.stups.zalan.do'}, {'DomainName': 'registry.opensource.zalan.do'}], 'Status': 'ISSUED', 'DomainName': 'pierone.stups.zalan.do', 'Issuer': 'Zalando SE', 'InUseBy': [], 'KeyAlgorithm': 'RSA-2048'}, 'ResponseMetadata': {'HTTPHeaders': {'content-type': 'application/x-amz-json-1.1', 'x-amzn-requestid': '514a08ad-1b71-11e7-91d6-c5bca103e8f9', 'date': 'Fri, 07 Apr 2017 09:05:16 GMT', 'content-length': '695'}, 'RequestId': '514a08ad-1b71-11e7-91d6-c5bca103e8f9', 'HTTPStatusCode': 200, 'RetryAttempts': 0}}
```
|
zalando-stups/senza
|
diff --git a/tests/fixtures.py b/tests/fixtures.py
index 2d91e42..ae21b24 100644
--- a/tests/fixtures.py
+++ b/tests/fixtures.py
@@ -20,7 +20,7 @@ CERT1_ZO_NE = {'CertificateArn': 'arn:aws:acm:eu-west-1:cert1',
'IssuedAt': datetime(2016, 4, 1, 12, 14, 14, tzinfo=timezone.utc),
'Issuer': 'SenzaTest',
'KeyAlgorithm': 'RSA-2048',
- 'NotAfter': datetime(2017, 4, 1, 12, 14, 14, tzinfo=timezone.utc),
+ 'NotAfter': datetime(2020, 4, 1, 12, 14, 14, tzinfo=timezone.utc),
'NotBefore': datetime(2016, 4, 1, 12, 14, 14, tzinfo=timezone.utc),
'Serial': '00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00',
'SignatureAlgorithm': 'SHA256WITHRSA',
@@ -45,7 +45,7 @@ CERT1_ZO_NE_REVOKED = {'CertificateArn': 'arn:aws:acm:eu-west-1:cert1',
'IssuedAt': datetime(2016, 4, 1, 12, 14, 14, tzinfo=timezone.utc),
'Issuer': 'SenzaTest',
'KeyAlgorithm': 'RSA-2048',
- 'NotAfter': datetime(2017, 4, 1, 12, 14, 14, tzinfo=timezone.utc),
+ 'NotAfter': datetime(2020, 4, 1, 12, 14, 14, tzinfo=timezone.utc),
'NotBefore': datetime(2016, 4, 1, 12, 14, 14, tzinfo=timezone.utc),
'Serial': '00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00',
'SignatureAlgorithm': 'SHA256WITHRSA',
@@ -86,7 +86,7 @@ HOSTED_ZONE_ZO_NE_DEV = {'Config': {'PrivateZone': False},
SERVER_CERT_ZO_NE = MagicMock(name='zo-ne')
SERVER_CERT_ZO_NE.server_certificate_metadata = {'Arn': 'arn:aws:123',
'ServerCertificateName': 'zo-ne',
- 'Expiration': datetime(2017, 4, 1, 12, 14, 14,
+ 'Expiration': datetime(2020, 4, 1, 12, 14, 14,
tzinfo=timezone(timedelta(hours=2))),
'Path': '/',
'ServerCertificateId': '000',
diff --git a/tests/test_manaus/test_acm.py b/tests/test_manaus/test_acm.py
index f022ff2..a10013b 100644
--- a/tests/test_manaus/test_acm.py
+++ b/tests/test_manaus/test_acm.py
@@ -34,7 +34,7 @@ CERT1 = {'CertificateArn': 'arn:aws:acm:eu-west-1:cert1',
'IssuedAt': datetime(2016, 4, 1, 12, 14, 14, tzinfo=timezone.utc),
'Issuer': 'SenzaTest',
'KeyAlgorithm': 'RSA-2048',
- 'NotAfter': datetime(2017, 4, 1, 12, 14, 14, tzinfo=timezone.utc),
+ 'NotAfter': datetime(2020, 4, 1, 12, 14, 14, tzinfo=timezone.utc),
'NotBefore': datetime(2016, 4, 1, 12, 14, 14, tzinfo=timezone.utc),
'Serial': '00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00',
'SignatureAlgorithm': 'SHA256WITHRSA',
@@ -75,7 +75,7 @@ CERT2 = {'CertificateArn': 'arn:aws:acm:eu-west-1:cert2',
'IssuedAt': datetime(2016, 4, 1, 12, 14, 14),
'Issuer': 'SenzaTest',
'KeyAlgorithm': 'RSA-2048',
- 'NotAfter': datetime(2017, 4, 1, 12, 14, 14),
+ 'NotAfter': datetime(2020, 4, 1, 12, 14, 14),
'NotBefore': datetime(2016, 4, 1, 12, 14, 14),
'Serial': '00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00',
'SignatureAlgorithm': 'SHA256WITHRSA',
@@ -85,6 +85,23 @@ CERT2 = {'CertificateArn': 'arn:aws:acm:eu-west-1:cert2',
'*.senza.aws.example.net',
'*.app.example.net']}
+CERT3 = {
+ 'NotAfter': datetime(2017, 5, 7, 10, 0, tzinfo=timezone.utc),
+ 'SubjectAlternativeNames': ['pierone.stups.zalan.do', 'registry.opensource.zalan.do'],
+ 'Subject': 'C=DE,L=Berlin,O=Zalando SE,OU=CDP,CN=CDP Proxy',
+ 'Serial': '2a:d2:f6:d3:23:62:0b:5f:f8:2f:d6:3a:4a:9f:b8:c6:48:a0:11:62',
+ 'Type': 'IMPORTED',
+ 'ImportedAt': datetime(2017, 4, 7, 10, 12, 55, tzinfo=timezone.utc),
+ 'SignatureAlgorithm': 'SHA256WITHRSA',
+ 'CertificateArn': 'arn:aws:acm:eu-west-1:cert3',
+ 'NotBefore': datetime(2017, 4, 7, 10, 0, tzinfo=timezone.utc),
+ 'DomainValidationOptions': [{'DomainName': 'pierone.stups.zalan.do'}, {'DomainName': 'registry.opensource.zalan.do'}],
+ 'Status': 'ISSUED',
+ 'DomainName': 'pierone.stups.zalan.do',
+ 'Issuer': 'Zalando SE',
+ 'InUseBy': [],
+ 'KeyAlgorithm': 'RSA-2048'}
+
CERT_VALIDATION_TIMED_OUT = {
'KeyAlgorithm': 'RSA-2048',
'DomainName': 'alpha.example.org',
@@ -109,7 +126,7 @@ def test_certificate_valid():
assert certificate1.domain_name == '*.senza.example.com'
assert certificate1.is_valid(when=datetime(2016, 4, 5, 12, 14, 14,
tzinfo=timezone.utc))
- assert not certificate1.is_valid(when=datetime(2018, 4, 5, 12, 14, 14,
+ assert not certificate1.is_valid(when=datetime(2021, 4, 5, 12, 14, 14,
tzinfo=timezone.utc))
assert not certificate1.is_valid(when=datetime(2013, 4, 2, 10, 11, 12,
tzinfo=timezone.utc))
@@ -121,7 +138,7 @@ def test_certificate_valid():
assert certificate1_revoked.domain_name == '*.senza.example.com'
assert not certificate1_revoked.is_valid(when=datetime(2016, 4, 5, 12, 14, 14,
tzinfo=timezone.utc))
- assert not certificate1_revoked.is_valid(when=datetime(2018, 4, 5, 12, 14, 14,
+ assert not certificate1_revoked.is_valid(when=datetime(2021, 4, 5, 12, 14, 14,
tzinfo=timezone.utc))
assert not certificate1_revoked.is_valid(when=datetime(2013, 4, 2, 10, 11, 12,
tzinfo=timezone.utc))
@@ -153,7 +170,7 @@ def test_certificate_get_by_arn(monkeypatch):
assert certificate1.domain_name == '*.senza.example.com'
assert certificate1.is_valid(when=datetime(2016, 4, 5, 12, 14, 14,
tzinfo=timezone.utc))
- assert not certificate1.is_valid(when=datetime(2018, 4, 5, 12, 14, 14,
+ assert not certificate1.is_valid(when=datetime(2021, 4, 5, 12, 14, 14,
tzinfo=timezone.utc))
assert not certificate1.is_valid(when=datetime(2013, 4, 2, 10, 11, 12,
tzinfo=timezone.utc))
@@ -201,6 +218,12 @@ def test_get_certificates(monkeypatch):
assert len(certificates_net) == 1
assert certificates_net[0].arn == 'arn:aws:acm:eu-west-1:cert2'
+ m_client.describe_certificate.side_effect = [{'Certificate': CERT3}]
+ certificates_net = list(acm.get_certificates(valid_only=False,
+ domain_name="registry.opensource.zalan.do"))
+ assert len(certificates_net) == 1
+ assert certificates_net[0].arn == 'arn:aws:acm:eu-west-1:cert3'
+
def test_arn_is_acm_certificate():
assert ACMCertificate.arn_is_acm_certificate('arn:aws:acm:certificate')
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 1
}
|
2.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov"
],
"pre_install": null,
"python": "3.5",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
arrow==1.2.3
attrs==22.2.0
boto3==1.23.10
botocore==1.26.10
certifi==2021.5.30
charset-normalizer==2.0.12
click==8.0.4
clickclick==20.10.2
coverage==6.2
dnspython==2.2.1
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
jmespath==0.10.0
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pystache==0.6.4
pytest==7.0.1
pytest-cov==4.0.0
python-dateutil==2.9.0.post0
PyYAML==6.0.1
raven==6.10.0
requests==2.27.1
s3transfer==0.5.2
six==1.17.0
stups-cli-support==1.1.22
stups-pierone==1.1.56
-e git+https://github.com/zalando-stups/senza.git@d5aa551914e024e9bf0bde97455db3a4eab62896#egg=stups_senza
stups-tokens==1.1.19
stups-zign==1.2
tomli==1.2.3
typing==3.7.4.3
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0
|
name: senza
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- arrow==1.2.3
- attrs==22.2.0
- boto3==1.23.10
- botocore==1.26.10
- charset-normalizer==2.0.12
- click==8.0.4
- clickclick==20.10.2
- coverage==6.2
- dnspython==2.2.1
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- jmespath==0.10.0
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pystache==0.6.4
- pytest==7.0.1
- pytest-cov==4.0.0
- python-dateutil==2.9.0.post0
- pyyaml==6.0.1
- raven==6.10.0
- requests==2.27.1
- s3transfer==0.5.2
- six==1.17.0
- stups-cli-support==1.1.22
- stups-pierone==1.1.56
- stups-tokens==1.1.19
- stups-zign==1.2
- tomli==1.2.3
- typing==3.7.4.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- zipp==3.6.0
prefix: /opt/conda/envs/senza
|
[
"tests/test_manaus/test_acm.py::test_get_certificates"
] |
[] |
[
"tests/test_manaus/test_acm.py::test_certificate_valid",
"tests/test_manaus/test_acm.py::test_certificate_comparison",
"tests/test_manaus/test_acm.py::test_certificate_get_by_arn",
"tests/test_manaus/test_acm.py::test_certificate_matches",
"tests/test_manaus/test_acm.py::test_arn_is_acm_certificate"
] |
[] |
Apache License 2.0
| 1,160 |
pypa__setuptools_scm-168
|
00f3fbe0dfd3ae396abdd4b33cd69cca7d4459c3
|
2017-04-08 16:14:53
|
0373c11d2c8968a857ff06c94f101abebf825507
|
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 50f0cde..054bfe5 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,3 +1,9 @@
+v1.15.5
+=======
+
+* fix #167 by correctly respecting preformatted version metadata
+ from PKG-INFO/EGG-INFO
+
v1.15.4
=======
diff --git a/setuptools_scm/hacks.py b/setuptools_scm/hacks.py
index 2d298be..add89a8 100644
--- a/setuptools_scm/hacks.py
+++ b/setuptools_scm/hacks.py
@@ -10,7 +10,7 @@ def parse_pkginfo(root):
data = data_from_mime(pkginfo)
version = data.get('Version')
if version != 'UNKNOWN':
- return meta(version)
+ return meta(version, preformatted=True)
def parse_pip_egg_info(root):
diff --git a/setuptools_scm/version.py b/setuptools_scm/version.py
index 15c4495..dce8c75 100644
--- a/setuptools_scm/version.py
+++ b/setuptools_scm/version.py
@@ -55,7 +55,10 @@ def tags_to_versions(tags):
class ScmVersion(object):
def __init__(self, tag_version,
distance=None, node=None, dirty=False,
+ preformatted=False,
**kw):
+ if kw:
+ trace("unknown args", kw)
self.tag = tag_version
if dirty and distance is None:
distance = 0
@@ -64,6 +67,7 @@ class ScmVersion(object):
self.time = datetime.datetime.now()
self.extra = kw
self.dirty = dirty
+ self.preformatted = preformatted
@property
def exact(self):
@@ -84,13 +88,19 @@ class ScmVersion(object):
return self.format_with(dirty_format if self.dirty else clean_format)
-def meta(tag, distance=None, dirty=False, node=None, **kw):
+def _parse_tag(tag, preformatted):
+ if preformatted:
+ return tag
if SetuptoolsVersion is None or not isinstance(tag, SetuptoolsVersion):
tag = tag_to_version(tag)
- trace('version', tag)
+ return tag
+
+def meta(tag, distance=None, dirty=False, node=None, preformatted=False, **kw):
+ tag = _parse_tag(tag, preformatted)
+ trace('version', tag)
assert tag is not None, 'cant parse version %s' % tag
- return ScmVersion(tag, distance, node, dirty, **kw)
+ return ScmVersion(tag, distance, node, dirty, preformatted, **kw)
def guess_next_version(tag_version, distance):
@@ -147,6 +157,8 @@ def postrelease_version(version):
def format_version(version, **config):
trace('scm version', version)
trace('config', config)
+ if version.preformatted:
+ return version.tag
version_scheme = callable_or_entrypoint(
'setuptools_scm.version_scheme', config['version_scheme'])
local_scheme = callable_or_entrypoint(
|
setuptools_scm unable to compute distance?
I have a tarball that was built with a previous version of setuptools_scm. The other day it started failing because the version number it was producing was ``1.None.0``. Nothing in the code base had changed, so I believe it to be a setuptools_scm regression.
This tarball is private, but the ``setup.py`` looks like:
```python
#!/usr/bin/env python
import setuptools
setuptools.setup(
name="pypi-theme",
version="15.0",
packages=[
"pypi_theme",
],
include_package_data=True,
use_scm_version={
"local_scheme": "dirty-tag",
"version_scheme": lambda v: "1.{.distance}.0".format(v),
},
install_requires=[
"Pyramid",
],
setup_requires=["setuptools_scm"],
)
```
I'm guessing that ``v.distance`` is returning ``None`` now when it previously didn't, but I don't know why.
|
pypa/setuptools_scm
|
diff --git a/testing/conftest.py b/testing/conftest.py
index 49a9d14..29e129c 100644
--- a/testing/conftest.py
+++ b/testing/conftest.py
@@ -52,14 +52,18 @@ class Wd(object):
self(self.add_command)
self.commit(reason=reason)
- @property
- def version(self):
+ def get_version(self, **kw):
__tracebackhide__ = True
from setuptools_scm import get_version
- version = get_version(root=str(self.cwd))
+ version = get_version(root=str(self.cwd), **kw)
print(version)
return version
+ @property
+ def version(self):
+ __tracebackhide__ = True
+ return self.get_version()
+
@pytest.yield_fixture(autouse=True)
def debug_mode():
diff --git a/testing/test_basic_api.py b/testing/test_basic_api.py
index 5f9e1d6..4192f71 100644
--- a/testing/test_basic_api.py
+++ b/testing/test_basic_api.py
@@ -30,6 +30,9 @@ def test_version_from_pkginfo(wd):
wd.write('PKG-INFO', 'Version: 0.1')
assert wd.version == '0.1'
+ # replicate issue 167
+ assert wd.get_version(version_scheme="1.{0.distance}.0".format) == '0.1'
+
def assert_root(monkeypatch, expected_root):
"""
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 3
}
|
1.15
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"flake8",
"mccabe",
"readme",
"wheel",
"twine",
"devpi-client"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
bleach==4.1.0
build==0.9.0
certifi==2021.5.30
cffi==1.15.1
charset-normalizer==2.0.12
check-manifest==0.48
colorama==0.4.5
cryptography==40.0.2
devpi-client==6.0.7
devpi-common==3.7.2
docutils==0.18.1
flake8==5.0.4
idna==3.10
importlib-metadata==4.2.0
importlib-resources==5.4.0
iniconfig==1.1.1
jeepney==0.7.1
keyring==23.4.1
lazy==1.6
mccabe==0.7.0
packaging==21.3
pep517==0.13.1
pkginfo==1.10.0
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pycparser==2.21
pyflakes==2.5.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
readme==0.7.1
readme-renderer==34.0
requests==2.27.1
requests-toolbelt==1.0.0
rfc3986==1.5.0
SecretStorage==3.3.3
-e git+https://github.com/pypa/setuptools_scm.git@00f3fbe0dfd3ae396abdd4b33cd69cca7d4459c3#egg=setuptools_scm
six==1.17.0
tomli==1.2.3
tqdm==4.64.1
twine==3.8.0
typing_extensions==4.1.1
urllib3==1.26.20
webencodings==0.5.1
zipp==3.6.0
|
name: setuptools_scm
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- bleach==4.1.0
- build==0.9.0
- cffi==1.15.1
- charset-normalizer==2.0.12
- check-manifest==0.48
- colorama==0.4.5
- cryptography==40.0.2
- devpi-client==6.0.7
- devpi-common==3.7.2
- docutils==0.18.1
- flake8==5.0.4
- idna==3.10
- importlib-metadata==4.2.0
- importlib-resources==5.4.0
- iniconfig==1.1.1
- jeepney==0.7.1
- keyring==23.4.1
- lazy==1.6
- mccabe==0.7.0
- packaging==21.3
- pep517==0.13.1
- pkginfo==1.10.0
- platformdirs==2.4.0
- pluggy==1.0.0
- py==1.11.0
- pycodestyle==2.9.1
- pycparser==2.21
- pyflakes==2.5.0
- pygments==2.14.0
- pyparsing==3.1.4
- pytest==7.0.1
- readme==0.7.1
- readme-renderer==34.0
- requests==2.27.1
- requests-toolbelt==1.0.0
- rfc3986==1.5.0
- secretstorage==3.3.3
- six==1.17.0
- tomli==1.2.3
- tqdm==4.64.1
- twine==3.8.0
- typing-extensions==4.1.1
- urllib3==1.26.20
- webencodings==0.5.1
- zipp==3.6.0
prefix: /opt/conda/envs/setuptools_scm
|
[
"testing/test_basic_api.py::test_version_from_pkginfo"
] |
[] |
[
"testing/test_basic_api.py::test_do[ls]",
"testing/test_basic_api.py::test_do[dir]",
"testing/test_basic_api.py::test_data_from_mime",
"testing/test_basic_api.py::test_root_parameter_creation",
"testing/test_basic_api.py::test_root_parameter_pass_by",
"testing/test_basic_api.py::test_pretended",
"testing/test_basic_api.py::test_root_relative_to",
"testing/test_basic_api.py::test_dump_version",
"testing/test_basic_api.py::test_parse_plain"
] |
[] |
MIT License
| 1,166 |
|
mailgun__talon-135
|
0b55e8fa778ef3927b68a542ee4f3e289549cd83
|
2017-04-12 04:08:10
|
0b55e8fa778ef3927b68a542ee4f3e289549cd83
|
diff --git a/talon/quotations.py b/talon/quotations.py
index 6016310..9286209 100644
--- a/talon/quotations.py
+++ b/talon/quotations.py
@@ -146,6 +146,14 @@ RE_ANDROID_WROTE = re.compile(u'[\s]*[-]+.*({})[ ]*[-]+'.format(
'wrote'
))), re.I)
+# Support polymail.io reply format
+# On Tue, Apr 11, 2017 at 10:07 PM John Smith
+#
+# <
+# mailto:John Smith <[email protected]>
+# > wrote:
+RE_POLYMAIL = re.compile('On.*\s{2}<\smailto:.*\s> wrote:', re.I)
+
SPLITTER_PATTERNS = [
RE_ORIGINAL_MESSAGE,
RE_ON_DATE_SMB_WROTE,
@@ -162,7 +170,8 @@ SPLITTER_PATTERNS = [
'( \S+){3,6}@\S+:'),
# Sent from Samsung MobileName <[email protected]> wrote:
re.compile('Sent from Samsung .*@.*> wrote'),
- RE_ANDROID_WROTE
+ RE_ANDROID_WROTE,
+ RE_POLYMAIL
]
RE_LINK = re.compile('<(http://[^>]*)>')
@@ -170,7 +179,7 @@ RE_NORMALIZED_LINK = re.compile('@@(http://[^>@]*)@@')
RE_PARENTHESIS_LINK = re.compile("\(https?://")
-SPLITTER_MAX_LINES = 4
+SPLITTER_MAX_LINES = 6
MAX_LINES_COUNT = 1000
# an extensive research shows that exceeding this limit
# leads to excessive processing time
|
Quotes extraction failed with Polymail replies
Replies initiated from [polymail](https://polymail.io/) do not extract the quoted text.
Steps to reproduce:
1. Send a message to yourself using polymail
2. Read that message in gmail and reply to it
3. Read the message in polymail and reply to it
4. Get the original message and test on [talon testing site](http://talon.mailgun.net/).
Example:
```
Return-Path: <[email protected]>
Received: from localhost (ec2-54-158-139-194.compute-1.amazonaws.com. [54.158.139.194])
by smtp.gmail.com with ESMTPSA id q32sm10037057qtd.5.2017.04.11.19.08.54
for <[email protected]>
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Tue, 11 Apr 2017 19:08:55 -0700 (PDT)
Mime-Version: 1.0
X-Mailer: Polymail
Message-ID: <[email protected]>
Subject: Re: Test
From: Ethan Setnik <xxxxgmail.com>
To: Ethan Setnik <[email protected]>
Date: Tue, 11 Apr 2017 19:08:45 -0700
In-Reply-To: <CAKzr07V771zMRYAE9m9yU1NqnGGtkbmUSOvWWz84J2O+i5-ubg@mail.gmail.com>
References: <CAKzr07V771zMRYAE9m9yU1NqnGGtkbmUSOvWWz84J2O+i5-ubg@mail.gmail.com>
Content-Type: multipart/alternative; boundary=379c710cb6a99096f577366db69dccf23b4f785368751bb5acb86a2e162a
--379c710cb6a99096f577366db69dccf23b4f785368751bb5acb86a2e162a
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
This is the reply from Polymail
On Tue, Apr 11, 2017 at 10:07 PM Ethan Setnik
<
mailto:Ethan Setnik <[email protected]>
> wrote:
a, pre, code, a:link, body { word-wrap: break-word !important; }
This is the reply
On Tue, Apr 11, 2017 at 10:07 PM Ethan Setnik <
mailto:[email protected]
> wrote:
This is the initial message
--379c710cb6a99096f577366db69dccf23b4f785368751bb5acb86a2e162a
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<img style=3D"border: none; background:none; width: 0; height: 0;" src=3D"h=
ttps://share.polymail.io/v2/z/a/NThlZDhjMDcwMGJm/y6ry9vAsZIPxUbBfihWq6SToKm=
8ok2BlbhzkP296GDPgMIHiWWU4BGEw66uif81ucgL4a8UOrQQwwC_UjBeGCbM9In5alO4MMVE8t=
vBv8AZYGvniUINmkwConAMIHC8HJqpDarTqW6RRpNOc.png" alt=3D"" width=3D"0px" hei=
ght=3D"0px" border=3D"0" /><div></div>
<div>
This is the reply from Polymail<br><br>
</div>
<div id=3D"psignature"><br></div>
<div class=3D"gmail_extra"><br><div class=3D"gmail_quote"><div dir=3D"ltr">=
On Tue, Apr 11, 2017 at 10:07 PM Ethan Setnik <[email protected]> <<a hr=
ef=3D"mailto:Ethan Setnik <[email protected]>">Ethan Setnik <xxxxx@gmail.=
com></a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><!DOCTYPE html>=
<html><head><meta name=3D"viewport" content=3D"width=3Ddevice-width"><style=
>a, pre, code, a:link, body { word-wrap: break-word !important; }</style></=
head><body>
<div dir=3D"ltr">This is the reply</div>
<br><div class=3D"gmail_quote"></div>
</body></html><div dir=3D"ltr">On Tue, Apr 11, 2017 at 10:07 PM Ethan Setni=
k <<a href=3D"mailto:[email protected]">[email protected]</a>> wrote:=
<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord=
er-left:1px #ccc solid;padding-left:1ex"><img style=3D"border:none;backgrou=
nd:none;width:0;height:0" src=3D"https://ci4.googleusercontent.com/proxy/JX=
XTuFue-6g3aDYP_klLyNmTSWdgpANzRviNIzs2xpEC3ZMdoU8vXxg9DwFJpUnjRTFU6s4roA3f7=
IW_t3ZahYdgJo_3GAl4qZoNqEse6VsyfI6rmoLF5dB2iRmlV1GUNQgdinzLxOFTi_ycHjBzJQ-r=
vKcMqnQAw3tD9GyeqniSbhysEgK2xMhP4OakJkFptqHAzVbC3TClDGj_UN617anYUW0043qgREP=
JDoT0wBMyTqNruExX68G_alPEZjE-VN3Xr_X3sb4EwxlEoIEU30xD9KHS7tnGwkB9BN0=3Ds0-d=
-e1-ft#https://share.polymail.io/v2/z/a/NThlZDhiYjVjZDU1/OoigMTRZhepebW8cok=
gLWKlfeOn7lYi8eweMZ5IXUoacBlsPJJOLaoXSc0u1N-c2QTywVrJgUzzUmzFmBx1UwiHWkaj_W=
gHTH6qG4m-Eo_t1ETpIvzwZKvwaUKsm_3VFDUQj4i5HZZojujdK.png" alt=3D"" width=3D"=
0px" height=3D"0px" border=3D"0" class=3D"gmail_msg">This is the initial me=
ssage</blockquote></div></div></blockquote></div><br></div>
--379c710cb6a99096f577366db69dccf23b4f785368751bb5acb86a2e162a--
```
|
mailgun/talon
|
diff --git a/tests/text_quotations_test.py b/tests/text_quotations_test.py
index 7a81c99..c02c375 100644
--- a/tests/text_quotations_test.py
+++ b/tests/text_quotations_test.py
@@ -35,6 +35,19 @@ On 11-Apr-2011, at 6:54 PM, Roman Tkachenko <[email protected]> wrote:
eq_("Test reply", quotations.extract_from_plain(msg_body))
+def test_pattern_on_date_polymail():
+ msg_body = """Test reply
+
+On Tue, Apr 11, 2017 at 10:07 PM John Smith
+
+<
+mailto:John Smith <[email protected]>
+> wrote:
+Test quoted data
+"""
+
+ eq_("Test reply", quotations.extract_from_plain(msg_body))
+
def test_pattern_sent_from_samsung_smb_wrote():
msg_body = """Test reply
@@ -54,7 +67,7 @@ def test_pattern_on_date_wrote_somebody():
"""Lorem
Op 13-02-2014 3:18 schreef Julius Caesar <[email protected]>:
-
+
Veniam laborum mlkshk kale chips authentic. Normcore mumblecore laboris, fanny pack readymade eu blog chia pop-up freegan enim master cleanse.
"""))
@@ -256,7 +269,7 @@ def test_with_indent():
------On 12/29/1987 17:32 PM, Julius Caesar wrote-----
-Brunch mumblecore pug Marfa tofu, irure taxidermy hoodie readymade pariatur.
+Brunch mumblecore pug Marfa tofu, irure taxidermy hoodie readymade pariatur.
"""
eq_("YOLO salvia cillum kogi typewriter mumblecore cardigan skateboard Austin.", quotations.extract_from_plain(msg_body))
@@ -381,11 +394,11 @@ Veniam laborum mlkshk kale chips authentic. Normcore mumblecore laboris, fanny p
def test_dutch_from_block():
eq_('Gluten-free culpa lo-fi et nesciunt nostrud.', quotations.extract_from_plain(
- """Gluten-free culpa lo-fi et nesciunt nostrud.
+ """Gluten-free culpa lo-fi et nesciunt nostrud.
Op 17-feb.-2015, om 13:18 heeft Julius Caesar <[email protected]> het volgende geschreven:
-
-Small batch beard laboris tempor, non listicle hella Tumblr heirloom.
+
+Small batch beard laboris tempor, non listicle hella Tumblr heirloom.
"""))
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_media"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 1
},
"num_modified_files": 1
}
|
1.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "lxml>=2.3.3 regex>=1 numpy scipy scikit-learn>=0.16.1 chardet>=1.0.1 cchardet>=0.3.5 cssselect six>=1.10.0 html5lib mock nose>=1.2.1 coverage",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
cchardet @ file:///croot/cchardet_1736182485390/work
chardet @ file:///tmp/build/80754af9/chardet_1607706775000/work
coverage @ file:///croot/coverage_1734018327576/work
cssselect @ file:///croot/cssselect_1707339882883/work
exceptiongroup==1.2.2
html5lib @ file:///Users/ktietz/demo/mc3/conda-bld/html5lib_1629144453894/work
iniconfig==2.1.0
joblib @ file:///croot/joblib_1718217211762/work
lxml @ file:///croot/lxml_1737039601731/work
mock @ file:///tmp/build/80754af9/mock_1607622725907/work
nose @ file:///opt/conda/conda-bld/nose_1642704612149/work
numpy @ file:///croot/numpy_and_numpy_base_1736283260865/work/dist/numpy-2.0.2-cp39-cp39-linux_x86_64.whl#sha256=3387e3e62932fa288bc18e8f445ce19e998b418a65ed2064dd40a054f976a6c7
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
regex @ file:///croot/regex_1736540786412/work
scikit-learn @ file:///croot/scikit-learn_1737988764076/work
scipy @ file:///croot/scipy_1733756309941/work/dist/scipy-1.13.1-cp39-cp39-linux_x86_64.whl#sha256=3b247b926209f2d9f719ebae39faf3ff891b2596150ed8f8349adfc3eb19441c
six @ file:///tmp/build/80754af9/six_1644875935023/work
-e git+https://github.com/mailgun/talon.git@0b55e8fa778ef3927b68a542ee4f3e289549cd83#egg=talon
threadpoolctl @ file:///croot/threadpoolctl_1719407800858/work
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
webencodings==0.5.1
|
name: talon
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- blas=1.0=openblas
- ca-certificates=2025.2.25=h06a4308_0
- cchardet=2.1.7=py39h6a678d5_1
- chardet=4.0.0=py39h06a4308_1003
- coverage=7.6.9=py39h5eee18b_0
- cssselect=1.2.0=py39h06a4308_0
- html5lib=1.1=pyhd3eb1b0_0
- icu=73.1=h6a678d5_0
- joblib=1.4.2=py39h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgfortran-ng=11.2.0=h00389a5_1
- libgfortran5=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libopenblas=0.3.21=h043d6bf_0
- libstdcxx-ng=11.2.0=h1234567_1
- libxml2=2.13.5=hfdd30dd_0
- libxslt=1.1.41=h097e994_0
- lxml=5.3.0=py39h57af460_1
- mock=4.0.3=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- nose=1.3.7=pyhd3eb1b0_1008
- numpy=2.0.2=py39heeff2f4_0
- numpy-base=2.0.2=py39h8a23956_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- pybind11-abi=4=hd3eb1b0_1
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- regex=2024.11.6=py39h5eee18b_0
- scikit-learn=1.6.1=py39h6a678d5_0
- scipy=1.13.1=py39heeff2f4_1
- setuptools=72.1.0=py39h06a4308_0
- six=1.16.0=pyhd3eb1b0_1
- sqlite=3.45.3=h5eee18b_0
- threadpoolctl=3.5.0=py39h2f386ee_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- webencodings=0.5.1=py39h06a4308_1
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- exceptiongroup==1.2.2
- iniconfig==2.1.0
- packaging==24.2
- pluggy==1.5.0
- pytest==8.3.5
prefix: /opt/conda/envs/talon
|
[
"tests/text_quotations_test.py::test_pattern_on_date_polymail"
] |
[] |
[
"tests/text_quotations_test.py::test_too_many_lines",
"tests/text_quotations_test.py::test_pattern_on_date_somebody_wrote",
"tests/text_quotations_test.py::test_pattern_sent_from_samsung_smb_wrote",
"tests/text_quotations_test.py::test_pattern_on_date_wrote_somebody",
"tests/text_quotations_test.py::test_pattern_on_date_somebody_wrote_date_with_slashes",
"tests/text_quotations_test.py::test_date_time_email_splitter",
"tests/text_quotations_test.py::test_pattern_on_date_somebody_wrote_allows_space_in_front",
"tests/text_quotations_test.py::test_pattern_on_date_somebody_sent",
"tests/text_quotations_test.py::test_line_starts_with_on",
"tests/text_quotations_test.py::test_reply_and_quotation_splitter_share_line",
"tests/text_quotations_test.py::test_english_original_message",
"tests/text_quotations_test.py::test_german_original_message",
"tests/text_quotations_test.py::test_danish_original_message",
"tests/text_quotations_test.py::test_reply_after_quotations",
"tests/text_quotations_test.py::test_android_wrote",
"tests/text_quotations_test.py::test_reply_wraps_quotations",
"tests/text_quotations_test.py::test_reply_wraps_nested_quotations",
"tests/text_quotations_test.py::test_quotation_separator_takes_2_lines",
"tests/text_quotations_test.py::test_quotation_separator_takes_3_lines",
"tests/text_quotations_test.py::test_short_quotation",
"tests/text_quotations_test.py::test_with_indent",
"tests/text_quotations_test.py::test_short_quotation_with_newline",
"tests/text_quotations_test.py::test_pattern_date_email_with_unicode",
"tests/text_quotations_test.py::test_english_from_block",
"tests/text_quotations_test.py::test_german_from_block",
"tests/text_quotations_test.py::test_french_multiline_from_block",
"tests/text_quotations_test.py::test_french_from_block",
"tests/text_quotations_test.py::test_polish_from_block",
"tests/text_quotations_test.py::test_danish_from_block",
"tests/text_quotations_test.py::test_swedish_from_block",
"tests/text_quotations_test.py::test_swedish_from_line",
"tests/text_quotations_test.py::test_norwegian_from_line",
"tests/text_quotations_test.py::test_dutch_from_block",
"tests/text_quotations_test.py::test_quotation_marker_false_positive",
"tests/text_quotations_test.py::test_link_closed_with_quotation_marker_on_new_line",
"tests/text_quotations_test.py::test_link_breaks_quotation_markers_sequence",
"tests/text_quotations_test.py::test_from_block_starts_with_date",
"tests/text_quotations_test.py::test_bold_from_block",
"tests/text_quotations_test.py::test_weird_date_format_in_date_block",
"tests/text_quotations_test.py::test_dont_parse_quotations_for_forwarded_messages",
"tests/text_quotations_test.py::test_forwarded_message_in_quotations",
"tests/text_quotations_test.py::test_mark_message_lines",
"tests/text_quotations_test.py::test_process_marked_lines",
"tests/text_quotations_test.py::test_preprocess",
"tests/text_quotations_test.py::test_preprocess_postprocess_2_links",
"tests/text_quotations_test.py::test_split_email"
] |
[] |
Apache License 2.0
| 1,176 |
|
dask__dask-2205
|
0d741d79e02281c3c145636c2cad972fb247de7d
|
2017-04-12 12:32:12
|
bdb021c7dcd94ae1fa51c82fae6cf4cf7319aa14
|
mrocklin: OK with the assert_eq change?
pitrou: Yes, of course.
|
diff --git a/dask/array/rechunk.py b/dask/array/rechunk.py
index de5da0f68..eea5470ff 100644
--- a/dask/array/rechunk.py
+++ b/dask/array/rechunk.py
@@ -18,6 +18,7 @@ from toolz import accumulate, reduce
from ..base import tokenize
from .core import concatenate3, Array, normalize_chunks
+from .wrap import empty
from .. import sharedict
@@ -484,6 +485,10 @@ def plan_rechunk(old_chunks, new_chunks, itemsize,
def _compute_rechunk(x, chunks):
""" Compute the rechunk of *x* to the given *chunks*.
"""
+ if x.size == 0:
+ # Special case for empty array, as the algorithm below does not behave correctly
+ return empty(x.shape, chunks=chunks, dtype=x.dtype)
+
ndim = x.ndim
crossed = intersect_chunks(x.chunks, chunks)
x2 = dict()
|
Reshape with empty dimensions
Reshaping with zero dimensions fails
```python
def test_reshape_empty():
x = da.ones((0, 10), chunks=(5, 5))
y = x.reshape((0, 5, 2))
assert_eq(x, x)
```
I've tracked this down to the fact that this line returns a list with one empty list
```python
def intersect_chunks(...):
...
old_to_new = [_intersect_1d(_breakpoints(old, new))
for old, new in zip(cmo, cmn)]
```
So the subsequent call to `itertools.product` returns an empty result.
I tried diving into `_intersect_1d` but had difficulty understanding the intent or the expected output.
@pitrou if you feel like looking this I would appreciate it. Totally OK if not. Otherwise I will resolve it later today.
|
dask/dask
|
diff --git a/dask/array/tests/test_array_core.py b/dask/array/tests/test_array_core.py
index 86686843b..a68e45d72 100644
--- a/dask/array/tests/test_array_core.py
+++ b/dask/array/tests/test_array_core.py
@@ -788,6 +788,10 @@ def test_roll(chunks, shift, axis):
((4, 64), (4, 8, 4, 2), (2, 16)),
((4, 8, 4, 2), (2, 1, 2, 32, 2), (2, 4, 2, 2)),
((4, 1, 4), (4, 4), (2, 1, 2)),
+ ((0, 10), (0, 5, 2), (5, 5)),
+ ((5, 0, 2), (0, 10), (5, 2, 2)),
+ ((0,), (2, 0, 2), (4,)),
+ ((2, 0, 2), (0,), (4, 4, 4)),
])
def test_reshape(original_shape, new_shape, chunks):
x = np.random.randint(10, size=original_shape)
diff --git a/dask/array/tests/test_rechunk.py b/dask/array/tests/test_rechunk.py
index 01fdcee7a..967f6ce9c 100644
--- a/dask/array/tests/test_rechunk.py
+++ b/dask/array/tests/test_rechunk.py
@@ -6,6 +6,7 @@ np = pytest.importorskip('numpy')
import dask
from dask.utils import funcname
+from dask.array.utils import assert_eq
from dask.array.rechunk import intersect_chunks, rechunk, normalize_chunks
from dask.array.rechunk import cumdims_label, _breakpoints, _intersect_1d
from dask.array.rechunk import plan_rechunk, divide_to_width, merge_to_number
@@ -184,6 +185,13 @@ def test_rechunk_0d():
assert y.compute() == a
+def test_rechunk_empty():
+ x = da.ones((0, 10), chunks=(5, 5))
+ y = x.rechunk((2, 2))
+ assert y.chunks == ((0,), (2,) * 5)
+ assert_eq(x, y)
+
+
def test_rechunk_same():
x = da.ones((24, 24), chunks=(4, 8))
y = x.rechunk(x.chunks)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 1
}
|
1.16
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[complete]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"moto",
"mock"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"docs/requirements-docs.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
aiobotocore==2.1.2
aiohttp==3.8.6
aioitertools==0.11.0
aiosignal==1.2.0
alabaster==0.7.13
async-timeout==4.0.2
asynctest==0.13.0
attrs==22.2.0
Babel==2.11.0
boto3==1.23.10
botocore==1.23.24
certifi==2021.5.30
cffi==1.15.1
charset-normalizer==2.0.12
click==8.0.4
cloudpickle==2.2.1
cryptography==40.0.2
-e git+https://github.com/dask/dask.git@0d741d79e02281c3c145636c2cad972fb247de7d#egg=dask
dataclasses==0.8
distributed==1.19.3
docutils==0.18.1
frozenlist==1.2.0
fsspec==2022.1.0
HeapDict==1.0.1
idna==3.10
idna-ssl==1.1.0
imagesize==1.4.1
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==3.0.3
jmespath==0.10.0
locket==1.0.0
MarkupSafe==2.0.1
mock==5.2.0
moto==4.0.13
msgpack-python==0.5.6
multidict==5.2.0
numpy==1.19.5
numpydoc==1.1.0
packaging==21.3
pandas==1.1.5
partd==1.2.0
pluggy==1.0.0
psutil==7.0.0
py==1.11.0
pycparser==2.21
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
requests==2.27.1
responses==0.17.0
s3fs==2022.1.0
s3transfer==0.5.2
six==1.17.0
snowballstemmer==2.2.0
sortedcontainers==2.4.0
Sphinx==5.3.0
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tblib==1.7.0
tomli==1.2.3
toolz==0.12.0
tornado==6.1
typing_extensions==4.1.1
urllib3==1.26.20
Werkzeug==2.0.3
wrapt==1.16.0
xmltodict==0.14.2
yarl==1.7.2
zict==2.1.0
zipp==3.6.0
|
name: dask
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- aiobotocore==2.1.2
- aiohttp==3.8.6
- aioitertools==0.11.0
- aiosignal==1.2.0
- alabaster==0.7.13
- async-timeout==4.0.2
- asynctest==0.13.0
- attrs==22.2.0
- babel==2.11.0
- boto3==1.23.10
- botocore==1.23.24
- cffi==1.15.1
- charset-normalizer==2.0.12
- click==8.0.4
- cloudpickle==2.2.1
- cryptography==40.0.2
- dataclasses==0.8
- distributed==1.19.3
- docutils==0.18.1
- frozenlist==1.2.0
- fsspec==2022.1.0
- heapdict==1.0.1
- idna==3.10
- idna-ssl==1.1.0
- imagesize==1.4.1
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- jinja2==3.0.3
- jmespath==0.10.0
- locket==1.0.0
- markupsafe==2.0.1
- mock==5.2.0
- moto==4.0.13
- msgpack-python==0.5.6
- multidict==5.2.0
- numpy==1.19.5
- numpydoc==1.1.0
- packaging==21.3
- pandas==1.1.5
- partd==1.2.0
- pluggy==1.0.0
- psutil==7.0.0
- py==1.11.0
- pycparser==2.21
- pygments==2.14.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pytz==2025.2
- requests==2.27.1
- responses==0.17.0
- s3fs==2022.1.0
- s3transfer==0.5.2
- six==1.17.0
- snowballstemmer==2.2.0
- sortedcontainers==2.4.0
- sphinx==5.3.0
- sphinx-rtd-theme==2.0.0
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- tblib==1.7.0
- tomli==1.2.3
- toolz==0.12.0
- tornado==6.1
- typing-extensions==4.1.1
- urllib3==1.26.20
- werkzeug==2.0.3
- wrapt==1.16.0
- xmltodict==0.14.2
- yarl==1.7.2
- zict==2.1.0
- zipp==3.6.0
prefix: /opt/conda/envs/dask
|
[
"dask/array/tests/test_array_core.py::test_reshape[original_shape31-new_shape31-chunks31]",
"dask/array/tests/test_rechunk.py::test_rechunk_empty"
] |
[
"dask/array/tests/test_array_core.py::test_field_access",
"dask/array/tests/test_array_core.py::test_field_access_with_shape",
"dask/array/tests/test_array_core.py::test_setitem_mixed_d"
] |
[
"dask/array/tests/test_array_core.py::test_getem",
"dask/array/tests/test_array_core.py::test_top",
"dask/array/tests/test_array_core.py::test_top_supports_broadcasting_rules",
"dask/array/tests/test_array_core.py::test_concatenate3_on_scalars",
"dask/array/tests/test_array_core.py::test_chunked_dot_product",
"dask/array/tests/test_array_core.py::test_chunked_transpose_plus_one",
"dask/array/tests/test_array_core.py::test_transpose",
"dask/array/tests/test_array_core.py::test_broadcast_dimensions_works_with_singleton_dimensions",
"dask/array/tests/test_array_core.py::test_broadcast_dimensions",
"dask/array/tests/test_array_core.py::test_Array",
"dask/array/tests/test_array_core.py::test_uneven_chunks",
"dask/array/tests/test_array_core.py::test_numblocks_suppoorts_singleton_block_dims",
"dask/array/tests/test_array_core.py::test_keys",
"dask/array/tests/test_array_core.py::test_Array_computation",
"dask/array/tests/test_array_core.py::test_stack",
"dask/array/tests/test_array_core.py::test_short_stack",
"dask/array/tests/test_array_core.py::test_stack_scalars",
"dask/array/tests/test_array_core.py::test_stack_rechunk",
"dask/array/tests/test_array_core.py::test_concatenate",
"dask/array/tests/test_array_core.py::test_concatenate_rechunk",
"dask/array/tests/test_array_core.py::test_concatenate_fixlen_strings",
"dask/array/tests/test_array_core.py::test_vstack",
"dask/array/tests/test_array_core.py::test_hstack",
"dask/array/tests/test_array_core.py::test_dstack",
"dask/array/tests/test_array_core.py::test_take",
"dask/array/tests/test_array_core.py::test_compress",
"dask/array/tests/test_array_core.py::test_binops",
"dask/array/tests/test_array_core.py::test_isnull",
"dask/array/tests/test_array_core.py::test_isclose",
"dask/array/tests/test_array_core.py::test_broadcast_shapes",
"dask/array/tests/test_array_core.py::test_elemwise_on_scalars",
"dask/array/tests/test_array_core.py::test_partial_by_order",
"dask/array/tests/test_array_core.py::test_elemwise_with_ndarrays",
"dask/array/tests/test_array_core.py::test_elemwise_differently_chunked",
"dask/array/tests/test_array_core.py::test_operators",
"dask/array/tests/test_array_core.py::test_operator_dtype_promotion",
"dask/array/tests/test_array_core.py::test_tensordot",
"dask/array/tests/test_array_core.py::test_tensordot_2[0]",
"dask/array/tests/test_array_core.py::test_tensordot_2[1]",
"dask/array/tests/test_array_core.py::test_tensordot_2[axes2]",
"dask/array/tests/test_array_core.py::test_tensordot_2[axes3]",
"dask/array/tests/test_array_core.py::test_tensordot_2[axes4]",
"dask/array/tests/test_array_core.py::test_tensordot_2[axes5]",
"dask/array/tests/test_array_core.py::test_tensordot_2[axes6]",
"dask/array/tests/test_array_core.py::test_dot_method",
"dask/array/tests/test_array_core.py::test_T",
"dask/array/tests/test_array_core.py::test_norm",
"dask/array/tests/test_array_core.py::test_choose",
"dask/array/tests/test_array_core.py::test_where",
"dask/array/tests/test_array_core.py::test_where_has_informative_error",
"dask/array/tests/test_array_core.py::test_coarsen",
"dask/array/tests/test_array_core.py::test_coarsen_with_excess",
"dask/array/tests/test_array_core.py::test_insert",
"dask/array/tests/test_array_core.py::test_multi_insert",
"dask/array/tests/test_array_core.py::test_broadcast_to",
"dask/array/tests/test_array_core.py::test_ravel",
"dask/array/tests/test_array_core.py::test_roll[None-3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[None-3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[None-7-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[None-7-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[None-9-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[None-9-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[None-shift3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[None-shift3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[None-shift4-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[None-shift4-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[0-3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[0-3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[0-7-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[0-7-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[0-9-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[0-9-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[0-shift3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[0-shift3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[0-shift4-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[0-shift4-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[1-3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[1-3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[1-7-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[1-7-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[1-9-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[1-9-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[1-shift3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[1-shift3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[1-shift4-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[1-shift4-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[-1-3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[-1-3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[-1-7-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[-1-7-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[-1-9-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[-1-9-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[-1-shift3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[-1-shift3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[-1-shift4-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[-1-shift4-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis4-3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis4-3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis4-7-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis4-7-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis4-9-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis4-9-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis4-shift3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis4-shift3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis4-shift4-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis4-shift4-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis5-3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis5-3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis5-7-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis5-7-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis5-9-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis5-9-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis5-shift3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis5-shift3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis5-shift4-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis5-shift4-chunks1]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape0-new_shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape1-new_shape1-5]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape2-new_shape2-5]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape3-new_shape3-12]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape4-new_shape4-12]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape5-new_shape5-chunks5]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape6-new_shape6-4]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape7-new_shape7-4]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape8-new_shape8-4]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape9-new_shape9-2]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape10-new_shape10-2]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape11-new_shape11-2]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape12-new_shape12-2]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape13-new_shape13-2]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape14-new_shape14-2]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape15-new_shape15-2]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape16-new_shape16-chunks16]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape17-new_shape17-3]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape18-new_shape18-4]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape19-new_shape19-chunks19]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape20-new_shape20-1]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape21-new_shape21-1]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape22-new_shape22-24]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape23-new_shape23-6]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape24-new_shape24-6]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape25-new_shape25-6]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape26-new_shape26-chunks26]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape27-new_shape27-chunks27]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape28-new_shape28-chunks28]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape29-new_shape29-chunks29]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape30-new_shape30-chunks30]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape32-new_shape32-chunks32]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape33-new_shape33-chunks33]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape34-new_shape34-chunks34]",
"dask/array/tests/test_array_core.py::test_reshape_exceptions",
"dask/array/tests/test_array_core.py::test_reshape_splat",
"dask/array/tests/test_array_core.py::test_reshape_fails_for_dask_only",
"dask/array/tests/test_array_core.py::test_reshape_unknown_dimensions",
"dask/array/tests/test_array_core.py::test_full",
"dask/array/tests/test_array_core.py::test_map_blocks",
"dask/array/tests/test_array_core.py::test_map_blocks2",
"dask/array/tests/test_array_core.py::test_map_blocks_with_constants",
"dask/array/tests/test_array_core.py::test_map_blocks_with_kwargs",
"dask/array/tests/test_array_core.py::test_map_blocks_with_chunks",
"dask/array/tests/test_array_core.py::test_map_blocks_dtype_inference",
"dask/array/tests/test_array_core.py::test_fromfunction",
"dask/array/tests/test_array_core.py::test_from_function_requires_block_args",
"dask/array/tests/test_array_core.py::test_repr",
"dask/array/tests/test_array_core.py::test_slicing_with_ellipsis",
"dask/array/tests/test_array_core.py::test_slicing_with_ndarray",
"dask/array/tests/test_array_core.py::test_dtype",
"dask/array/tests/test_array_core.py::test_blockdims_from_blockshape",
"dask/array/tests/test_array_core.py::test_coerce",
"dask/array/tests/test_array_core.py::test_store_delayed_target",
"dask/array/tests/test_array_core.py::test_store",
"dask/array/tests/test_array_core.py::test_store_regions",
"dask/array/tests/test_array_core.py::test_store_compute_false",
"dask/array/tests/test_array_core.py::test_store_locks",
"dask/array/tests/test_array_core.py::test_np_array_with_zero_dimensions",
"dask/array/tests/test_array_core.py::test_unique",
"dask/array/tests/test_array_core.py::test_dtype_complex",
"dask/array/tests/test_array_core.py::test_astype",
"dask/array/tests/test_array_core.py::test_arithmetic",
"dask/array/tests/test_array_core.py::test_elemwise_consistent_names",
"dask/array/tests/test_array_core.py::test_optimize",
"dask/array/tests/test_array_core.py::test_slicing_with_non_ndarrays",
"dask/array/tests/test_array_core.py::test_getarray",
"dask/array/tests/test_array_core.py::test_squeeze",
"dask/array/tests/test_array_core.py::test_size",
"dask/array/tests/test_array_core.py::test_nbytes",
"dask/array/tests/test_array_core.py::test_itemsize",
"dask/array/tests/test_array_core.py::test_Array_normalizes_dtype",
"dask/array/tests/test_array_core.py::test_from_array_with_lock",
"dask/array/tests/test_array_core.py::test_from_array_slicing_results_in_ndarray",
"dask/array/tests/test_array_core.py::test_asarray",
"dask/array/tests/test_array_core.py::test_from_func",
"dask/array/tests/test_array_core.py::test_topk",
"dask/array/tests/test_array_core.py::test_topk_k_bigger_than_chunk",
"dask/array/tests/test_array_core.py::test_bincount",
"dask/array/tests/test_array_core.py::test_bincount_with_weights",
"dask/array/tests/test_array_core.py::test_bincount_raises_informative_error_on_missing_minlength_kwarg",
"dask/array/tests/test_array_core.py::test_digitize",
"dask/array/tests/test_array_core.py::test_histogram",
"dask/array/tests/test_array_core.py::test_histogram_alternative_bins_range",
"dask/array/tests/test_array_core.py::test_histogram_return_type",
"dask/array/tests/test_array_core.py::test_histogram_extra_args_and_shapes",
"dask/array/tests/test_array_core.py::test_concatenate3_2",
"dask/array/tests/test_array_core.py::test_map_blocks3",
"dask/array/tests/test_array_core.py::test_from_array_with_missing_chunks",
"dask/array/tests/test_array_core.py::test_cache",
"dask/array/tests/test_array_core.py::test_take_dask_from_numpy",
"dask/array/tests/test_array_core.py::test_normalize_chunks",
"dask/array/tests/test_array_core.py::test_raise_on_no_chunks",
"dask/array/tests/test_array_core.py::test_chunks_is_immutable",
"dask/array/tests/test_array_core.py::test_raise_on_bad_kwargs",
"dask/array/tests/test_array_core.py::test_long_slice",
"dask/array/tests/test_array_core.py::test_ellipsis_slicing",
"dask/array/tests/test_array_core.py::test_point_slicing",
"dask/array/tests/test_array_core.py::test_point_slicing_with_full_slice",
"dask/array/tests/test_array_core.py::test_slice_with_floats",
"dask/array/tests/test_array_core.py::test_vindex_errors",
"dask/array/tests/test_array_core.py::test_vindex_merge",
"dask/array/tests/test_array_core.py::test_empty_array",
"dask/array/tests/test_array_core.py::test_array",
"dask/array/tests/test_array_core.py::test_cov",
"dask/array/tests/test_array_core.py::test_corrcoef",
"dask/array/tests/test_array_core.py::test_memmap",
"dask/array/tests/test_array_core.py::test_to_npy_stack",
"dask/array/tests/test_array_core.py::test_view",
"dask/array/tests/test_array_core.py::test_view_fortran",
"dask/array/tests/test_array_core.py::test_map_blocks_with_changed_dimension",
"dask/array/tests/test_array_core.py::test_broadcast_chunks",
"dask/array/tests/test_array_core.py::test_chunks_error",
"dask/array/tests/test_array_core.py::test_array_compute_forward_kwargs",
"dask/array/tests/test_array_core.py::test_dont_fuse_outputs",
"dask/array/tests/test_array_core.py::test_dont_dealias_outputs",
"dask/array/tests/test_array_core.py::test_timedelta_op",
"dask/array/tests/test_array_core.py::test_to_delayed",
"dask/array/tests/test_array_core.py::test_cumulative",
"dask/array/tests/test_array_core.py::test_eye",
"dask/array/tests/test_array_core.py::test_diag",
"dask/array/tests/test_array_core.py::test_tril_triu",
"dask/array/tests/test_array_core.py::test_tril_triu_errors",
"dask/array/tests/test_array_core.py::test_atop_names",
"dask/array/tests/test_array_core.py::test_atop_new_axes",
"dask/array/tests/test_array_core.py::test_atop_kwargs",
"dask/array/tests/test_array_core.py::test_atop_chunks",
"dask/array/tests/test_array_core.py::test_from_delayed",
"dask/array/tests/test_array_core.py::test_A_property",
"dask/array/tests/test_array_core.py::test_copy_mutate",
"dask/array/tests/test_array_core.py::test_npartitions",
"dask/array/tests/test_array_core.py::test_astype_gh1151",
"dask/array/tests/test_array_core.py::test_elemwise_name",
"dask/array/tests/test_array_core.py::test_map_blocks_name",
"dask/array/tests/test_array_core.py::test_from_array_names",
"dask/array/tests/test_array_core.py::test_array_picklable",
"dask/array/tests/test_array_core.py::test_swapaxes",
"dask/array/tests/test_array_core.py::test_from_array_raises_on_bad_chunks",
"dask/array/tests/test_array_core.py::test_concatenate_axes",
"dask/array/tests/test_array_core.py::test_atop_concatenate",
"dask/array/tests/test_array_core.py::test_common_blockdim",
"dask/array/tests/test_array_core.py::test_uneven_chunks_that_fit_neatly",
"dask/array/tests/test_array_core.py::test_elemwise_uneven_chunks",
"dask/array/tests/test_array_core.py::test_uneven_chunks_atop",
"dask/array/tests/test_array_core.py::test_warn_bad_rechunking",
"dask/array/tests/test_array_core.py::test_optimize_fuse_keys",
"dask/array/tests/test_array_core.py::test_round",
"dask/array/tests/test_array_core.py::test_repeat",
"dask/array/tests/test_array_core.py::test_tile[0-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile[0-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile[1-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile[1-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile[2-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile[2-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile[3-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile[3-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile[5-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile[5-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile_neg_reps[-1-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile_neg_reps[-1-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile_neg_reps[-5-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile_neg_reps[-5-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile_array_reps[reps0-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile_array_reps[reps0-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile_array_reps[reps1-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile_array_reps[reps1-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_concatenate_stack_dont_warn",
"dask/array/tests/test_array_core.py::test_map_blocks_delayed",
"dask/array/tests/test_array_core.py::test_no_chunks",
"dask/array/tests/test_array_core.py::test_no_chunks_2d",
"dask/array/tests/test_array_core.py::test_no_chunks_yes_chunks",
"dask/array/tests/test_array_core.py::test_raise_informative_errors_no_chunks",
"dask/array/tests/test_array_core.py::test_no_chunks_slicing_2d",
"dask/array/tests/test_array_core.py::test_index_array_with_array_1d",
"dask/array/tests/test_array_core.py::test_index_array_with_array_2d",
"dask/array/tests/test_array_core.py::test_setitem_1d",
"dask/array/tests/test_array_core.py::test_setitem_2d",
"dask/array/tests/test_array_core.py::test_setitem_errs",
"dask/array/tests/test_array_core.py::test_zero_slice_dtypes",
"dask/array/tests/test_array_core.py::test_zero_sized_array_rechunk",
"dask/array/tests/test_array_core.py::test_atop_zero_shape",
"dask/array/tests/test_array_core.py::test_atop_zero_shape_new_axes",
"dask/array/tests/test_array_core.py::test_broadcast_against_zero_shape",
"dask/array/tests/test_array_core.py::test_fast_from_array",
"dask/array/tests/test_array_core.py::test_random_from_array",
"dask/array/tests/test_array_core.py::test_concatenate_errs",
"dask/array/tests/test_array_core.py::test_stack_errs",
"dask/array/tests/test_array_core.py::test_transpose_negative_axes",
"dask/array/tests/test_array_core.py::test_atop_with_numpy_arrays",
"dask/array/tests/test_array_core.py::test_elemwise_with_lists[other0-100]",
"dask/array/tests/test_array_core.py::test_elemwise_with_lists[other0-6]",
"dask/array/tests/test_array_core.py::test_elemwise_with_lists[other1-100]",
"dask/array/tests/test_array_core.py::test_elemwise_with_lists[other1-6]",
"dask/array/tests/test_array_core.py::test_elemwise_with_lists[other2-100]",
"dask/array/tests/test_array_core.py::test_elemwise_with_lists[other2-6]",
"dask/array/tests/test_array_core.py::test_constructor_plugin",
"dask/array/tests/test_rechunk.py::test_rechunk_internals_1",
"dask/array/tests/test_rechunk.py::test_intersect_1",
"dask/array/tests/test_rechunk.py::test_intersect_2",
"dask/array/tests/test_rechunk.py::test_rechunk_1d",
"dask/array/tests/test_rechunk.py::test_rechunk_2d",
"dask/array/tests/test_rechunk.py::test_rechunk_4d",
"dask/array/tests/test_rechunk.py::test_rechunk_expand",
"dask/array/tests/test_rechunk.py::test_rechunk_expand2",
"dask/array/tests/test_rechunk.py::test_rechunk_method",
"dask/array/tests/test_rechunk.py::test_rechunk_blockshape",
"dask/array/tests/test_rechunk.py::test_dtype",
"dask/array/tests/test_rechunk.py::test_rechunk_with_dict",
"dask/array/tests/test_rechunk.py::test_rechunk_with_empty_input",
"dask/array/tests/test_rechunk.py::test_rechunk_with_null_dimensions",
"dask/array/tests/test_rechunk.py::test_rechunk_with_integer",
"dask/array/tests/test_rechunk.py::test_rechunk_0d",
"dask/array/tests/test_rechunk.py::test_rechunk_same",
"dask/array/tests/test_rechunk.py::test_rechunk_intermediates",
"dask/array/tests/test_rechunk.py::test_divide_to_width",
"dask/array/tests/test_rechunk.py::test_merge_to_number",
"dask/array/tests/test_rechunk.py::test_plan_rechunk",
"dask/array/tests/test_rechunk.py::test_plan_rechunk_5d",
"dask/array/tests/test_rechunk.py::test_plan_rechunk_heterogenous",
"dask/array/tests/test_rechunk.py::test_rechunk_warning",
"dask/array/tests/test_rechunk.py::test_dont_concatenate_single_chunks[shape0-chunks0]",
"dask/array/tests/test_rechunk.py::test_dont_concatenate_single_chunks[shape1-chunks1]",
"dask/array/tests/test_rechunk.py::test_dont_concatenate_single_chunks[shape2-chunks2]"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 1,177 |
Azure__azure-cli-2844
|
a8395ea70322dbf535d474d52ebf3d625a6cbdf0
|
2017-04-12 18:02:44
|
eb12ac454cbe1ddb59c86cdf2045e1912660e750
|
codecov-io: # [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=h1) Report
> Merging [#2844](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=desc) into [master](https://codecov.io/gh/Azure/azure-cli/commit/a8395ea70322dbf535d474d52ebf3d625a6cbdf0?src=pr&el=desc) will **increase** coverage by `0.04%`.
> The diff coverage is `100%`.
[](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #2844 +/- ##
==========================================
+ Coverage 62.88% 62.92% +0.04%
==========================================
Files 464 464
Lines 25901 25899 -2
Branches 3944 3943 -1
==========================================
+ Hits 16288 16298 +10
+ Misses 8594 8567 -27
- Partials 1019 1034 +15
```
| [Impacted Files](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...etwork/azure/cli/command\_modules/network/custom.py](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktbmV0d29yay9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL25ldHdvcmsvY3VzdG9tLnB5) | `63.46% <ø> (+1.08%)` | :arrow_up: |
| [...twork/azure/cli/command\_modules/network/\_params.py](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktbmV0d29yay9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL25ldHdvcmsvX3BhcmFtcy5weQ==) | `92.51% <100%> (ø)` | :arrow_up: |
| [...ure-cli-core/azure/cli/core/commands/parameters.py](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=tree#diff-c3JjL2F6dXJlLWNsaS1jb3JlL2F6dXJlL2NsaS9jb3JlL2NvbW1hbmRzL3BhcmFtZXRlcnMucHk=) | `70.96% <0%> (-2.16%)` | :arrow_down: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=footer). Last update [a8395ea...9d6c9c2](https://codecov.io/gh/Azure/azure-cli/pull/2844?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
|
diff --git a/src/command_modules/azure-cli-network/HISTORY.rst b/src/command_modules/azure-cli-network/HISTORY.rst
index 93cd59cca..3be0480e2 100644
--- a/src/command_modules/azure-cli-network/HISTORY.rst
+++ b/src/command_modules/azure-cli-network/HISTORY.rst
@@ -10,6 +10,7 @@ unreleased
* BC: Fix bug in the output of `vpn-connection create`
* Fix bug where '--key-length' argument of 'vpn-connection create' was not parsed correctly.
* Fix bug in `dns zone import` where records were not imported correctly.
+* Fix bug where `traffic-manager endpoint update` did not work.
2.0.2 (2017-04-03)
++++++++++++++++++
diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py
index 7cfbe5f1f..4621edb01 100644
--- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py
+++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/_params.py
@@ -21,7 +21,7 @@ from azure.cli.core.commands import \
(CliArgumentType, register_cli_argument, register_extra_cli_argument)
from azure.cli.core.commands.parameters import (location_type, get_resource_name_completion_list,
enum_choice_list, tags_type, ignore_type,
- get_generic_completion_list, file_type)
+ file_type)
from azure.cli.core.commands.validators import \
(MarkSpecifiedAction, get_default_location_from_resource_group)
from azure.cli.core.commands.template_create import get_folded_parameter_help_string
@@ -537,7 +537,7 @@ register_cli_argument('network traffic-manager profile check-dns', 'type', help=
# Traffic manager endpoints
endpoint_types = ['azureEndpoints', 'externalEndpoints', 'nestedEndpoints']
register_cli_argument('network traffic-manager endpoint', 'endpoint_name', name_arg_type, id_part='child_name', help='Endpoint name.', completer=get_tm_endpoint_completion_list())
-register_cli_argument('network traffic-manager endpoint', 'endpoint_type', options_list=('--type',), help='Endpoint type. Values include: {}.'.format(', '.join(endpoint_types)), completer=get_generic_completion_list(endpoint_types))
+register_cli_argument('network traffic-manager endpoint', 'endpoint_type', options_list=['--type', '-t'], help='Endpoint type.', id_part='child_name', **enum_choice_list(endpoint_types))
register_cli_argument('network traffic-manager endpoint', 'profile_name', help='Name of parent profile.', completer=get_resource_name_completion_list('Microsoft.Network/trafficManagerProfiles'), id_part='name')
register_cli_argument('network traffic-manager endpoint', 'endpoint_location', help="Location of the external or nested endpoints when using the 'Performance' routing method.")
register_cli_argument('network traffic-manager endpoint', 'endpoint_monitor_status', help='The monitoring status of the endpoint.')
diff --git a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py
index bb5e9ba90..282e7eaec 100644
--- a/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py
+++ b/src/command_modules/azure-cli-network/azure/cli/command_modules/network/custom.py
@@ -1673,8 +1673,6 @@ def update_traffic_manager_endpoint(instance, endpoint_type=None, endpoint_locat
endpoint_status=None, endpoint_monitor_status=None,
priority=None, target=None, target_resource_id=None,
weight=None, min_child_endpoints=None):
- if endpoint_type is not None:
- instance.type = endpoint_type
if endpoint_location is not None:
instance.endpoint_location = endpoint_location
if endpoint_status is not None:
|
traffic-manager command failed to update endpoint
### Environment summary
**Install Method:** How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly)
apt-get
**CLI Version:** What version of the CLI and modules are installed? (Use `az --version`)
azure-cli (2.0.0)
network (2.0.0)
**OS Version:** What OS and version are you using?
Windows 10
**Shell Type:** What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
Bash on Windows
---
### Description
Cannot update endpoint settings. '--type' parameter seems to be used setting resource rul as below
```
$ az network traffic-manager endpoint update -g DEMO-FTAPP --profile-name ilkimftapptm --name endpoint1 --priority 3 --type "Microsoft.Network/trafficManagerProfiles/azureEndpoints"
Operation failed with status: 'Bad Request'. Details: 400 Client Error: Bad Request for url: https://management.azure.com/subscriptions/<subs>/resourceGroups/DEMO-FTAPP/providers/Microsoft.Network/trafficmanagerprofiles/ilkimftapptm/Microsoft.Network%2FtrafficManagerProfiles%2FazureEndpoints/endpoint1?api-version=2015-11-01
```
url should be:
```
https://management.azure.com/subscriptions/<subs>/resourceGroups/DEMO-FTAPP/providers/Microsoft.Network/trafficmanagerprofiles/ilkimftapptm/azureEndpoints/endpoint1?api-version=2015-11-01
```
I tried below command and it didn't work too!
```
$ az network traffic-manager endpoint update -g DEMO-FTAPP --profile-name ilkimftapptm --name endpoint1 --priority 3 --type "azureEndpoints"
The value 'azureEndpoints' provided for field 'type' is invalid. Expected value is 'Microsoft.Network/trafficManagerProfiles/azureendpoints'.
```
|
Azure/azure-cli
|
diff --git a/src/command_modules/azure-cli-network/tests/recordings/test_network_traffic_manager.yaml b/src/command_modules/azure-cli-network/tests/recordings/test_network_traffic_manager.yaml
index a751cb376..993f92d1e 100644
--- a/src/command_modules/azure-cli-network/tests/recordings/test_network_traffic_manager.yaml
+++ b/src/command_modules/azure-cli-network/tests/recordings/test_network_traffic_manager.yaml
@@ -1,17 +1,17 @@
interactions:
- request:
- body: '{"name": "myfoobar1", "type": "Microsoft.Network/trafficManagerProfiles"}'
+ body: '{"type": "Microsoft.Network/trafficManagerProfiles", "name": "myfoobar1"}'
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['73']
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5
+ User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.0+dev]
+ AZURECLI/TEST/2.0.2+dev]
accept-language: [en-US]
- x-ms-client-request-id: [dea79918-fd3d-11e6-9c5e-a0b3ccf7272a]
+ x-ms-client-request-id: [c35bd93a-1fa8-11e7-a57c-a0b3ccf7272a]
method: POST
uri: https://management.azure.com/providers/Microsoft.Network/checkTrafficManagerNameAvailability?api-version=2015-11-01
response:
@@ -19,7 +19,7 @@ interactions:
headers:
Cache-Control: [private]
Content-Type: [application/json; charset=utf-8]
- Date: ['Mon, 27 Feb 2017 22:41:25 GMT']
+ Date: ['Wed, 12 Apr 2017 17:52:14 GMT']
Server: [Microsoft-IIS/8.5]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
Transfer-Encoding: [chunked]
@@ -31,35 +31,35 @@ interactions:
x-ms-ratelimit-remaining-tenant-writes: ['1199']
status: {code: 200, message: OK}
- request:
- body: '{"location": "global", "properties": {"monitorConfig": {"protocol": "http",
- "path": "/", "port": 80}, "dnsConfig": {"ttl": 30, "relativeName": "mytrafficmanager001100a"},
- "profileStatus": "enabled", "trafficRoutingMethod": "weighted"}}'
+ body: '{"properties": {"dnsConfig": {"ttl": 30, "relativeName": "mytrafficmanager001100a"},
+ "trafficRoutingMethod": "Priority", "profileStatus": "Enabled", "monitorConfig":
+ {"protocol": "http", "port": 80, "path": "/"}}, "location": "global"}'
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['235']
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5
+ User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.0+dev]
+ AZURECLI/TEST/2.0.2+dev]
accept-language: [en-US]
- x-ms-client-request-id: [df4a990c-fd3d-11e6-a2cf-a0b3ccf7272a]
+ x-ms-client-request-id: [c3b8fbe4-1fa8-11e7-b827-a0b3ccf7272a]
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01
response:
- body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Weighted","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'}
+ body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Priority","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'}
headers:
Cache-Control: [private]
Content-Length: ['567']
Content-Type: [application/json; charset=utf-8]
- Date: ['Mon, 27 Feb 2017 22:41:27 GMT']
+ Date: ['Wed, 12 Apr 2017 17:52:17 GMT']
Server: [Microsoft-IIS/8.5]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
X-AspNet-Version: [4.0.30319]
X-Content-Type-Options: [nosniff]
X-Powered-By: [ASP.NET]
- x-ms-ratelimit-remaining-subscription-resource-requests: ['10799']
+ x-ms-ratelimit-remaining-subscription-resource-requests: ['10798']
status: {code: 201, message: Created}
- request:
body: null
@@ -68,19 +68,19 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5
+ User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.0+dev]
+ AZURECLI/TEST/2.0.2+dev]
accept-language: [en-US]
- x-ms-client-request-id: [e099279e-fd3d-11e6-b940-a0b3ccf7272a]
+ x-ms-client-request-id: [c4b1e446-1fa8-11e7-b47a-a0b3ccf7272a]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01
response:
- body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Weighted","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'}
+ body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Priority","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'}
headers:
Cache-Control: [private]
Content-Type: [application/json; charset=utf-8]
- Date: ['Mon, 27 Feb 2017 22:41:28 GMT']
+ Date: ['Wed, 12 Apr 2017 17:52:17 GMT']
Server: [Microsoft-IIS/8.5]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
Transfer-Encoding: [chunked]
@@ -98,19 +98,53 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5
+ User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.0+dev]
+ AZURECLI/TEST/2.0.2+dev]
accept-language: [en-US]
- x-ms-client-request-id: [e1235ef0-fd3d-11e6-ae3c-a0b3ccf7272a]
+ x-ms-client-request-id: [c516762e-1fa8-11e7-bcf9-a0b3ccf7272a]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01
+ response:
+ body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Priority","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'}
+ headers:
+ Cache-Control: [private]
+ Content-Type: [application/json; charset=utf-8]
+ Date: ['Wed, 12 Apr 2017 17:52:17 GMT']
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ Transfer-Encoding: [chunked]
+ Vary: [Accept-Encoding]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET]
+ content-length: ['567']
+ x-ms-ratelimit-remaining-subscription-resource-requests: ['10799']
+ status: {code: 200, message: OK}
+- request:
+ body: '{"properties": {"dnsConfig": {"ttl": 30, "fqdn": "mytrafficmanager001100a.trafficmanager.net",
+ "relativeName": "mytrafficmanager001100a"}, "trafficRoutingMethod": "Weighted",
+ "profileStatus": "Enabled", "endpoints": [], "monitorConfig": {"profileMonitorStatus":
+ "Inactive", "protocol": "HTTP", "port": 80, "path": "/"}}, "location": "global"}'
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ Connection: [keep-alive]
+ Content-Length: ['342']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.2+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [c577fe92-1fa8-11e7-8040-a0b3ccf7272a]
+ method: PUT
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01
response:
body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Weighted","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'}
headers:
Cache-Control: [private]
Content-Type: [application/json; charset=utf-8]
- Date: ['Mon, 27 Feb 2017 22:41:28 GMT']
+ Date: ['Wed, 12 Apr 2017 17:52:18 GMT']
Server: [Microsoft-IIS/8.5]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
Transfer-Encoding: [chunked]
@@ -121,6 +155,66 @@ interactions:
content-length: ['567']
x-ms-ratelimit-remaining-subscription-resource-requests: ['10799']
status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.2+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [c63f854a-1fa8-11e7-bd49-a0b3ccf7272a]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles?api-version=2015-11-01
+ response:
+ body: {string: '{"value":[{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Weighted","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":null,"protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}]}'}
+ headers:
+ Cache-Control: [private]
+ Content-Type: [application/json; charset=utf-8]
+ Date: ['Wed, 12 Apr 2017 17:52:20 GMT']
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ Transfer-Encoding: [chunked]
+ Vary: [Accept-Encoding]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET]
+ content-length: ['573']
+ x-ms-ratelimit-remaining-subscription-resource-requests: ['10799']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.2+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [c6acd7a2-1fa8-11e7-a232-a0b3ccf7272a]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01
+ response:
+ body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Weighted","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'}
+ headers:
+ Cache-Control: [private]
+ Content-Type: [application/json; charset=utf-8]
+ Date: ['Wed, 12 Apr 2017 17:52:21 GMT']
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ Transfer-Encoding: [chunked]
+ Vary: [Accept-Encoding]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET]
+ content-length: ['567']
+ x-ms-ratelimit-remaining-subscription-resource-requests: ['10798']
+ status: {code: 200, message: OK}
- request:
body: '{"properties": {"weight": 50, "target": "www.microsoft.com"}}'
headers:
@@ -129,11 +223,11 @@ interactions:
Connection: [keep-alive]
Content-Length: ['61']
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5
+ User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.0+dev]
+ AZURECLI/TEST/2.0.2+dev]
accept-language: [en-US]
- x-ms-client-request-id: [e16d6200-fd3d-11e6-ae5b-a0b3ccf7272a]
+ x-ms-client-request-id: [c7251738-1fa8-11e7-ac77-a0b3ccf7272a]
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile/externalEndpoints/myendpoint?api-version=2015-11-01
response:
@@ -142,13 +236,13 @@ interactions:
Cache-Control: [private]
Content-Length: ['461']
Content-Type: [application/json; charset=utf-8]
- Date: ['Mon, 27 Feb 2017 22:41:30 GMT']
+ Date: ['Wed, 12 Apr 2017 17:52:21 GMT']
Server: [Microsoft-IIS/8.5]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
X-AspNet-Version: [4.0.30319]
X-Content-Type-Options: [nosniff]
X-Powered-By: [ASP.NET]
- x-ms-ratelimit-remaining-subscription-writes: ['1199']
+ x-ms-ratelimit-remaining-subscription-writes: ['1197']
status: {code: 201, message: Created}
- request:
body: null
@@ -157,11 +251,11 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.5
+ User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.0+dev]
+ AZURECLI/TEST/2.0.2+dev]
accept-language: [en-US]
- x-ms-client-request-id: [e2782a3e-fd3d-11e6-a760-a0b3ccf7272a]
+ x-ms-client-request-id: [c7bce5c6-1fa8-11e7-84a1-a0b3ccf7272a]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile/externalEndpoints/myendpoint?api-version=2015-11-01
response:
@@ -169,7 +263,7 @@ interactions:
headers:
Cache-Control: [private]
Content-Type: [application/json; charset=utf-8]
- Date: ['Mon, 27 Feb 2017 22:41:31 GMT']
+ Date: ['Wed, 12 Apr 2017 17:52:22 GMT']
Server: [Microsoft-IIS/8.5]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
Transfer-Encoding: [chunked]
@@ -179,4 +273,181 @@ interactions:
X-Powered-By: [ASP.NET]
content-length: ['461']
status: {code: 200, message: OK}
+- request:
+ body: '{"type": "Microsoft.Network/trafficManagerProfiles/externalEndpoints",
+ "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficManagerProfiles/mytmprofile/externalEndpoints/myendpoint",
+ "name": "myendpoint", "properties": {"weight": 25, "endpointMonitorStatus":
+ "CheckingEndpoint", "priority": 1, "endpointStatus": "Enabled", "target": "www.contoso.com"}}'
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ Connection: [keep-alive]
+ Content-Length: ['439']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.2+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [c81c2818-1fa8-11e7-9c66-a0b3ccf7272a]
+ method: PUT
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile/externalEndpoints/myendpoint?api-version=2015-11-01
+ response:
+ body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile\/externalEndpoints\/myendpoint","name":"myendpoint","type":"Microsoft.Network\/trafficManagerProfiles\/externalEndpoints","properties":{"endpointStatus":"Enabled","endpointMonitorStatus":"CheckingEndpoint","target":"www.contoso.com","weight":25,"priority":1,"endpointLocation":null}}'}
+ headers:
+ Cache-Control: [private]
+ Content-Length: ['459']
+ Content-Type: [application/json; charset=utf-8]
+ Date: ['Wed, 12 Apr 2017 17:52:24 GMT']
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET]
+ x-ms-ratelimit-remaining-subscription-writes: ['1196']
+ status: {code: 201, message: Created}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.2+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [c9292fdc-1fa8-11e7-9ad6-a0b3ccf7272a]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile/externalEndpoints/myendpoint?api-version=2015-11-01
+ response:
+ body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile\/externalEndpoints\/myendpoint","name":"myendpoint","type":"Microsoft.Network\/trafficManagerProfiles\/externalEndpoints","properties":{"endpointStatus":"Enabled","endpointMonitorStatus":"CheckingEndpoint","target":"www.contoso.com","weight":25,"priority":1,"endpointLocation":null}}'}
+ headers:
+ Cache-Control: [private]
+ Content-Type: [application/json; charset=utf-8]
+ Date: ['Wed, 12 Apr 2017 17:52:24 GMT']
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ Transfer-Encoding: [chunked]
+ Vary: [Accept-Encoding]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET]
+ content-length: ['459']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.2+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [c960dc38-1fa8-11e7-b153-a0b3ccf7272a]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01
+ response:
+ body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Weighted","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"CheckingEndpoints","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile\/externalEndpoints\/myendpoint","name":"myendpoint","type":"Microsoft.Network\/trafficManagerProfiles\/externalEndpoints","properties":{"endpointStatus":"Enabled","endpointMonitorStatus":"CheckingEndpoint","target":"www.contoso.com","weight":25,"priority":1,"endpointLocation":null}}]}}'}
+ headers:
+ Cache-Control: [private]
+ Content-Type: [application/json; charset=utf-8]
+ Date: ['Wed, 12 Apr 2017 17:52:24 GMT']
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ Transfer-Encoding: [chunked]
+ Vary: [Accept-Encoding]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET]
+ content-length: ['1035']
+ x-ms-ratelimit-remaining-subscription-resource-requests: ['10797']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ Connection: [keep-alive]
+ Content-Length: ['0']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.2+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [c9d5ce4c-1fa8-11e7-a218-a0b3ccf7272a]
+ method: DELETE
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile/externalEndpoints/myendpoint?api-version=2015-11-01
+ response:
+ body: {string: ''}
+ headers:
+ Cache-Control: [private]
+ Content-Length: ['0']
+ Date: ['Wed, 12 Apr 2017 17:52:26 GMT']
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET]
+ x-ms-ratelimit-remaining-subscription-writes: ['1196']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.2+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [caae0382-1fa8-11e7-a75e-a0b3ccf7272a]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01
+ response:
+ body: {string: '{"id":"\/subscriptions\/0b1f6471-1bf0-4dda-aec3-cb9272f09590\/resourceGroups\/cli_test_traffic_manager\/providers\/Microsoft.Network\/trafficManagerProfiles\/mytmprofile","name":"mytmprofile","type":"Microsoft.Network\/trafficManagerProfiles","location":"global","properties":{"profileStatus":"Enabled","trafficRoutingMethod":"Weighted","dnsConfig":{"relativeName":"mytrafficmanager001100a","fqdn":"mytrafficmanager001100a.trafficmanager.net","ttl":30},"monitorConfig":{"profileMonitorStatus":"Inactive","protocol":"HTTP","port":80,"path":"\/"},"endpoints":[]}}'}
+ headers:
+ Cache-Control: [private]
+ Content-Type: [application/json; charset=utf-8]
+ Date: ['Wed, 12 Apr 2017 17:52:27 GMT']
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ Transfer-Encoding: [chunked]
+ Vary: [Accept-Encoding]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET]
+ content-length: ['567']
+ x-ms-ratelimit-remaining-subscription-resource-requests: ['10798']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ Connection: [keep-alive]
+ Content-Length: ['0']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 trafficmanagermanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.2+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [caf1f406-1fa8-11e7-9880-a0b3ccf7272a]
+ method: DELETE
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_traffic_manager/providers/Microsoft.Network/trafficmanagerprofiles/mytmprofile?api-version=2015-11-01
+ response:
+ body: {string: ''}
+ headers:
+ Cache-Control: [private]
+ Content-Length: ['0']
+ Date: ['Wed, 12 Apr 2017 17:52:28 GMT']
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET]
+ x-ms-ratelimit-remaining-subscription-resource-requests: ['10799']
+ status: {code: 200, message: OK}
version: 1
diff --git a/src/command_modules/azure-cli-network/tests/test_network_commands.py b/src/command_modules/azure-cli-network/tests/test_network_commands.py
index 09b8c1029..b2df51b2f 100644
--- a/src/command_modules/azure-cli-network/tests/test_network_commands.py
+++ b/src/command_modules/azure-cli-network/tests/test_network_commands.py
@@ -1301,15 +1301,30 @@ class NetworkTrafficManagerScenarioTest(ResourceGroupVCRTestBase):
unique_dns_name = 'mytrafficmanager001100a'
self.cmd('network traffic-manager profile check-dns -n myfoobar1')
- self.cmd('network traffic-manager profile create -n {} -g {} --routing-method weighted --unique-dns-name {}'.format(tm_name, self.resource_group, unique_dns_name),
- checks=JMESPathCheck('TrafficManagerProfile.trafficRoutingMethod', 'Weighted'))
+ self.cmd('network traffic-manager profile create -n {} -g {} --routing-method priority --unique-dns-name {}'.format(tm_name, self.resource_group, unique_dns_name),
+ checks=JMESPathCheck('TrafficManagerProfile.trafficRoutingMethod', 'Priority'))
self.cmd('network traffic-manager profile show -g {} -n {}'.format(self.resource_group, tm_name),
checks=JMESPathCheck('dnsConfig.relativeName', unique_dns_name))
+ self.cmd('network traffic-manager profile update -n {} -g {} --routing-method weighted'.format(tm_name, self.resource_group),
+ checks=JMESPathCheck('trafficRoutingMethod', 'Weighted'))
+ self.cmd('network traffic-manager profile list -g {}'.format(self.resource_group))
+ # Endpoint tests
self.cmd('network traffic-manager endpoint create -n {} --profile-name {} -g {} --type externalEndpoints --weight 50 --target www.microsoft.com'.format(endpoint_name, tm_name, self.resource_group),
checks=JMESPathCheck('type', 'Microsoft.Network/trafficManagerProfiles/externalEndpoints'))
- self.cmd('network traffic-manager endpoint show --profile-name {} --type externalEndpoints -n {} -g {}'.format(tm_name, endpoint_name, self.resource_group),
- checks=JMESPathCheck('target', 'www.microsoft.com'))
+ self.cmd('network traffic-manager endpoint update -n {} --profile-name {} -g {} --type externalEndpoints --weight 25 --target www.contoso.com'.format(endpoint_name, tm_name, self.resource_group), checks=[
+ JMESPathCheck('weight', 25),
+ JMESPathCheck('target', 'www.contoso.com')
+ ])
+ self.cmd('network traffic-manager endpoint show -g {} --profile-name {} -t externalEndpoints -n {}'.format(self.resource_group, tm_name, endpoint_name))
+ self.cmd('network traffic-manager endpoint list -g {} --profile-name {} -t externalEndpoints'.format(self.resource_group, tm_name),
+ checks=JMESPathCheck('length(@)', 1))
+ self.cmd('network traffic-manager endpoint delete -g {} --profile-name {} -t externalEndpoints -n {}'.format(self.resource_group, tm_name, endpoint_name))
+ self.cmd('network traffic-manager endpoint list -g {} --profile-name {} -t externalEndpoints'.format(self.resource_group, tm_name),
+ checks=JMESPathCheck('length(@)', 0))
+
+ self.cmd('network traffic-manager profile delete -g {} -n {}'.format(self.resource_group, tm_name))
+
class NetworkDnsScenarioTest(ResourceGroupVCRTestBase):
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 3
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "python scripts/dev_setup.py",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.5",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
adal==0.4.3
applicationinsights==0.10.0
argcomplete==1.8.0
astroid==1.4.9
attrs==22.2.0
autopep8==1.2.4
azure-batch==2.0.0
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli&subdirectory=src/azure-cli
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_core&subdirectory=src/azure-cli-core
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_dla&subdirectory=src/command_modules/azure-cli-dla
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_dls&subdirectory=src/command_modules/azure-cli-dls
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_documentdb&subdirectory=src/command_modules/azure-cli-documentdb
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_find&subdirectory=src/command_modules/azure-cli-find
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_lab&subdirectory=src/command_modules/azure-cli-lab
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_monitor&subdirectory=src/command_modules/azure-cli-monitor
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_testsdk&subdirectory=src/azure-cli-testsdk
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_utility_automation&subdirectory=scripts
-e git+https://github.com/Azure/azure-cli.git@a8395ea70322dbf535d474d52ebf3d625a6cbdf0#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm
azure-common==1.1.4
azure-core==1.24.2
azure-datalake-store==0.0.6
azure-graphrbac==0.30.0rc6
azure-keyvault==0.1.0
azure-mgmt-authorization==0.30.0rc6
azure-mgmt-batch==3.0.0
azure-mgmt-compute==0.33.1rc1
azure-mgmt-containerregistry==0.2.0
azure-mgmt-datalake-analytics==0.1.3
azure-mgmt-datalake-nspkg==3.0.1
azure-mgmt-datalake-store==0.1.3
azure-mgmt-dns==1.0.0
azure-mgmt-documentdb==0.1.1
azure-mgmt-iothub==0.2.1
azure-mgmt-keyvault==0.30.0
azure-mgmt-monitor==0.1.0
azure-mgmt-network==0.30.0
azure-mgmt-nspkg==3.0.2
azure-mgmt-redis==1.0.0
azure-mgmt-resource==0.30.2
azure-mgmt-sql==0.4.0
azure-mgmt-storage==0.31.0
azure-mgmt-trafficmanager==0.30.0rc6
azure-mgmt-web==0.31.0
azure-monitor==0.2.0
azure-nspkg==3.0.2
azure-storage==0.34.0
certifi==2021.5.30
cffi==1.15.1
colorama==0.3.7
coverage==4.2
cryptography==40.0.2
flake8==3.2.1
importlib-metadata==4.8.3
iniconfig==1.1.1
isodate==0.7.0
jeepney==0.7.1
jmespath==0.10.0
keyring==23.4.1
lazy-object-proxy==1.7.1
mccabe==0.5.3
mock==1.3.0
msrest==0.4.29
msrestazure==0.4.34
nose==1.3.7
oauthlib==3.2.2
packaging==21.3
paramiko==2.0.2
pbr==6.1.1
pep8==1.7.1
pluggy==1.0.0
py==1.11.0
pyasn1==0.5.1
pycodestyle==2.2.0
pycparser==2.21
pyflakes==1.3.0
Pygments==2.1.3
PyJWT==2.4.0
pylint==1.5.4
pyOpenSSL==16.2.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
PyYAML==3.11
requests==2.9.1
requests-oauthlib==2.0.0
scp==0.15.0
SecretStorage==3.3.3
six==1.10.0
sshtunnel==0.4.0
tabulate==0.7.5
tomli==1.2.3
typing-extensions==4.1.1
urllib3==1.16
vcrpy==1.10.3
Whoosh==2.7.4
wrapt==1.16.0
xmltodict==0.14.2
zipp==3.6.0
|
name: azure-cli
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- adal==0.4.3
- applicationinsights==0.10.0
- argcomplete==1.8.0
- astroid==1.4.9
- attrs==22.2.0
- autopep8==1.2.4
- azure-batch==2.0.0
- azure-common==1.1.4
- azure-core==1.24.2
- azure-datalake-store==0.0.6
- azure-graphrbac==0.30.0rc6
- azure-keyvault==0.1.0
- azure-mgmt-authorization==0.30.0rc6
- azure-mgmt-batch==3.0.0
- azure-mgmt-compute==0.33.1rc1
- azure-mgmt-containerregistry==0.2.0
- azure-mgmt-datalake-analytics==0.1.3
- azure-mgmt-datalake-nspkg==3.0.1
- azure-mgmt-datalake-store==0.1.3
- azure-mgmt-dns==1.0.0
- azure-mgmt-documentdb==0.1.1
- azure-mgmt-iothub==0.2.1
- azure-mgmt-keyvault==0.30.0
- azure-mgmt-monitor==0.1.0
- azure-mgmt-network==0.30.0
- azure-mgmt-nspkg==3.0.2
- azure-mgmt-redis==1.0.0
- azure-mgmt-resource==0.30.2
- azure-mgmt-sql==0.4.0
- azure-mgmt-storage==0.31.0
- azure-mgmt-trafficmanager==0.30.0rc6
- azure-mgmt-web==0.31.0
- azure-monitor==0.2.0
- azure-nspkg==3.0.2
- azure-storage==0.34.0
- cffi==1.15.1
- colorama==0.3.7
- coverage==4.2
- cryptography==40.0.2
- flake8==3.2.1
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- isodate==0.7.0
- jeepney==0.7.1
- jmespath==0.10.0
- keyring==23.4.1
- lazy-object-proxy==1.7.1
- mccabe==0.5.3
- mock==1.3.0
- msrest==0.4.29
- msrestazure==0.4.34
- nose==1.3.7
- oauthlib==3.2.2
- packaging==21.3
- paramiko==2.0.2
- pbr==6.1.1
- pep8==1.7.1
- pip==9.0.1
- pluggy==1.0.0
- py==1.11.0
- pyasn1==0.5.1
- pycodestyle==2.2.0
- pycparser==2.21
- pyflakes==1.3.0
- pygments==2.1.3
- pyjwt==2.4.0
- pylint==1.5.4
- pyopenssl==16.2.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pyyaml==3.11
- requests==2.9.1
- requests-oauthlib==2.0.0
- scp==0.15.0
- secretstorage==3.3.3
- setuptools==30.4.0
- six==1.10.0
- sshtunnel==0.4.0
- tabulate==0.7.5
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.16
- vcrpy==1.10.3
- whoosh==2.7.4
- wrapt==1.16.0
- xmltodict==0.14.2
- zipp==3.6.0
prefix: /opt/conda/envs/azure-cli
|
[
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkTrafficManagerScenarioTest::test_network_traffic_manager"
] |
[] |
[
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkMultiIdsShowScenarioTest::test_multi_id_show",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkUsageListScenarioTest::test_network_usage_list",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayDefaultScenarioTest::test_network_app_gateway_with_defaults",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayExistingSubnetScenarioTest::test_network_app_gateway_with_existing_subnet",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayNoWaitScenarioTest::test_network_app_gateway_no_wait",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayPrivateIpScenarioTest::test_network_app_gateway_with_private_ip",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayPublicIpScenarioTest::test_network_app_gateway_with_public_ip",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkAppGatewayWafScenarioTest::test_network_app_gateway_waf",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkPublicIpScenarioTest::test_network_public_ip",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkExpressRouteScenarioTest::test_network_express_route",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkLoadBalancerScenarioTest::test_network_load_balancer",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkLoadBalancerIpConfigScenarioTest::test_network_load_balancer_ip_config",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkLoadBalancerSubresourceScenarioTest::test_network_load_balancer_subresources",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkLocalGatewayScenarioTest::test_network_local_gateway",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkNicScenarioTest::test_network_nic",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkNicSubresourceScenarioTest::test_network_nic_subresources",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkNicConvenienceCommandsScenarioTest::test_network_nic_convenience_commands",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkSecurityGroupScenarioTest::test_network_nsg",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkRouteTableOperationScenarioTest::test_network_route_table_operation",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkVNetScenarioTest::test_network_vnet",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkVNetPeeringScenarioTest::test_network_vnet_peering",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkSubnetSetScenarioTest::test_network_subnet_set",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkActiveActiveCrossPremiseScenarioTest::test_network_active_active_cross_premise_connection",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkActiveActiveVnetVnetScenarioTest::test_network_active_active_vnet_vnet_connection",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkVpnGatewayScenarioTest::test_network_vpn_gateway",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkDnsScenarioTest::test_network_dns",
"src/command_modules/azure-cli-network/tests/test_network_commands.py::NetworkZoneImportExportTest::test_network_dns_zone_import_export"
] |
[] |
MIT License
| 1,179 |
elastic__elasticsearch-py-569
|
fe897ebe0d2167e91ea19fa9a81f448a861d58d1
|
2017-04-13 11:28:46
|
fe897ebe0d2167e91ea19fa9a81f448a861d58d1
|
diff --git a/elasticsearch/client/__init__.py b/elasticsearch/client/__init__.py
index c735b70a..488cf8be 100644
--- a/elasticsearch/client/__init__.py
+++ b/elasticsearch/client/__init__.py
@@ -3,7 +3,7 @@ import logging
from ..transport import Transport
from ..exceptions import TransportError
-from ..compat import string_types, urlparse
+from ..compat import string_types, urlparse, unquote
from .indices import IndicesClient
from .ingest import IngestClient
from .cluster import ClusterClient
@@ -49,7 +49,8 @@ def _normalize_hosts(hosts):
h['scheme'] = parsed_url.scheme
if parsed_url.username or parsed_url.password:
- h['http_auth'] = '%s:%s' % (parsed_url.username, parsed_url.password)
+ h['http_auth'] = '%s:%s' % (unquote(parsed_url.username),
+ unquote(parsed_url.password))
if parsed_url.path and parsed_url.path != '/':
h['url_prefix'] = parsed_url.path
diff --git a/elasticsearch/compat.py b/elasticsearch/compat.py
index deee3c52..a5b615d2 100644
--- a/elasticsearch/compat.py
+++ b/elasticsearch/compat.py
@@ -4,10 +4,10 @@ PY2 = sys.version_info[0] == 2
if PY2:
string_types = basestring,
- from urllib import quote_plus, urlencode
+ from urllib import quote_plus, urlencode, unquote
from urlparse import urlparse
from itertools import imap as map
else:
string_types = str, bytes
- from urllib.parse import quote_plus, urlencode, urlparse
+ from urllib.parse import quote_plus, urlencode, urlparse, unquote
map = map
|
user:password in hosts are not url decoded
Hello,
If I have a character like "]" in my username or password I must urlencode it or `urlparse` will interpret the host as IPv6. Unfortunately, `urlparse` does not urldecode fragments :
```
The components are not broken up in smaller parts (for example, the network location is a single string), and % escapes are not expanded.
```
(https://docs.python.org/3/library/urllib.parse.html)
`_normalize_hosts` should urldecode explicitely, which I will propose in a PR.
|
elastic/elasticsearch-py
|
diff --git a/test_elasticsearch/test_client/__init__.py b/test_elasticsearch/test_client/__init__.py
index 4bf2978c..ec01145e 100644
--- a/test_elasticsearch/test_client/__init__.py
+++ b/test_elasticsearch/test_client/__init__.py
@@ -13,8 +13,8 @@ class TestNormalizeHosts(TestCase):
def test_strings_are_parsed_for_port_and_user(self):
self.assertEquals(
- [{"host": "elastic.co", "port": 42}, {"host": "elastic.co", "http_auth": "user:secret"}],
- _normalize_hosts(["elastic.co:42", "user:[email protected]"])
+ [{"host": "elastic.co", "port": 42}, {"host": "elastic.co", "http_auth": "user:secre]"}],
+ _normalize_hosts(["elastic.co:42", "user:secre%[email protected]"])
)
def test_strings_are_parsed_for_scheme(self):
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 2
}
|
5.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
coverage==7.8.0
-e git+https://github.com/elastic/elasticsearch-py.git@fe897ebe0d2167e91ea19fa9a81f448a861d58d1#egg=elasticsearch
exceptiongroup==1.2.2
execnet==2.1.1
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
tomli==2.2.1
typing_extensions==4.13.0
urllib3==1.26.20
|
name: elasticsearch-py
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==7.8.0
- exceptiongroup==1.2.2
- execnet==2.1.1
- iniconfig==2.1.0
- packaging==24.2
- pluggy==1.5.0
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- tomli==2.2.1
- typing-extensions==4.13.0
- urllib3==1.26.20
prefix: /opt/conda/envs/elasticsearch-py
|
[
"test_elasticsearch/test_client/__init__.py::TestNormalizeHosts::test_strings_are_parsed_for_port_and_user"
] |
[] |
[
"test_elasticsearch/test_client/__init__.py::TestNormalizeHosts::test_dicts_are_left_unchanged",
"test_elasticsearch/test_client/__init__.py::TestNormalizeHosts::test_none_uses_defaults",
"test_elasticsearch/test_client/__init__.py::TestNormalizeHosts::test_single_string_is_wrapped_in_list",
"test_elasticsearch/test_client/__init__.py::TestNormalizeHosts::test_strings_are_parsed_for_scheme",
"test_elasticsearch/test_client/__init__.py::TestNormalizeHosts::test_strings_are_used_as_hostnames",
"test_elasticsearch/test_client/__init__.py::TestClient::test_from_in_search",
"test_elasticsearch/test_client/__init__.py::TestClient::test_index_uses_post_if_id_is_empty",
"test_elasticsearch/test_client/__init__.py::TestClient::test_index_uses_put_if_id_is_not_empty",
"test_elasticsearch/test_client/__init__.py::TestClient::test_params_is_copied_when",
"test_elasticsearch/test_client/__init__.py::TestClient::test_repr_contains_hosts",
"test_elasticsearch/test_client/__init__.py::TestClient::test_repr_contains_hosts_passed_in",
"test_elasticsearch/test_client/__init__.py::TestClient::test_repr_truncates_host_to_10",
"test_elasticsearch/test_client/__init__.py::TestClient::test_request_timeout_is_passed_through_unescaped"
] |
[] |
Apache License 2.0
| 1,182 |
|
craffel__mir_eval-249
|
6f8ee58f437dd9b8f54b3c9700e7b4dc3879853f
|
2017-04-14 19:32:43
|
0d17e0d6d3a773d2f2d5d76f3ea0a010cc2f929e
|
bmcfee: Note: coverage percentage decrease here is because the rewrite of `interpolate_intervals` is shorter than the previous implementation.
bmcfee: > Nice, elegant solution. Can you add a test which checks that it has the expected behavior with non-contiguous intervals?
Done.
|
diff --git a/mir_eval/util.py b/mir_eval/util.py
index 1df1142..0ce9130 100644
--- a/mir_eval/util.py
+++ b/mir_eval/util.py
@@ -129,11 +129,11 @@ def intervals_to_samples(intervals, labels, offset=0, sample_size=0.1,
def interpolate_intervals(intervals, labels, time_points, fill_value=None):
"""Assign labels to a set of points in time given a set of intervals.
- Note: Times outside of the known boundaries are mapped to None by default.
+ Time points that do not lie within an interval are mapped to `fill_value`.
Parameters
----------
- intervals : np.ndarray, shape=(n, d)
+ intervals : np.ndarray, shape=(n, 2)
An array of time intervals, as returned by
:func:`mir_eval.io.load_intervals()`.
The ``i`` th interval spans time ``intervals[i, 0]`` to
@@ -145,7 +145,8 @@ def interpolate_intervals(intervals, labels, time_points, fill_value=None):
The annotation for each interval
time_points : array_like, shape=(m,)
- Points in time to assign labels.
+ Points in time to assign labels. These must be in
+ non-decreasing order.
fill_value : type(labels[0])
Object to use for the label with out-of-range time points.
@@ -156,22 +157,26 @@ def interpolate_intervals(intervals, labels, time_points, fill_value=None):
aligned_labels : list
Labels corresponding to the given time points.
+ Raises
+ ------
+ ValueError
+ If `time_points` is not in non-decreasing order.
"""
- # Sort the intervals by start time
- intervals, labels = sort_labeled_intervals(intervals, labels)
+ # Verify that time_points is sorted
+ time_points = np.asarray(time_points)
+
+ if np.any(time_points[1:] < time_points[:-1]):
+ raise ValueError('time_points must be in non-decreasing order')
+
+ aligned_labels = [fill_value] * len(time_points)
- start, end = intervals.min(), intervals.max()
+ starts = np.searchsorted(time_points, intervals[:, 0], side='left')
+ ends = np.searchsorted(time_points, intervals[:, 1], side='right')
- aligned_labels = []
+ for (start, end, lab) in zip(starts, ends, labels):
+ aligned_labels[start:end] = [lab] * (end - start)
- for tpoint in time_points:
- # This logic isn't correct if there's a gap in intervals
- if start <= tpoint <= end:
- index = np.argmax(intervals[:, 0] > tpoint) - 1
- aligned_labels.append(labels[index])
- else:
- aligned_labels.append(fill_value)
return aligned_labels
|
mir_eval.util.intervals_to_samples expected behavior
What's the intended behavior for `mir_eval.util.intervals_to_samples`?
In the following example:
```python
import numpy as np
import mir_eval
intervals = np.array(
[[0.2, 0.49],
[0.8, 0.9]]
)
labels = ['a', 'b']
sample_times, sample_labels = mir_eval.util.intervals_to_samples(intervals, labels, offset=0, sample_size=0.1, fill_value=None)
```
I expected something close to:
```python
sample_times = np.array([0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8])
sample_labels = np.array([None, None, 'a', 'a', 'a', None, None, None, 'b'])
```
(i.e. time periods where there is no labeled interval get filled in with `None`)
but instead get:
```python
sample_times = np.array([0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8])
sample_labels = np.array([None, None, 'a', 'a', 'a', 'a', 'a', 'a', 'b'])
```
Am I missing something?
|
craffel/mir_eval
|
diff --git a/tests/test_util.py b/tests/test_util.py
index b4103d8..913e529 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -21,6 +21,27 @@ def test_interpolate_intervals():
expected_ans)
+def test_interpolate_intervals_gap():
+ """Check that an interval set is interpolated properly, with gaps."""
+ labels = list('abc')
+ intervals = np.array([[0.5, 1.0], [1.5, 2.0], [2.5, 3.0]])
+ time_points = [0.0, 0.75, 1.25, 1.75, 2.25, 2.75, 3.5]
+ expected_ans = ['N', 'a', 'N', 'b', 'N', 'c', 'N']
+ assert (util.interpolate_intervals(intervals, labels, time_points, 'N') ==
+ expected_ans)
+
+
[email protected](ValueError)
+def test_interpolate_intervals_badtime():
+ """Check that interpolate_intervals throws an exception if
+ input is unordered.
+ """
+ labels = list('abc')
+ intervals = np.array([(n, n + 1.0) for n in range(len(labels))])
+ time_points = [-1.0, 0.1, 0.9, 0.8, 2.3, 4.0]
+ mir_eval.util.interpolate_intervals(intervals, labels, time_points)
+
+
def test_intervals_to_samples():
"""Check that an interval set is sampled properly, with boundaries
conditions and out-of-range values.
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
0.4
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[display,testing]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"nose",
"nose-cov",
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
contourpy==1.3.0
cov-core==1.15.0
coverage==7.8.0
cycler==0.12.1
exceptiongroup==1.2.2
fonttools==4.56.0
future==1.0.0
importlib_resources==6.5.2
iniconfig==2.1.0
kiwisolver==1.4.7
matplotlib==3.9.4
-e git+https://github.com/craffel/mir_eval.git@6f8ee58f437dd9b8f54b3c9700e7b4dc3879853f#egg=mir_eval
nose==1.3.7
nose-cov==1.6
numpy==2.0.2
packaging==24.2
pillow==11.1.0
pluggy==1.5.0
pyparsing==3.2.3
pytest==8.3.5
python-dateutil==2.9.0.post0
scipy==1.13.1
six==1.17.0
tomli==2.2.1
zipp==3.21.0
|
name: mir_eval
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- contourpy==1.3.0
- cov-core==1.15.0
- coverage==7.8.0
- cycler==0.12.1
- exceptiongroup==1.2.2
- fonttools==4.56.0
- future==1.0.0
- importlib-resources==6.5.2
- iniconfig==2.1.0
- kiwisolver==1.4.7
- matplotlib==3.9.4
- nose==1.3.7
- nose-cov==1.6
- numpy==2.0.2
- packaging==24.2
- pillow==11.1.0
- pluggy==1.5.0
- pyparsing==3.2.3
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- scipy==1.13.1
- six==1.17.0
- tomli==2.2.1
- zipp==3.21.0
prefix: /opt/conda/envs/mir_eval
|
[
"tests/test_util.py::test_interpolate_intervals_gap",
"tests/test_util.py::test_interpolate_intervals_badtime"
] |
[] |
[
"tests/test_util.py::test_interpolate_intervals",
"tests/test_util.py::test_intervals_to_samples",
"tests/test_util.py::test_intersect_files",
"tests/test_util.py::test_merge_labeled_intervals",
"tests/test_util.py::test_boundaries_to_intervals",
"tests/test_util.py::test_adjust_events",
"tests/test_util.py::test_bipartite_match",
"tests/test_util.py::test_outer_distance_mod_n",
"tests/test_util.py::test_outer_distance",
"tests/test_util.py::test_match_events",
"tests/test_util.py::test_validate_intervals",
"tests/test_util.py::test_validate_events",
"tests/test_util.py::test_validate_frequencies"
] |
[] |
MIT License
| 1,188 |
tornadoweb__tornado-2011
|
ecd8968c5135b810cd607b5902dda2cd32122b39
|
2017-04-15 16:56:05
|
ecd8968c5135b810cd607b5902dda2cd32122b39
|
diff --git a/tornado/web.py b/tornado/web.py
index 8ff52e9c..d79889fa 100644
--- a/tornado/web.py
+++ b/tornado/web.py
@@ -993,6 +993,9 @@ class RequestHandler(object):
self._log()
self._finished = True
self.on_finish()
+ self._break_cycles()
+
+ def _break_cycles(self):
# Break up a reference cycle between this handler and the
# _ui_module closures to allow for faster GC on CPython.
self.ui = None
diff --git a/tornado/websocket.py b/tornado/websocket.py
index ce13d262..69437ee4 100644
--- a/tornado/websocket.py
+++ b/tornado/websocket.py
@@ -434,6 +434,16 @@ class WebSocketHandler(tornado.web.RequestHandler):
if not self._on_close_called:
self._on_close_called = True
self.on_close()
+ self._break_cycles()
+
+ def _break_cycles(self):
+ # WebSocketHandlers call finish() early, but we don't want to
+ # break up reference cycles (which makes it impossible to call
+ # self.render_string) until after we've really closed the
+ # connection (if it was established in the first place,
+ # indicated by status code 101).
+ if self.get_status() != 101 or self._on_close_called:
+ super(WebSocketHandler, self)._break_cycles()
def send_error(self, *args, **kwargs):
if self.stream is None:
|
websocket demo exception
tornado/demos/websocket/chatdemo.py
```python
chat["html"] = tornado.escape.to_basestring(
self.render_string("message.html", message=chat))
```
```
[E 170412 12:04:47 websocket:487] Uncaught exception in /chatsocket
Traceback (most recent call last):
File "/Users/crane/Projects/tornado/tornado/websocket.py", line 484, in _run_callback
result = callback(*args, **kwargs)
File "/Users/crane/Projects/tornado/demos/websocket/chatdemo.py", line 92, in on_message
self.render_string("message.html", message=chat))
File "/Users/crane/Projects/tornado/tornado/web.py", line 863, in render_string
namespace = self.get_template_namespace()
File "/Users/crane/Projects/tornado/tornado/web.py", line 887, in get_template_namespace
namespace.update(self.ui)
TypeError: 'NoneType' object is not iterable
```
|
tornadoweb/tornado
|
diff --git a/tornado/test/websocket_test.py b/tornado/test/websocket_test.py
index 7bdca877..d47a74e6 100644
--- a/tornado/test/websocket_test.py
+++ b/tornado/test/websocket_test.py
@@ -8,6 +8,7 @@ from tornado.concurrent import Future
from tornado import gen
from tornado.httpclient import HTTPError, HTTPRequest
from tornado.log import gen_log, app_log
+from tornado.template import DictLoader
from tornado.testing import AsyncHTTPTestCase, gen_test, bind_unused_port, ExpectLog
from tornado.test.util import unittest, skipBefore35, exec_test
from tornado.web import Application, RequestHandler
@@ -130,6 +131,11 @@ class CoroutineOnMessageHandler(TestWebSocketHandler):
self.write_message(message)
+class RenderMessageHandler(TestWebSocketHandler):
+ def on_message(self, message):
+ self.write_message(self.render_string('message.html', message=message))
+
+
class WebSocketBaseTestCase(AsyncHTTPTestCase):
@gen.coroutine
def ws_connect(self, path, **kwargs):
@@ -168,7 +174,15 @@ class WebSocketTest(WebSocketBaseTestCase):
dict(close_future=self.close_future)),
('/coroutine', CoroutineOnMessageHandler,
dict(close_future=self.close_future)),
- ])
+ ('/render', RenderMessageHandler,
+ dict(close_future=self.close_future)),
+ ], template_loader=DictLoader({
+ 'message.html': '<b>{{ message }}</b>',
+ }))
+
+ def tearDown(self):
+ super(WebSocketTest, self).tearDown()
+ RequestHandler._template_loaders.clear()
def test_http_request(self):
# WS server, HTTP client.
@@ -219,6 +233,14 @@ class WebSocketTest(WebSocketBaseTestCase):
self.assertEqual(response, u'hello \u00e9')
yield self.close(ws)
+ @gen_test
+ def test_render_message(self):
+ ws = yield self.ws_connect('/render')
+ ws.write_message('hello')
+ response = yield ws.read_message()
+ self.assertEqual(response, '<b>hello</b>')
+ yield self.close(ws)
+
@gen_test
def test_error_in_on_message(self):
ws = yield self.ws_connect('/error_in_on_message')
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 2
}
|
4.4
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"sphinx",
"sphinx_rtd_theme",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
docutils==0.18.1
idna==3.10
imagesize==1.4.1
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
Jinja2==3.0.3
MarkupSafe==2.0.1
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
Pygments==2.14.0
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytz==2025.2
requests==2.27.1
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
-e git+https://github.com/tornadoweb/tornado.git@ecd8968c5135b810cd607b5902dda2cd32122b39#egg=tornado
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: tornado
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- babel==2.11.0
- charset-normalizer==2.0.12
- docutils==0.18.1
- idna==3.10
- imagesize==1.4.1
- jinja2==3.0.3
- markupsafe==2.0.1
- pygments==2.14.0
- pytz==2025.2
- requests==2.27.1
- snowballstemmer==2.2.0
- sphinx==5.3.0
- sphinx-rtd-theme==2.0.0
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- urllib3==1.26.20
prefix: /opt/conda/envs/tornado
|
[
"tornado/test/websocket_test.py::WebSocketTest::test_render_message"
] |
[] |
[
"tornado/test/websocket_test.py::WebSocketTest::test_async_prepare",
"tornado/test/websocket_test.py::WebSocketTest::test_bad_websocket_version",
"tornado/test/websocket_test.py::WebSocketTest::test_binary_message",
"tornado/test/websocket_test.py::WebSocketTest::test_check_origin_invalid",
"tornado/test/websocket_test.py::WebSocketTest::test_check_origin_invalid_partial_url",
"tornado/test/websocket_test.py::WebSocketTest::test_check_origin_invalid_subdomains",
"tornado/test/websocket_test.py::WebSocketTest::test_check_origin_valid_no_path",
"tornado/test/websocket_test.py::WebSocketTest::test_check_origin_valid_with_path",
"tornado/test/websocket_test.py::WebSocketTest::test_client_close_reason",
"tornado/test/websocket_test.py::WebSocketTest::test_coroutine",
"tornado/test/websocket_test.py::WebSocketTest::test_error_in_on_message",
"tornado/test/websocket_test.py::WebSocketTest::test_http_request",
"tornado/test/websocket_test.py::WebSocketTest::test_path_args",
"tornado/test/websocket_test.py::WebSocketTest::test_server_close_reason",
"tornado/test/websocket_test.py::WebSocketTest::test_unicode_message",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_callbacks",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_close_buffered_data",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_gen",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_header_echo",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_headers",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_http_fail",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_http_success",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_network_fail",
"tornado/test/websocket_test.py::WebSocketNativeCoroutineTest::test_native_coroutine",
"tornado/test/websocket_test.py::NoCompressionTest::test_message_sizes",
"tornado/test/websocket_test.py::ServerOnlyCompressionTest::test_message_sizes",
"tornado/test/websocket_test.py::ClientOnlyCompressionTest::test_message_sizes",
"tornado/test/websocket_test.py::DefaultCompressionTest::test_message_sizes",
"tornado/test/websocket_test.py::PythonMaskFunctionTest::test_mask",
"tornado/test/websocket_test.py::CythonMaskFunctionTest::test_mask",
"tornado/test/websocket_test.py::ServerPeriodicPingTest::test_server_ping",
"tornado/test/websocket_test.py::ClientPeriodicPingTest::test_client_ping",
"tornado/test/websocket_test.py::MaxMessageSizeTest::test_large_message"
] |
[] |
Apache License 2.0
| 1,189 |
|
polygraph-python__polygraph-19
|
15e259607a85cddd45f2b0a44115b7d430970a25
|
2017-04-16 13:19:00
|
15e259607a85cddd45f2b0a44115b7d430970a25
|
diff --git a/polygraph/types/basic_type.py b/polygraph/types/basic_type.py
index 3498d26..26e54b8 100644
--- a/polygraph/types/basic_type.py
+++ b/polygraph/types/basic_type.py
@@ -1,3 +1,5 @@
+from functools import wraps
+
from polygraph.exceptions import PolygraphSchemaError, PolygraphValueError
from polygraph.types.definitions import TypeDefinition, TypeKind
from polygraph.utils.trim_docstring import trim_docstring
@@ -7,6 +9,22 @@ def typedef(type_):
return type_.__type
+type_builder_registry = {}
+
+
+def type_builder_cache(method):
+ @wraps(method)
+ def wrapper(cls, *args):
+ unique_args = frozenset(args)
+ if (cls, unique_args) in type_builder_registry:
+ return type_builder_registry[(cls, unique_args)]
+ else:
+ return_val = method(cls, *args)
+ type_builder_registry[(cls, unique_args)] = return_val
+ return return_val
+ return wrapper
+
+
class PolygraphTypeMeta(type):
def __new__(cls, name, bases, namespace):
default_description = trim_docstring(namespace.get("__doc__", ""))
@@ -95,6 +113,7 @@ class Union(PolygraphOutputType, PolygraphType):
GraphQL Object types, but provides for no guaranteed fields between
those types.
"""
+ @type_builder_cache
def __new__(cls, *types):
types = set(types)
assert len(types) >= 2, "Unions must consist of more than 1 type"
@@ -135,6 +154,7 @@ class List(PolygraphType):
each item in the list is serialized as per the item type.
"""
+ @type_builder_cache
def __new__(cls, type_):
type_name = typedef(type_).name
@@ -160,6 +180,7 @@ class NonNull(PolygraphType):
"""
Represents a type for which null is not a valid result.
"""
+ @type_builder_cache
def __new__(cls, type_):
type_name = typedef(type_).name
|
Implement GraphQL type cache for GraphQL meta-types
|
polygraph-python/polygraph
|
diff --git a/polygraph/types/tests/test_union.py b/polygraph/types/tests/test_union.py
index 0c60c7d..07abe3d 100644
--- a/polygraph/types/tests/test_union.py
+++ b/polygraph/types/tests/test_union.py
@@ -5,11 +5,13 @@ from polygraph.types.basic_type import Union
from polygraph.types.scalar import Float, Int, String
-@skip # FIXME
+# @skip # FIXME
class UnionTypeTest(TestCase):
def test_commutativity(self):
self.assertEqual(Union(String, Int), Union(Int, String))
+ self.assertEqual(Union(String, Int, Float), Union(Float, String, Int, String))
+ @skip
def test_associativity(self):
self.assertEqual(
Union(Union(String, Int), Float),
@@ -22,6 +24,7 @@ class UnionTypeTest(TestCase):
Union(String, Int),
)
+ @skip
def test_pipe_operator_with_more_than_two_types(self):
self.assertEqual(
String | Int | Float,
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 3,
"test_score": 3
},
"num_modified_files": 1
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
args==0.1.0
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
autopep8==2.0.4
backcall==0.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
clint==0.5.1
decorator==5.1.1
flake8==2.5.5
graphql-core==3.2.6
idna==3.10
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
ipython==7.16.3
ipython-genutils==0.2.0
isort==5.10.1
jedi==0.17.2
mccabe==0.4.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
parso==0.7.1
pep8==1.7.1
pexpect==4.9.0
pickleshare==0.7.5
pkginfo==1.10.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
-e git+https://github.com/polygraph-python/polygraph.git@15e259607a85cddd45f2b0a44115b7d430970a25#egg=polygraph
prompt-toolkit==3.0.36
ptyprocess==0.7.0
pudb==2017.1.2
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pycodestyle==2.10.0
pyflakes==1.0.0
Pygments==2.14.0
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
requests==2.27.1
requests-toolbelt==1.0.0
six==1.17.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tomli==1.2.3
traitlets==4.3.3
twine==1.8.1
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
urwid==2.1.2
wcwidth==0.2.13
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: polygraph
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- args==0.1.0
- autopep8==2.0.4
- backcall==0.2.0
- charset-normalizer==2.0.12
- clint==0.5.1
- decorator==5.1.1
- flake8==2.5.5
- graphql-core==3.2.6
- idna==3.10
- ipython==7.16.3
- ipython-genutils==0.2.0
- isort==5.10.1
- jedi==0.17.2
- mccabe==0.4.0
- parso==0.7.1
- pep8==1.7.1
- pexpect==4.9.0
- pickleshare==0.7.5
- pkginfo==1.10.0
- prompt-toolkit==3.0.36
- ptyprocess==0.7.0
- pudb==2017.1.2
- pycodestyle==2.10.0
- pyflakes==1.0.0
- pygments==2.14.0
- requests==2.27.1
- requests-toolbelt==1.0.0
- six==1.17.0
- tomli==1.2.3
- traitlets==4.3.3
- twine==1.8.1
- urllib3==1.26.20
- urwid==2.1.2
- wcwidth==0.2.13
prefix: /opt/conda/envs/polygraph
|
[
"polygraph/types/tests/test_union.py::UnionTypeTest::test_commutativity",
"polygraph/types/tests/test_union.py::UnionTypeTest::test_pipe_operator"
] |
[] |
[
"polygraph/types/tests/test_union.py::UnionTypeTest::test_associativity",
"polygraph/types/tests/test_union.py::UnionTypeTest::test_pipe_operator_with_more_than_two_types",
"polygraph/types/tests/test_union.py::UnionValueTest::test_valid_type",
"polygraph/types/tests/test_union.py::UnionValueTest::test_value_must_be_typed",
"polygraph/types/tests/test_union.py::UnionValueTest::test_value_must_have_right_type"
] |
[] |
MIT License
| 1,191 |
|
jboss-dockerfiles__dogen-107
|
d4c4c877a818a3ce382b7a2b7ea2d765f3568f72
|
2017-04-18 13:57:15
|
bc9263c5b683fdf901ac1646286ee3908b85dcdc
|
diff --git a/dogen/generator.py b/dogen/generator.py
index 6d0793b..98ec763 100644
--- a/dogen/generator.py
+++ b/dogen/generator.py
@@ -292,7 +292,8 @@ class Generator(object):
passed = False
try:
if os.path.exists(filename):
- self.check_sum(filename, source['md5sum'])
+ if source.get('md5sum'):
+ self.check_sum(filename, source['md5sum'])
passed = True
except Exception as e:
self.log.warn(str(e))
@@ -307,9 +308,11 @@ class Generator(object):
self._fetch_file(url, filename)
- self.check_sum(filename, source['md5sum'])
-
- self.cfg['artifacts'][target] = "md5:%s" % source['md5sum']
+ if source.get('md5sum'):
+ self.check_sum(filename, source['md5sum'])
+ self.cfg['artifacts'][target] = "md5:%s" % source['md5sum']
+ else:
+ self.cfg['artifacts'][target] = None
def check_sum(self, filename, checksum):
self.log.info("Checking '%s' MD5 hash..." % os.path.basename(filename))
|
Do not require md5sum for artifacts
The EnMasse community images need to be built using the 'latest' artifacts. To import these using sources, we need the latest md5sum. The md5sum might change after every build. Can we have an option to skip the md5sum, or have it pull & recalculate it?
|
jboss-dockerfiles/dogen
|
diff --git a/tests/test_package.py b/tests/test_package.py
index b742e65..3b961bc 100644
--- a/tests/test_package.py
+++ b/tests/test_package.py
@@ -5,7 +5,6 @@ import tempfile
import unittest
import shutil
import re
-import sys
from dogen.plugins.repo import Repo
from dogen.generator import Generator
@@ -45,6 +44,5 @@ class TestPackage(unittest.TestCase):
dockerfile = open(os.path.join(self.target_dir, "Dockerfile")).read()
- sys.stderr.write("\t\t\tDEBUGDEBUG\n{}\n".format(dockerfile))
self.assertTrue(re.match(r'.*yum install[^\n]+wget', dockerfile, re.DOTALL))
self.assertTrue(re.match(r'.*rpm -q +wget', dockerfile, re.DOTALL))
diff --git a/tests/test_unit_generate_configuration.py b/tests/test_unit_generate_configuration.py
index 9c01463..e439971 100644
--- a/tests/test_unit_generate_configuration.py
+++ b/tests/test_unit_generate_configuration.py
@@ -261,6 +261,17 @@ class TestConfig(unittest.TestCase):
generator._handle_scripts()
# success if no stack trace thrown
+ @mock.patch('dogen.generator.Generator._fetch_file')
+ def test_handling_sources_without_specified_md5sum(self, mock_fetch_file):
+ with self.descriptor as f:
+ f.write("sources:\n - url: http://somehost.com/file.zip".encode())
+
+ generator = Generator(self.log, self.args)
+ generator.configure()
+ generator.handle_sources()
+
+ mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/file.zip')
+
@mock.patch('dogen.generator.Generator.check_sum')
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources(self, mock_fetch_file, mock_check_sum):
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 1
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
docopt==0.6.2
-e git+https://github.com/jboss-dockerfiles/dogen.git@d4c4c877a818a3ce382b7a2b7ea2d765f3568f72#egg=dogen
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==3.0.3
MarkupSafe==2.0.1
mock==5.2.0
packaging==21.3
pluggy==1.0.0
py==1.11.0
pykwalify==1.8.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
python-dateutil==2.9.0.post0
PyYAML==6.0.1
requests==2.27.1
ruamel.yaml==0.18.3
ruamel.yaml.clib==0.2.8
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0
|
name: dogen
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- charset-normalizer==2.0.12
- coverage==6.2
- docopt==0.6.2
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- jinja2==3.0.3
- markupsafe==2.0.1
- mock==5.2.0
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pykwalify==1.8.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- python-dateutil==2.9.0.post0
- pyyaml==6.0.1
- requests==2.27.1
- ruamel-yaml==0.18.3
- ruamel-yaml-clib==0.2.8
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- zipp==3.6.0
prefix: /opt/conda/envs/dogen
|
[
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_without_specified_md5sum"
] |
[] |
[
"tests/test_package.py::TestPackage::test_custom_repo_files_should_add_two",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_additional_scripts_in_cli_should_override_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_additional_scripts_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_exec",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_exec_not_env",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_user_not_default",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_user_not_env",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_scripts_dir_in_cli_should_override_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_scripts_dir_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_template_in_cli_should_override_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_template_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_default_script_exec",
"tests/test_unit_generate_configuration.py::TestConfig::test_default_script_user",
"tests/test_unit_generate_configuration.py::TestConfig::test_default_values",
"tests/test_unit_generate_configuration.py::TestConfig::test_do_not_skip_ssl_verification_in_cli_false_should_override_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_do_not_skip_ssl_verification_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_env_provided_script_user",
"tests/test_unit_generate_configuration.py::TestConfig::test_env_supplied_script_exec",
"tests/test_unit_generate_configuration.py::TestConfig::test_fail_if_version_mismatch",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_when_local_file_exists_and_is_broken",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_when_local_file_exists_and_is_correct",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_cache_url",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_cache_url_and_target_filename",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_target_filename",
"tests/test_unit_generate_configuration.py::TestConfig::test_no_scripts_defined",
"tests/test_unit_generate_configuration.py::TestConfig::test_scripts_dir_found_by_convention",
"tests/test_unit_generate_configuration.py::TestConfig::test_skip_ssl_verification_in_descriptor"
] |
[] |
MIT License
| 1,197 |
|
jboss-dockerfiles__dogen-110
|
bb52f327cd889a0af7b046762a3856a9e6aecca9
|
2017-04-18 14:53:35
|
bc9263c5b683fdf901ac1646286ee3908b85dcdc
|
diff --git a/docs/environment_variables.adoc b/docs/environment_variables.adoc
deleted file mode 100644
index 6186d98..0000000
--- a/docs/environment_variables.adoc
+++ /dev/null
@@ -1,32 +0,0 @@
-# Environment variables
-
-In Dogen you can use a few environment variables that can infulence how Dogen behaves.
-
-## `DOGEN_SOURCES_CACHE`
-
-Default value: not set
-
-Specifies a different location that could be used to fetch artifacts. Usually this is a
-URL to some cache service. You can use following substitutions:
-
-* `\#filename#` -- the file name from the `url` of the artifact
-* `\#algorithm#` -- has algorithm specified for the selected artifact
-* `\#hash#` -- value of the digest.
-
-### Example
-
-Consider this sources section:
-
-```
-sources:
- - url: http://some.host.com/7.0.0/jboss-eap-7.0.0.zip
- md5: cd02482daa0398bf5500e1628d28179a
-```
-
-When you set `DOGEN_SOURCES_CACHE` to `http://cache.host.com/fetch?\#algorithm#=\#hash#` then
-the JBoss EAP artifact will be fetched from: `http://cache.host.com/fetch?md5=cd02482daa0398bf5500e1628d28179a`.
-
-If `DOGEN_SOURCES_CACHE` would be set to `http://cache.host.com/cache/\#filename#` then
-the JBoss EAP artifact will be fetched from: `http://cache.host.com/cache/jboss-eap-7.0.0.zip`.
-
-In all cases digest will be computed from the downloaded file and compared with the expected value.
diff --git a/docs/index.adoc b/docs/index.adoc
index 6d9617d..70a0f13 100644
--- a/docs/index.adoc
+++ b/docs/index.adoc
@@ -6,6 +6,5 @@ This document covers usage instructions and examples.
* link:descriptor.adoc[Descriptor file explained]
* link:conventions.adoc[Conventions]
-* link:environment_variables.adoc[Environment variables]
diff --git a/dogen/generator.py b/dogen/generator.py
index 98ec763..0b5d94a 100644
--- a/dogen/generator.py
+++ b/dogen/generator.py
@@ -16,6 +16,8 @@ from dogen.tools import Tools
from dogen import version, DEFAULT_SCRIPT_EXEC, DEFAULT_SCRIPT_USER
from dogen.errors import Error
+SUPPORTED_HASH_ALGORITHMS = ['sha256', 'sha1', 'md5']
+
class Generator(object):
def __init__(self, log, args, plugins=[]):
self.log = log
@@ -289,11 +291,29 @@ class Generator(object):
target = basename
filename = ("%s/%s" % (self.output, target))
+
passed = False
+ algorithms = []
+
+ md5sum = source.get('md5sum')
+
+ if md5sum:
+ self.log.warn("The 'md5sum' key is deprecated, please use 'md5' for %s. Or better switch to sha256 or sha1." % url)
+
+ # Backwards compatibility for md5sum
+ if not source.get('md5'):
+ source['md5'] = md5sum
+
+ for supported_algorithm in SUPPORTED_HASH_ALGORITHMS:
+ if not source.get(supported_algorithm):
+ continue
+
+ algorithms.append(supported_algorithm)
+
try:
- if os.path.exists(filename):
- if source.get('md5sum'):
- self.check_sum(filename, source['md5sum'])
+ if os.path.exists(filename) and algorithms:
+ for algorithm in algorithms:
+ self.check_sum(filename, source[algorithm], algorithm)
passed = True
except Exception as e:
self.log.warn(str(e))
@@ -303,20 +323,36 @@ class Generator(object):
sources_cache = os.environ.get("DOGEN_SOURCES_CACHE")
if sources_cache:
- url = sources_cache.replace('#hash#', source['md5sum']).replace('#algorithm#', 'md5')
+ url = sources_cache.replace('#filename#', basename)
+
+ if algorithms:
+ if len(algorithms) > 1:
+ self.log.warn("You specified multiple algorithms for '%s' url, but only '%s' will be used to fetch it from cache" % (url, algorithms[0]))
+
+ url = url.replace('#hash#', source[algorithms[0]]).replace('#algorithm#', algorithms[0])
+
self.log.info("Using '%s' as cached location for artifact" % url)
self._fetch_file(url, filename)
- if source.get('md5sum'):
- self.check_sum(filename, source['md5sum'])
- self.cfg['artifacts'][target] = "md5:%s" % source['md5sum']
+ if algorithms:
+ for algorithm in algorithms:
+ self.check_sum(filename, source[algorithm], algorithm)
+ self.cfg['artifacts'][target] = "%s:%s" % (algorithms[0], source[algorithms[0]])
else:
self.cfg['artifacts'][target] = None
- def check_sum(self, filename, checksum):
- self.log.info("Checking '%s' MD5 hash..." % os.path.basename(filename))
- filesum = hashlib.md5(open(filename, 'rb').read()).hexdigest()
+ def check_sum(self, filename, checksum, algorithm):
+ self.log.info("Checking '%s' %s hash..." % (os.path.basename(filename), algorithm))
+
+ hash = getattr(hashlib, algorithm)()
+
+ with open(filename, "rb") as f:
+ for chunk in iter(lambda: f.read(65536), b""):
+ hash.update(chunk)
+ filesum = hash.hexdigest()
+
if filesum.lower() != checksum.lower():
- raise Exception("The md5sum computed for the '%s' file ('%s') doesn't match the '%s' value" % (filename, filesum, checksum))
+ raise Exception("The %s computed for the '%s' file ('%s') doesn't match the '%s' value" % (algorithm, filename, filesum, checksum))
+
self.log.debug("MD5 hash is correct.")
diff --git a/dogen/schema/kwalify_schema.yaml b/dogen/schema/kwalify_schema.yaml
index 040cd19..8f053f7 100644
--- a/dogen/schema/kwalify_schema.yaml
+++ b/dogen/schema/kwalify_schema.yaml
@@ -67,6 +67,9 @@ map:
- map:
url: {type: str}
md5sum: {type: str}
+ md5: {type: str}
+ sha1: {type: str}
+ sha256: {type: str}
target: {type: str}
packages:
seq:
|
Add support for multiple hash algorithms in artifacts
Currently we support only md5, but we should also support sha1 and sha256.
|
jboss-dockerfiles/dogen
|
diff --git a/tests/schemas/good/openshift_amq_6.2_image.yaml b/tests/schemas/good/openshift_amq_6.2_image.yaml
index b7aff9b..fa4f3cf 100644
--- a/tests/schemas/good/openshift_amq_6.2_image.yaml
+++ b/tests/schemas/good/openshift_amq_6.2_image.yaml
@@ -52,9 +52,9 @@ scripts:
exec: install.sh
sources:
- url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
- md5sum: 1b996b9083f537917b307309b0e2f16d
+ md5: 1b996b9083f537917b307309b0e2f16d
- url: http://redacted/openshift-activemq-plugin-1.0.0.Final-redhat-1.jar
- md5sum: 325fbbaff0f7dbea42203346d9c3bf98
+ md5: 325fbbaff0f7dbea42203346d9c3bf98
- url: http://redacted/jboss-dmr-1.2.2.Final-redhat-1.jar
- md5sum: 8df4cbf6f39c3bce21de16ad708084d5
+ md5: 8df4cbf6f39c3bce21de16ad708084d5
diff --git a/tests/schemas/good/openshift_datagrid_6.5_image.yaml b/tests/schemas/good/openshift_datagrid_6.5_image.yaml
index 22ce48a..b20b77e 100644
--- a/tests/schemas/good/openshift_datagrid_6.5_image.yaml
+++ b/tests/schemas/good/openshift_datagrid_6.5_image.yaml
@@ -151,16 +151,16 @@ scripts:
user: 185
sources:
- url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
- md5sum: 1b996b9083f537917b307309b0e2f16d
+ md5: 1b996b9083f537917b307309b0e2f16d
- url: http://redacted/javax.json-1.0.4.jar
- md5sum: 569870f975deeeb6691fcb9bc02a9555
+ md5: 569870f975deeeb6691fcb9bc02a9555
- url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
- md5sum: 7c743e35463db5f55f415dd666d705c5
+ md5: 7c743e35463db5f55f415dd666d705c5
- url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
- md5sum: bafa4db7efe4082d76cde2fa9499bf84
+ md5: bafa4db7efe4082d76cde2fa9499bf84
- url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
- md5sum: 71bbfdf795a2c65e4473df242f765490
+ md5: 71bbfdf795a2c65e4473df242f765490
- url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
- md5sum: 145add030a89c3ed588dce27b0f24999
+ md5: 145add030a89c3ed588dce27b0f24999
- url: http://redacted/oauth-20100527.jar
- md5sum: 91c7c70579f95b7ddee95b2143a49b41
+ md5: 91c7c70579f95b7ddee95b2143a49b41
diff --git a/tests/schemas/good/openshift_eap_6.4_image.yaml b/tests/schemas/good/openshift_eap_6.4_image.yaml
index 083329d..2b24f39 100644
--- a/tests/schemas/good/openshift_eap_6.4_image.yaml
+++ b/tests/schemas/good/openshift_eap_6.4_image.yaml
@@ -98,22 +98,22 @@ scripts:
user: 185
sources:
- url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
- md5sum: 1b996b9083f537917b307309b0e2f16d
+ md5: 1b996b9083f537917b307309b0e2f16d
- url: http://redacted/javax.json-1.0.4.jar
- md5sum: 569870f975deeeb6691fcb9bc02a9555
+ md5: 569870f975deeeb6691fcb9bc02a9555
- url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
- md5sum: 7c743e35463db5f55f415dd666d705c5
+ md5: 7c743e35463db5f55f415dd666d705c5
- url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
- md5sum: bafa4db7efe4082d76cde2fa9499bf84
+ md5: bafa4db7efe4082d76cde2fa9499bf84
- url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
- md5sum: 71bbfdf795a2c65e4473df242f765490
+ md5: 71bbfdf795a2c65e4473df242f765490
- url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
- md5sum: 145add030a89c3ed588dce27b0f24999
+ md5: 145add030a89c3ed588dce27b0f24999
- url: http://redacted/oauth-20100527.jar
- md5sum: 91c7c70579f95b7ddee95b2143a49b41
+ md5: 91c7c70579f95b7ddee95b2143a49b41
- url: http://redacted/activemq-rar-5.11.0.redhat-621084.rar
- md5sum: 207e17ac8102c93233fe2764d1fe8499
+ md5: 207e17ac8102c93233fe2764d1fe8499
- url: http://redacted/rh-sso-7.0.0-eap6-adapter.zip
- md5sum: 6fd81306ea4297307dcc5f51712e5f95
+ md5: 6fd81306ea4297307dcc5f51712e5f95
- url: http://redacted/rh-sso-7.0.0-saml-eap6-adapter.zip
- md5sum: 3b953c114dd09f86e71e18cd57d8af56
+ md5: 3b953c114dd09f86e71e18cd57d8af56
diff --git a/tests/schemas/good/openshift_eap_7.0_image.yaml b/tests/schemas/good/openshift_eap_7.0_image.yaml
index 72df73d..08f5a5c 100644
--- a/tests/schemas/good/openshift_eap_7.0_image.yaml
+++ b/tests/schemas/good/openshift_eap_7.0_image.yaml
@@ -107,22 +107,22 @@ scripts:
user: 185
sources:
- url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
- md5sum: 1b996b9083f537917b307309b0e2f16d
+ md5: 1b996b9083f537917b307309b0e2f16d
- url: http://redacted/javax.json-1.0.4.jar
- md5sum: 569870f975deeeb6691fcb9bc02a9555
+ md5: 569870f975deeeb6691fcb9bc02a9555
- url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
- md5sum: 7c743e35463db5f55f415dd666d705c5
+ md5: 7c743e35463db5f55f415dd666d705c5
- url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
- md5sum: bafa4db7efe4082d76cde2fa9499bf84
+ md5: bafa4db7efe4082d76cde2fa9499bf84
- url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
- md5sum: 71bbfdf795a2c65e4473df242f765490
+ md5: 71bbfdf795a2c65e4473df242f765490
- url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
- md5sum: 145add030a89c3ed588dce27b0f24999
+ md5: 145add030a89c3ed588dce27b0f24999
- url: http://redacted/oauth-20100527.jar
- md5sum: 91c7c70579f95b7ddee95b2143a49b41
+ md5: 91c7c70579f95b7ddee95b2143a49b41
- url: http://redacted/activemq-rar-5.11.0.redhat-621084.rar
- md5sum: 207e17ac8102c93233fe2764d1fe8499
+ md5: 207e17ac8102c93233fe2764d1fe8499
- url: http://redacted/rh-sso-7.0.0-eap7-adapter.zip
- md5sum: 1542c1014d9ebc24522839a5fa8bee4d
+ md5: 1542c1014d9ebc24522839a5fa8bee4d
- url: http://redacted/rh-sso-7.0.0-saml-eap7-adapter.zip
- md5sum: ce858a47c707b362a968ffd5c66768dd
+ md5: ce858a47c707b362a968ffd5c66768dd
diff --git a/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml b/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml
index abc1746..953fa45 100644
--- a/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml
+++ b/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml
@@ -101,22 +101,22 @@ scripts:
exec: configure.sh
sources:
- url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
- md5sum: 1b996b9083f537917b307309b0e2f16d
+ md5: 1b996b9083f537917b307309b0e2f16d
- url: http://redacted/javax.json-1.0.4.jar
- md5sum: 569870f975deeeb6691fcb9bc02a9555
+ md5: 569870f975deeeb6691fcb9bc02a9555
- url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
- md5sum: 7c743e35463db5f55f415dd666d705c5
+ md5: 7c743e35463db5f55f415dd666d705c5
- url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
- md5sum: bafa4db7efe4082d76cde2fa9499bf84
+ md5: bafa4db7efe4082d76cde2fa9499bf84
- url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
- md5sum: 71bbfdf795a2c65e4473df242f765490
+ md5: 71bbfdf795a2c65e4473df242f765490
- url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
- md5sum: 145add030a89c3ed588dce27b0f24999
+ md5: 145add030a89c3ed588dce27b0f24999
- url: http://redacted/oauth-20100527.jar
- md5sum: 91c7c70579f95b7ddee95b2143a49b41
+ md5: 91c7c70579f95b7ddee95b2143a49b41
- url: http://redacted/activemq-rar-5.11.0.redhat-621084.rar
- md5sum: 207e17ac8102c93233fe2764d1fe8499
+ md5: 207e17ac8102c93233fe2764d1fe8499
- url: http://redacted/rh-sso-7.0.0-eap6-adapter.zip
- md5sum: 6fd81306ea4297307dcc5f51712e5f95
+ md5: 6fd81306ea4297307dcc5f51712e5f95
- url: http://redacted/rh-sso-7.0.0-saml-eap6-adapter.zip
- md5sum: 3b953c114dd09f86e71e18cd57d8af56
+ md5: 3b953c114dd09f86e71e18cd57d8af56
diff --git a/tests/schemas/good/openshift_kieserver_6.2_image.yaml b/tests/schemas/good/openshift_kieserver_6.2_image.yaml
index 5611e2c..3a1bd93 100644
--- a/tests/schemas/good/openshift_kieserver_6.2_image.yaml
+++ b/tests/schemas/good/openshift_kieserver_6.2_image.yaml
@@ -130,11 +130,11 @@ scripts:
exec: configure.sh
sources:
- url: http://redacted/jboss-bpmsuite-6.2.1.GA-redhat-2-deployable-eap6.x.zip
- md5sum: b63c7dfe82a44a140cce3a824c8c2e90
+ md5: b63c7dfe82a44a140cce3a824c8c2e90
- url: http://redacted/openshift-kieserver-common-1.0.2.Final-redhat-1.jar
- md5sum: 5858103206d0bcc4695aad38a7430c75
+ md5: 5858103206d0bcc4695aad38a7430c75
- url: http://redacted/openshift-kieserver-jms-1.0.2.Final-redhat-1.jar
- md5sum: 4a80b12399c49a1d274bbd1c62b49b65
+ md5: 4a80b12399c49a1d274bbd1c62b49b65
- url: http://redacted/openshift-kieserver-web-1.0.2.Final-redhat-1.jar
- md5sum: adf602d027020b30cc5743d3d5d8e2f7
+ md5: adf602d027020b30cc5743d3d5d8e2f7
diff --git a/tests/schemas/good/openshift_kieserver_6.3_image.yaml b/tests/schemas/good/openshift_kieserver_6.3_image.yaml
index 607ad96..caf4912 100644
--- a/tests/schemas/good/openshift_kieserver_6.3_image.yaml
+++ b/tests/schemas/good/openshift_kieserver_6.3_image.yaml
@@ -131,12 +131,12 @@ scripts:
exec: configure.sh
sources:
- url: http://redacted/jboss-bpmsuite-6.3.0.GA-deployable-eap6.x.zip
- md5sum: 4e283717b0f295adf7025971065d6db8
+ md5: 4e283717b0f295adf7025971065d6db8
- url: http://redacted/jboss-bpmsuite-6.3.0.GA-supplementary-tools.zip
- md5sum: b3d135e2d297f1e89d9ff8357c1e9aac
+ md5: b3d135e2d297f1e89d9ff8357c1e9aac
- url: http://redacted/openshift-kieserver-common-1.0.2.Final-redhat-1.jar
- md5sum: 5858103206d0bcc4695aad38a7430c75
+ md5: 5858103206d0bcc4695aad38a7430c75
- url: http://redacted/openshift-kieserver-jms-1.0.2.Final-redhat-1.jar
- md5sum: 4a80b12399c49a1d274bbd1c62b49b65
+ md5: 4a80b12399c49a1d274bbd1c62b49b65
- url: http://redacted/openshift-kieserver-web-1.0.2.Final-redhat-1.jar
- md5sum: adf602d027020b30cc5743d3d5d8e2f7
+ md5: adf602d027020b30cc5743d3d5d8e2f7
diff --git a/tests/schemas/good/openshift_sso_7.0_image.yaml b/tests/schemas/good/openshift_sso_7.0_image.yaml
index 9487fa4..76cee4f 100644
--- a/tests/schemas/good/openshift_sso_7.0_image.yaml
+++ b/tests/schemas/good/openshift_sso_7.0_image.yaml
@@ -97,17 +97,17 @@ scripts:
exec: configure.sh
sources:
- url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
- md5sum: 1b996b9083f537917b307309b0e2f16d
+ md5: 1b996b9083f537917b307309b0e2f16d
- url: http://redacted/javax.json-1.0.4.jar
- md5sum: 569870f975deeeb6691fcb9bc02a9555
+ md5: 569870f975deeeb6691fcb9bc02a9555
- url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
- md5sum: 7c743e35463db5f55f415dd666d705c5
+ md5: 7c743e35463db5f55f415dd666d705c5
- url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
- md5sum: bafa4db7efe4082d76cde2fa9499bf84
+ md5: bafa4db7efe4082d76cde2fa9499bf84
- url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
- md5sum: 71bbfdf795a2c65e4473df242f765490
+ md5: 71bbfdf795a2c65e4473df242f765490
- url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
- md5sum: 145add030a89c3ed588dce27b0f24999
+ md5: 145add030a89c3ed588dce27b0f24999
- url: http://redacted/oauth-20100527.jar
- md5sum: 91c7c70579f95b7ddee95b2143a49b41
+ md5: 91c7c70579f95b7ddee95b2143a49b41
diff --git a/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml b/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml
index bc8c921..4c4d54e 100644
--- a/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml
+++ b/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml
@@ -94,10 +94,10 @@ scripts:
exec: configure.sh
sources:
- url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
- md5sum: 1b996b9083f537917b307309b0e2f16d
+ md5: 1b996b9083f537917b307309b0e2f16d
- url: http://redacted/json-smart-1.1.1.jar
- md5sum: c382c9109020d001b96329c2057ba933
+ md5: c382c9109020d001b96329c2057ba933
- url: http://redacted/commons-lang-2.6.0.redhat-4.jar
- md5sum: 0da0fbfb0ff2160df3a4832d28003361
+ md5: 0da0fbfb0ff2160df3a4832d28003361
- url: http://redacted/jsonevent-layout-1.7-redhat-1.jar
- md5sum: 08f9aa037ac91c4aaa0d5dabf143a60e
+ md5: 08f9aa037ac91c4aaa0d5dabf143a60e
diff --git a/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml b/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml
index 11afdfb..6a0b095 100644
--- a/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml
+++ b/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml
@@ -94,10 +94,10 @@ scripts:
exec: configure.sh
sources:
- url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
- md5sum: 1b996b9083f537917b307309b0e2f16d
+ md5: 1b996b9083f537917b307309b0e2f16d
- url: http://redacted/json-smart-1.1.1.jar
- md5sum: c382c9109020d001b96329c2057ba933
+ md5: c382c9109020d001b96329c2057ba933
- url: http://redacted/commons-lang-2.6.0.redhat-4.jar
- md5sum: 0da0fbfb0ff2160df3a4832d28003361
+ md5: 0da0fbfb0ff2160df3a4832d28003361
- url: http://redacted/jsonevent-layout-1.7-redhat-1.jar
- md5sum: 08f9aa037ac91c4aaa0d5dabf143a60e
+ md5: 08f9aa037ac91c4aaa0d5dabf143a60e
diff --git a/tests/test_unit_generate_configuration.py b/tests/test_unit_generate_configuration.py
index e439971..4572a7d 100644
--- a/tests/test_unit_generate_configuration.py
+++ b/tests/test_unit_generate_configuration.py
@@ -275,6 +275,50 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator.check_sum')
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources(self, mock_fetch_file, mock_check_sum):
+ with self.descriptor as f:
+ f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode())
+
+ generator = Generator(self.log, self.args)
+ generator.configure()
+ generator.handle_sources()
+
+ mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/file.zip')
+ mock_check_sum.assert_called_with('target/file.zip', 'e9013fc202c87be48e3b302df10efc4b', 'md5')
+
+ @mock.patch('dogen.generator.Generator.check_sum')
+ @mock.patch('dogen.generator.Generator._fetch_file')
+ def test_handling_sources_with_multiple_hashes(self, mock_fetch_file, mock_check_sum):
+ with self.descriptor as f:
+ f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode())
+
+ generator = Generator(self.log, self.args)
+ generator.configure()
+ generator.handle_sources()
+
+ mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/file.zip')
+ calls = [mock.call('target/file.zip', '105bfe02a86ba69be5506cd559a54c4b252fb132', 'sha1'), mock.call('target/file.zip', 'e9013fc202c87be48e3b302df10efc4b', 'md5')]
+ mock_check_sum.assert_has_calls(calls)
+
+ @mock.patch('dogen.generator.Generator.check_sum')
+ @mock.patch('dogen.generator.Generator._fetch_file')
+ def test_handling_sources_with_multiple_hashes_and_cache_url(self, mock_fetch_file, mock_check_sum):
+ with self.descriptor as f:
+ f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode())
+
+ k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/get?#algorithm#=#hash#'})
+ k.start()
+ generator = Generator(self.log, self.args)
+ generator.configure()
+ generator.handle_sources()
+ k.stop()
+
+ mock_fetch_file.assert_called_with('http://cache/get?sha1=105bfe02a86ba69be5506cd559a54c4b252fb132', 'target/file.zip')
+ calls = [mock.call('target/file.zip', '105bfe02a86ba69be5506cd559a54c4b252fb132', 'sha1'), mock.call('target/file.zip', 'e9013fc202c87be48e3b302df10efc4b', 'md5')]
+ mock_check_sum.assert_has_calls(calls)
+
+ @mock.patch('dogen.generator.Generator.check_sum')
+ @mock.patch('dogen.generator.Generator._fetch_file')
+ def test_handling_sources_with_deprecated_md5sum(self, mock_fetch_file, mock_check_sum):
with self.descriptor as f:
f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b".encode())
@@ -283,13 +327,40 @@ class TestConfig(unittest.TestCase):
generator.handle_sources()
mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/file.zip')
+ mock_check_sum.assert_called_with('target/file.zip', 'e9013fc202c87be48e3b302df10efc4b', 'md5')
+
+ @mock.patch('dogen.generator.Generator.check_sum')
+ @mock.patch('dogen.generator.Generator._fetch_file')
+ def test_handling_sources_with_sha1(self, mock_fetch_file, mock_check_sum):
+ with self.descriptor as f:
+ f.write("sources:\n - url: http://somehost.com/file.zip\n sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode())
+
+ generator = Generator(self.log, self.args)
+ generator.configure()
+ generator.handle_sources()
+
+ mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/file.zip')
+ mock_check_sum.assert_called_with('target/file.zip', '105bfe02a86ba69be5506cd559a54c4b252fb132', 'sha1')
+
+ @mock.patch('dogen.generator.Generator.check_sum')
+ @mock.patch('dogen.generator.Generator._fetch_file')
+ def test_handling_sources_with_sha256(self, mock_fetch_file, mock_check_sum):
+ with self.descriptor as f:
+ f.write("sources:\n - url: http://somehost.com/file.zip\n sha256: 9912afca5a08e9e05174c5fbb7a9a1510283d5952f90796c6a3e8bc78217e2fb".encode())
+
+ generator = Generator(self.log, self.args)
+ generator.configure()
+ generator.handle_sources()
+
+ mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/file.zip')
+ mock_check_sum.assert_called_with('target/file.zip', '9912afca5a08e9e05174c5fbb7a9a1510283d5952f90796c6a3e8bc78217e2fb', 'sha256')
@mock.patch('dogen.generator.os.path.exists', return_value=True)
@mock.patch('dogen.generator.Generator.check_sum')
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_when_local_file_exists_and_is_correct(self, mock_fetch_file, mock_check_sum, mock_path):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b".encode())
+ f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode())
generator = Generator(self.log, self.args)
generator.configure()
@@ -302,7 +373,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_when_local_file_exists_and_is_broken(self, mock_fetch_file, mock_check_sum, mock_path):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b".encode())
+ f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode())
generator = Generator(self.log, self.args)
generator.configure()
@@ -314,7 +385,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_with_target_filename(self, mock_fetch_file, mock_check_sum):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode())
+ f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode())
generator = Generator(self.log, self.args)
generator.configure()
@@ -326,7 +397,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_with_cache_url(self, mock_fetch_file, mock_check_sum):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b".encode())
+ f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode())
k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/get?#algorithm#=#hash#'})
k.start()
@@ -341,7 +412,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_with_cache_url_and_target_filename(self, mock_fetch_file, mock_check_sum):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode())
+ f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode())
k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/get?#algorithm#=#hash#'})
k.start()
@@ -351,3 +422,18 @@ class TestConfig(unittest.TestCase):
k.stop()
mock_fetch_file.assert_called_with('http://cache/get?md5=e9013fc202c87be48e3b302df10efc4b', 'target/target.zip')
+
+ @mock.patch('dogen.generator.Generator.check_sum')
+ @mock.patch('dogen.generator.Generator._fetch_file')
+ def test_handling_sources_with_cache_url_with_filename_to_replace(self, mock_fetch_file, mock_check_sum):
+ with self.descriptor as f:
+ f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode())
+
+ k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/#filename#'})
+ k.start()
+ generator = Generator(self.log, self.args)
+ generator.configure()
+ generator.handle_sources()
+ k.stop()
+
+ mock_fetch_file.assert_called_with('http://cache/file.zip', 'target/target.zip')
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_removed_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 3
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"mock",
"pykwalify"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi==2025.1.31
charset-normalizer==3.4.1
coverage==7.8.0
docopt==0.6.2
-e git+https://github.com/jboss-dockerfiles/dogen.git@bb52f327cd889a0af7b046762a3856a9e6aecca9#egg=dogen
exceptiongroup==1.2.2
idna==3.10
iniconfig==2.1.0
Jinja2==3.1.6
MarkupSafe==3.0.2
mock==5.2.0
packaging==24.2
pluggy==1.5.0
pykwalify==1.8.0
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
PyYAML==6.0.2
requests==2.32.3
ruamel.yaml==0.18.10
ruamel.yaml.clib==0.2.12
six==1.17.0
tomli==2.2.1
urllib3==2.3.0
|
name: dogen
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- certifi==2025.1.31
- charset-normalizer==3.4.1
- coverage==7.8.0
- docopt==0.6.2
- exceptiongroup==1.2.2
- idna==3.10
- iniconfig==2.1.0
- jinja2==3.1.6
- markupsafe==3.0.2
- mock==5.2.0
- packaging==24.2
- pluggy==1.5.0
- pykwalify==1.8.0
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pyyaml==6.0.2
- requests==2.32.3
- ruamel-yaml==0.18.10
- ruamel-yaml-clib==0.2.12
- six==1.17.0
- tomli==2.2.1
- urllib3==2.3.0
prefix: /opt/conda/envs/dogen
|
[
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_when_local_file_exists_and_is_broken",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_when_local_file_exists_and_is_correct",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_cache_url",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_cache_url_and_target_filename",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_cache_url_with_filename_to_replace",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_deprecated_md5sum",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_multiple_hashes",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_multiple_hashes_and_cache_url",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_sha1",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_sha256",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_target_filename",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_without_specified_md5sum"
] |
[] |
[
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_additional_scripts_in_cli_should_override_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_additional_scripts_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_exec",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_exec_not_env",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_user_not_default",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_user_not_env",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_scripts_dir_in_cli_should_override_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_scripts_dir_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_template_in_cli_should_override_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_template_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_default_script_exec",
"tests/test_unit_generate_configuration.py::TestConfig::test_default_script_user",
"tests/test_unit_generate_configuration.py::TestConfig::test_default_values",
"tests/test_unit_generate_configuration.py::TestConfig::test_do_not_skip_ssl_verification_in_cli_false_should_override_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_do_not_skip_ssl_verification_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_env_provided_script_user",
"tests/test_unit_generate_configuration.py::TestConfig::test_env_supplied_script_exec",
"tests/test_unit_generate_configuration.py::TestConfig::test_fail_if_version_mismatch",
"tests/test_unit_generate_configuration.py::TestConfig::test_no_scripts_defined",
"tests/test_unit_generate_configuration.py::TestConfig::test_scripts_dir_found_by_convention",
"tests/test_unit_generate_configuration.py::TestConfig::test_skip_ssl_verification_in_descriptor"
] |
[] |
MIT License
| 1,199 |
|
ESSS__conda-devenv-50
|
f58819151109dfc68edbbf4a58cd56853ff1c414
|
2017-04-20 16:39:39
|
7867067acadb89f7da61af330d85caa31b284dd8
|
diff --git a/HISTORY.rst b/HISTORY.rst
index 796bf32..608aaa0 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -3,6 +3,14 @@ History
=======
+0.9.4 (2017-04-20)
+------------------
+
+* Fixed major bug where activate/deactivate scripts were not being generated (`#49`_).
+
+.. _`#49`: https://github.com/ESSS/conda-devenv/issues/49
+
+
0.9.3 (2017-04-10)
------------------
diff --git a/conda_devenv/devenv.py b/conda_devenv/devenv.py
index 66b6bf9..16d174c 100644
--- a/conda_devenv/devenv.py
+++ b/conda_devenv/devenv.py
@@ -269,7 +269,10 @@ def __call_conda_env_update(args, output_filename):
try:
del command[0]
sys.argv = command
- return _call_conda()
+ try:
+ return _call_conda()
+ except SystemExit as e:
+ return e.code
finally:
sys.argv = old_argv
|
0.9.3 broken: no longer generates activate/deactivate scripts
#46 introduced a bug: `conda-devenv` now calls `conda_env.main` directly, which probably calls `sys.exit()`, which skips activate/deactivate scripts generation.
|
ESSS/conda-devenv
|
diff --git a/tests/test_main.py b/tests/test_main.py
index 3fd56e2..4f0db10 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -17,19 +17,20 @@ def patch_conda_calls(mocker):
mocker.patch.object(devenv, 'write_activate_deactivate_scripts', autospec=True)
[email protected]('input_name, expected_output_name', [
- ('environment.devenv.yml', 'environment.yml'),
- ('environment.yml', 'environment.yml'),
[email protected]('input_name, write_scripts_call_count', [
+ ('environment.devenv.yml', 1),
+ ('environment.yml', 0),
])
@pytest.mark.usefixtures('patch_conda_calls')
-def test_handle_input_file(tmpdir, input_name, expected_output_name):
+def test_handle_input_file(tmpdir, input_name, write_scripts_call_count):
"""
Test how conda-devenv handles input files: devenv.yml and pure .yml files.
"""
argv = []
def call_conda_mock():
argv[:] = sys.argv[:]
- return 0
+ # simulate that we actually called conda's main, which calls sys.exit()
+ sys.exit(0)
devenv._call_conda.side_effect = call_conda_mock
@@ -41,8 +42,9 @@ def test_handle_input_file(tmpdir, input_name, expected_output_name):
'''))
assert devenv.main(['--file', str(filename), '--quiet']) == 0
assert devenv._call_conda.call_count == 1
- cmdline = 'env update --file {} --prune --quiet'.format(tmpdir.join(expected_output_name))
+ cmdline = 'env update --file {} --prune --quiet'.format(tmpdir.join('environment.yml'))
assert argv == cmdline.split()
+ assert devenv.write_activate_deactivate_scripts.call_count == write_scripts_call_count
@pytest.mark.parametrize('input_name', ['environment.devenv.yml', 'environment.yml'])
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 3,
"test_score": 0
},
"num_modified_files": 2
}
|
0.9
|
{
"env_vars": null,
"env_yml_path": [],
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-datadir"
],
"pre_install": [],
"python": "3.6",
"reqs_path": [
"requirements_dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
attrs==22.2.0
Babel==2.11.0
bump2version==1.0.1
bumpversion==0.6.0
certifi==2021.5.30
cffi==1.15.1
charset-normalizer==2.0.12
-e git+https://github.com/ESSS/conda-devenv.git@f58819151109dfc68edbbf4a58cd56853ff1c414#egg=conda_devenv
coverage==6.2
cryptography==40.0.2
distlib==0.3.9
docutils==0.17.1
filelock==3.4.1
flake8==5.0.4
idna==3.10
imagesize==1.4.1
importlib-metadata==4.2.0
importlib-resources==5.4.0
iniconfig==1.1.1
Jinja2==3.0.3
MarkupSafe==2.0.1
mccabe==0.7.0
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pycparser==2.21
pyflakes==2.5.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytest-datadir==1.4.1
pytest-mock==3.6.1
pytz==2025.2
PyYAML==6.0.1
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==4.3.2
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
toml==0.10.2
tomli==1.2.3
tox==3.28.0
typing_extensions==4.1.1
urllib3==1.26.20
virtualenv==20.16.2
watchdog==2.3.1
zipp==3.6.0
|
name: conda-devenv
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- attrs==22.2.0
- babel==2.11.0
- bump2version==1.0.1
- bumpversion==0.6.0
- cffi==1.15.1
- charset-normalizer==2.0.12
- coverage==6.2
- cryptography==40.0.2
- distlib==0.3.9
- docutils==0.17.1
- filelock==3.4.1
- flake8==5.0.4
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==4.2.0
- importlib-resources==5.4.0
- iniconfig==1.1.1
- jinja2==3.0.3
- markupsafe==2.0.1
- mccabe==0.7.0
- packaging==21.3
- platformdirs==2.4.0
- pluggy==1.0.0
- py==1.11.0
- pycodestyle==2.9.1
- pycparser==2.21
- pyflakes==2.5.0
- pygments==2.14.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-datadir==1.4.1
- pytest-mock==3.6.1
- pytz==2025.2
- pyyaml==6.0.1
- requests==2.27.1
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==4.3.2
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- toml==0.10.2
- tomli==1.2.3
- tox==3.28.0
- typing-extensions==4.1.1
- urllib3==1.26.20
- virtualenv==20.16.2
- watchdog==2.3.1
- zipp==3.6.0
prefix: /opt/conda/envs/conda-devenv
|
[
"tests/test_main.py::test_handle_input_file[environment.yml-0]"
] |
[
"tests/test_main.py::test_handle_input_file[environment.devenv.yml-1]",
"tests/test_main.py::test_print[environment.devenv.yml]",
"tests/test_main.py::test_print_full"
] |
[
"tests/test_main.py::test_print[environment.yml]"
] |
[] |
MIT License
| 1,203 |
|
Azure__azure-cli-2955
|
3079f47653297161fd877f994cfaa0bc202f039f
|
2017-04-21 17:50:06
|
eb12ac454cbe1ddb59c86cdf2045e1912660e750
|
yugangw-msft: ```bash
(env) D:\sdk\azure-cli>az ad group -h
Group
az ad group: Manage Azure Active Directory groups.
Subgroups:
member : Manage Azure Active Directory group members.
Commands:
create : Create a group in the directory.
delete : Delete a group in the directory.
get-member-groups: Gets a collection that contains the Object IDs of the groups of which the
group is a member.
list : List groups in the directory.
show : Gets group information from the directory.
(env) D:\sdk\azure-cli>az ad group member -h
Group
az ad group member: Manage Azure Active Directory group members.
Commands:
add : Add a memeber to a group.
check : Checks whether the specified user, group, contact, or service principal is a direct or a
transitive member of the specified group.
list : Gets the members of a group.
remove: Remove a memeber from a group.
```
codecov-io: # [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=h1) Report
> Merging [#2955](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=desc) into [master](https://codecov.io/gh/Azure/azure-cli/commit/86c54142d7084eff0e8f2f5c7ae48ecbd53dfc0c?src=pr&el=desc) will **increase** coverage by `0.07%`.
> The diff coverage is `85.1%`.
[](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #2955 +/- ##
==========================================
+ Coverage 63.33% 63.41% +0.07%
==========================================
Files 466 467 +1
Lines 26539 26584 +45
Branches 4069 4073 +4
==========================================
+ Hits 16809 16858 +49
+ Misses 8617 8609 -8
- Partials 1113 1117 +4
```
| [Impacted Files](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...-cli-role/azure/cli/command\_modules/role/custom.py](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcm9sZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3JvbGUvY3VzdG9tLnB5) | `33.56% <ø> (+1.6%)` | :arrow_up: |
| [...e-cli-role/azure/cli/command\_modules/role/\_help.py](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcm9sZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3JvbGUvX2hlbHAucHk=) | `100% <100%> (ø)` | :arrow_up: |
| [...cli-role/azure/cli/command\_modules/role/\_params.py](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcm9sZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3JvbGUvX3BhcmFtcy5weQ==) | `100% <100%> (ø)` | :arrow_up: |
| [...li-role/azure/cli/command\_modules/role/commands.py](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcm9sZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3JvbGUvY29tbWFuZHMucHk=) | `90.19% <100%> (+5.75%)` | :arrow_up: |
| [...role/azure/cli/command\_modules/role/\_validators.py](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcm9sZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3JvbGUvX3ZhbGlkYXRvcnMucHk=) | `76.66% <76.66%> (ø)` | |
| [...rofile/azure/cli/command\_modules/profile/custom.py](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcHJvZmlsZS9henVyZS9jbGkvY29tbWFuZF9tb2R1bGVzL3Byb2ZpbGUvY3VzdG9tLnB5) | `35.21% <0%> (+2.81%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=footer). Last update [86c5414...85551c8](https://codecov.io/gh/Azure/azure-cli/pull/2955?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
|
diff --git a/src/command_modules/azure-cli-role/HISTORY.rst b/src/command_modules/azure-cli-role/HISTORY.rst
index b34ef4fe7..5b6240d98 100644
--- a/src/command_modules/azure-cli-role/HISTORY.rst
+++ b/src/command_modules/azure-cli-role/HISTORY.rst
@@ -5,6 +5,7 @@ Release History
2.0.3 (unreleased)
++++++++++++++++++
* create-for-rbac: ensure SP's end date will not exceed certificate's expiration date (#2989)
+* RBAC: add full support for 'ad group' (#2016)
2.0.2 (2017-04-17)
++++++++++++++++++
diff --git a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_help.py b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_help.py
index 852adcc35..25814a12f 100644
--- a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_help.py
+++ b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_help.py
@@ -140,6 +140,10 @@ helps['ad group'] = """
type: group
short-summary: Manage Azure Active Directory groups.
"""
+helps['ad group member'] = """
+ type: group
+ short-summary: Manage Azure Active Directory group members.
+"""
helps['ad sp'] = """
type: group
short-summary: Manage Azure Active Directory service principals for automation authentication.
diff --git a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_params.py b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_params.py
index 828f046fc..9c749fcde 100644
--- a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_params.py
+++ b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_params.py
@@ -8,9 +8,10 @@ from azure.cli.core.commands import CliArgumentType
from azure.cli.core.commands import register_cli_argument
from azure.cli.core.commands.parameters import enum_choice_list
from .custom import get_role_definition_name_completion_list
+from ._validators import validate_group, validate_member_id, VARIANT_GROUP_ID_ARGS
register_cli_argument('ad app', 'application_object_id', options_list=('--object-id',))
-register_cli_argument('ad app', 'display_name', help=' the display name of the application')
+register_cli_argument('ad app', 'display_name', help='the display name of the application')
register_cli_argument('ad app', 'homepage', help='the url where users can sign in and use your app.')
register_cli_argument('ad app', 'identifier', options_list=('--id',), help='identifier uri, application id, or object id')
register_cli_argument('ad app', 'identifier_uris', nargs='+', help='space separated unique URIs that Azure AD can use for this app.')
@@ -47,6 +48,15 @@ register_cli_argument('ad', 'query_filter', options_list=('--filter',), help='OD
register_cli_argument('ad user', 'mail_nickname', help='mail alias. Defaults to user principal name')
register_cli_argument('ad user', 'force_change_password_next_login', action='store_true')
+group_help_msg = "group's object id or display name(prefix also works if there is a unique match)"
+for arg in VARIANT_GROUP_ID_ARGS:
+ register_cli_argument('ad group', arg, options_list=('--group', '-g'), validator=validate_group, help=group_help_msg)
+
+register_cli_argument('ad group get-member-groups', 'security_enabled_only', action='store_true', default=False, required=False)
+member_id_help_msg = 'The object ID of the contact, group, user, or service principal'
+register_cli_argument('ad group member add', 'url', options_list='--member-id', validator=validate_member_id, help=member_id_help_msg)
+register_cli_argument('ad group member', 'member_object_id', options_list='--member-id', help=member_id_help_msg)
+
register_cli_argument('role', 'scope', help='scope at which the role assignment or definition applies to, e.g., /subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333, /subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup, or /subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM')
register_cli_argument('role assignment', 'role_assignment_name', options_list=('--name', '-n'))
register_cli_argument('role assignment', 'role', help='role name or id', completer=get_role_definition_name_completion_list)
diff --git a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_validators.py b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_validators.py
new file mode 100644
index 000000000..e88fb273b
--- /dev/null
+++ b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/_validators.py
@@ -0,0 +1,44 @@
+# --------------------------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for license information.
+# --------------------------------------------------------------------------------------------
+
+import uuid
+from azure.cli.core.util import CLIError
+from ._client_factory import _graph_client_factory
+
+VARIANT_GROUP_ID_ARGS = ['object_id', 'group_id', 'group_object_id']
+
+
+def validate_group(namespace):
+ # For AD auto-commands, here we resolve logic names to object ids needed by SDK methods
+ attr, value = next(((x, getattr(namespace, x)) for x in VARIANT_GROUP_ID_ARGS
+ if hasattr(namespace, x)))
+ try:
+ uuid.UUID(value)
+ except ValueError:
+ client = _graph_client_factory()
+ sub_filters = []
+ sub_filters.append("startswith(displayName,'{}')".format(value))
+ sub_filters.append("displayName eq '{}'".format(value))
+ result = list(client.groups.list(filter=' or '.join(sub_filters)))
+ count = len(result)
+ if count == 1:
+ setattr(namespace, attr, result[0].object_id)
+ elif count == 0:
+ raise CLIError("No group matches the name of '{}'".format(value))
+ else:
+ raise CLIError("More than one groups match the name of '{}'".format(value))
+
+
+def validate_member_id(namespace):
+ from azure.cli.core._profile import Profile, CLOUD
+ try:
+ uuid.UUID(namespace.url)
+ profile = Profile()
+ _, _, tenant_id = profile.get_login_credentials()
+ graph_url = CLOUD.endpoints.active_directory_graph_resource_id
+ namespace.url = '{}{}/directoryObjects/{}'.format(graph_url, tenant_id,
+ namespace.url)
+ except ValueError:
+ pass # let it go, invalid values will be caught by server anyway
diff --git a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/commands.py b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/commands.py
index 3a490dfef..86a2a689b 100644
--- a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/commands.py
+++ b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/commands.py
@@ -105,12 +105,23 @@ cli_command(__name__, 'ad user list', 'azure.cli.command_modules.role.custom#lis
cli_command(__name__, 'ad user create', 'azure.cli.command_modules.role.custom#create_user',
get_graph_client_users)
-cli_command(__name__, 'ad group delete',
- 'azure.graphrbac.operations.groups_operations#GroupsOperations.delete',
- get_graph_client_groups)
-cli_command(__name__, 'ad group show',
- 'azure.graphrbac.operations.groups_operations#GroupsOperations.get',
- get_graph_client_groups,
+group_path = 'azure.graphrbac.operations.groups_operations#GroupsOperations.{}'
+cli_command(__name__, 'ad group create', group_path.format('create'), get_graph_client_groups)
+cli_command(__name__, 'ad group delete', group_path.format('delete'), get_graph_client_groups)
+cli_command(__name__, 'ad group show', group_path.format('get'), get_graph_client_groups,
exception_handler=empty_on_404)
-cli_command(__name__, 'ad group list', 'azure.cli.command_modules.role.custom#list_groups',
+cli_command(__name__, 'ad group list',
+ 'azure.cli.command_modules.role.custom#list_groups',
+ get_graph_client_groups)
+
+cli_command(__name__, 'ad group get-member-groups', group_path.format('get_member_groups'),
+ get_graph_client_groups)
+
+cli_command(__name__, 'ad group member list', group_path.format('get_group_members'),
+ get_graph_client_groups)
+cli_command(__name__, 'ad group member add', group_path.format('add_member'),
+ get_graph_client_groups)
+cli_command(__name__, 'ad group member remove', group_path.format('remove_member'),
+ get_graph_client_groups)
+cli_command(__name__, 'ad group member check', group_path.format('is_member_of'),
get_graph_client_groups)
diff --git a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/custom.py b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/custom.py
index 4ccf4d0c8..5d22e92e2 100644
--- a/src/command_modules/azure-cli-role/azure/cli/command_modules/role/custom.py
+++ b/src/command_modules/azure-cli-role/azure/cli/command_modules/role/custom.py
@@ -357,12 +357,14 @@ create_user.__doc__ = UserCreateParameters.__doc__
def list_groups(client, display_name=None, query_filter=None):
+ '''
+ list groups in the directory
+ '''
sub_filters = []
if query_filter:
sub_filters.append(query_filter)
if display_name:
sub_filters.append("startswith(displayName,'{}')".format(display_name))
-
return client.list(filter=(' and ').join(sub_filters))
|
RBAC: support AD group commands
1. Author commands under `az ad group`, to be in parity with xplat's
2. On `group list`, add `--display-name` filtering
3. support group name when resolve `--assignee' on role creation
|
Azure/azure-cli
|
diff --git a/src/command_modules/azure-cli-role/tests/recordings/test_graph_group_scenario.yaml b/src/command_modules/azure-cli-role/tests/recordings/test_graph_group_scenario.yaml
new file mode 100644
index 000000000..325267215
--- /dev/null
+++ b/src/command_modules/azure-cli-role/tests/recordings/test_graph_group_scenario.yaml
@@ -0,0 +1,1048 @@
+interactions:
+- request:
+ body: '{"passwordProfile": {"forceChangePasswordNextLogin": false, "password":
+ "Test1234!!"}, "accountEnabled": true, "userPrincipalName": "[email protected]",
+ "mailNickname": "deleteme1", "displayName": "deleteme1"}'
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad user create]
+ Connection: [keep-alive]
+ Content-Length: ['230']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: POST
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/users?api-version=1.6
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.User/@Element","odata.type":"Microsoft.DirectoryServices.User","objectType":"User","objectId":"41109d4c-94f8-4308-a702-0a6f541d16a4","deletionTimestamp":null,"accountEnabled":true,"signInNames":[],"assignedLicenses":[],"assignedPlans":[],"city":null,"companyName":null,"country":null,"creationType":null,"department":null,"dirSyncEnabled":null,"displayName":"deleteme1","facsimileTelephoneNumber":null,"givenName":null,"immutableId":null,"isCompromised":null,"jobTitle":null,"lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme1","mobile":null,"onPremisesSecurityIdentifier":null,"otherMails":[],"passwordPolicies":null,"passwordProfile":null,"physicalDeliveryOfficeName":null,"postalCode":null,"preferredLanguage":null,"provisionedPlans":[],"provisioningErrors":[],"proxyAddresses":[],"refreshTokensValidFromDateTime":"2017-04-21T02:34:51.7535386Z","showInAddressList":null,"sipProxyAddress":null,"state":null,"streetAddress":null,"surname":null,"telephoneNumber":null,"usageLocation":null,"userPrincipalName":"[email protected]","userType":"Member"}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['1216']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:50 GMT']
+ Duration: ['8671347']
+ Expires: ['-1']
+ Location: ['https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/directoryObjects/41109d4c-94f8-4308-a702-0a6f541d16a4/Microsoft.DirectoryServices.User']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [WJ9iNj7ky7Q0raKkGm6593SGt4ZAaZkDQgVPLNeXP0c=]
+ ocp-aad-session-key: [jpR7XXuX_T1kxSIkqFOB52jihfMTnn9SH4VWMOFXyp0ZNiFqhwsUnGl9wn5W-i3hqVx0J62RXwirgueJgLB7qRY_ZrmB5UZud2phlU0NZcVvhFOgMjFVJThd1KC61mYY5N6N537jdMmLDDe2_RIDEKhMkPKPw-JnPn_nCbLSWnIG-vqlchEdaqCdFEvyQgkdP4yedcwRXuAbmqp4jujqfQ.M32PAKgiR6c_upGTEedeqJUTCKT98l29GfNeezk8wW4]
+ request-id: [42b9d2f6-90dc-456e-aff0-1711d90eeaed]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 201, message: Created}
+- request:
+ body: '{"passwordProfile": {"forceChangePasswordNextLogin": false, "password":
+ "Test1234!!"}, "accountEnabled": true, "userPrincipalName": "[email protected]",
+ "mailNickname": "deleteme2", "displayName": "deleteme2"}'
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad user create]
+ Connection: [keep-alive]
+ Content-Length: ['230']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: POST
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/users?api-version=1.6
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.User/@Element","odata.type":"Microsoft.DirectoryServices.User","objectType":"User","objectId":"649c0cdc-2f45-4f78-b1d9-f555756dedba","deletionTimestamp":null,"accountEnabled":true,"signInNames":[],"assignedLicenses":[],"assignedPlans":[],"city":null,"companyName":null,"country":null,"creationType":null,"department":null,"dirSyncEnabled":null,"displayName":"deleteme2","facsimileTelephoneNumber":null,"givenName":null,"immutableId":null,"isCompromised":null,"jobTitle":null,"lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme2","mobile":null,"onPremisesSecurityIdentifier":null,"otherMails":[],"passwordPolicies":null,"passwordProfile":null,"physicalDeliveryOfficeName":null,"postalCode":null,"preferredLanguage":null,"provisionedPlans":[],"provisioningErrors":[],"proxyAddresses":[],"refreshTokensValidFromDateTime":"2017-04-21T02:34:52.5000485Z","showInAddressList":null,"sipProxyAddress":null,"state":null,"streetAddress":null,"surname":null,"telephoneNumber":null,"usageLocation":null,"userPrincipalName":"[email protected]","userType":"Member"}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['1216']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:53 GMT']
+ Duration: ['8892284']
+ Expires: ['-1']
+ Location: ['https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/directoryObjects/649c0cdc-2f45-4f78-b1d9-f555756dedba/Microsoft.DirectoryServices.User']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [u3zz2DALsiEmtzDI1/lFfQ0UcLsw4WkTvQJPQAl1nu0=]
+ ocp-aad-session-key: [f0dEeZJswiKEs92Lt9GL5-gLCN0jfABXm0H0UrGYDbLoIs1s9Unws4ropIkTTPi1k8dbWjdcn2f-K9WkvLjsuiFwqtDyqYVBbABZYoGcs0cQ7Xo2h-kCKGjn13kbIfLLbcMs_RfGHsGewZ2cVvBZ1KbjcBKlfr4nEbWcfcM27tL7-EIP1vD_02lCmR0TZzQbtp0VFMdz83xs741c15862w.60JMcr9O_9PccmmONTfbG1v4nt-abfjZE6V41dTdMHM]
+ request-id: [707086d5-fa4b-4c2a-bf73-e294b49af987]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 201, message: Created}
+- request:
+ body: '{"securityEnabled": true, "mailEnabled": false, "mailNickname": "deleteme_g",
+ "displayName": "deleteme_g"}'
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group create]
+ Connection: [keep-alive]
+ Content-Length: ['106']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: POST
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group/@Element","odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['552']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:53 GMT']
+ Duration: ['2380019']
+ Expires: ['-1']
+ Location: ['https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/directoryObjects/b511b706-141f-48e5-a700-7015860dbb04/Microsoft.DirectoryServices.Group']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [NQzzohdyto5u0aXRdIyWmvWAgmuTAftnKRMh6cwShWo=]
+ ocp-aad-session-key: [GJRbngTR61d56iJMPzyG31LFKOekl2lCiAF_4guv3uTEJM0pTp1IYSXej2vgjzZSZr_wc_QSSG2GjGPcvHSz6PHgpFZmyQKBORagTwJf6Sgnb5Cjq1ARhihaDfMoLp2Nwp3UKTdz4UmNlo48Act_66uoyRctddJV4xDNfX-_ib-u3psokOIAHlwOJaPCtt1a9lQZz3vYDNalIBgj2PgYlA.oysqr2-y3Dlx0zLdT6uZXhz1yUSnwGH8jKUIgr_3Exg]
+ request-id: [d7b18b60-8e95-4124-a278-e11110db1fdb]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 201, message: Created}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group member add]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: GET
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['555']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:53 GMT']
+ Duration: ['613565']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [4GoW7S4gK6ZADtJZ7anfPxmmIML2y1bLgHB/c5EmhGY=]
+ ocp-aad-session-key: [lVsL2ZNIVd6_koFCuZYBVypsOnwVi5RhktUhdU4EOGiAAogYhHtSeHArVlX-7J8V10S0K9VoDpn6J5ea_hgJcPbIjRBnF4jV6D5ignl8wpDUtDNricnghCITwDfGvtKDnbVhp_QlOmzpYEmTp89GzRvC6Hbt3qTqOk8GCCLG8qLC7dQhBO3UhtB8muEE4Zmu1__yXL1MO2LmRryH1XCw8A.nhxhzPCkXl7HVSP-Pg4r1wzJz42LCmtEjBeRUPQMxkE]
+ request-id: [649d075d-95f3-45d8-a462-91d4057163ea]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: '{"url": "https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/directoryObjects/41109d4c-94f8-4308-a702-0a6f541d16a4"}'
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group member add]
+ Connection: [keep-alive]
+ Content-Length: ['127']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: POST
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04/$links/members?api-version=1.6
+ response:
+ body: {string: ''}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ DataServiceVersion: [1.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:53 GMT']
+ Duration: ['1463966']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [p2VNFLoaL7S6Sl7mYZqZdKbM00cEf5mOy6vYy8NtAMg=]
+ ocp-aad-session-key: [Mc2Rjck_-jBXj-Da58jstd6v38mDi8GHdb2HNhm0rmJVN4CnooTHUAOMHHzq-fnbQ6URRFeYUV7EUwhf4nkA4SiNG4SWiwU8APAhVn8jrJs_xUXrjvo1Z1gu3Xnv0YWX0rTpX3eeV4WhXYbJWg2cYChAzF3ebXuW8YbR5tNl59MAKKM9w5ROdxY7s9BTm4UdJOQ7aWIr3H007p_RZaly7Q.WeG2JMDgIMMM0KjLnGgvWRoJz3GGEcTU-iOiCtPgYcU]
+ request-id: [691a8ac3-715c-4eb1-9d64-993356b5ac53]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 204, message: No Content}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group member add]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: GET
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['555']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:51 GMT']
+ Duration: ['633708']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [TJ/xKag4M2mTYYn3oFmzro7Z2/Yt3ZkfYZ6omhAf2Kg=]
+ ocp-aad-session-key: [tgzoU9JUnwbYTWQcIfGbFU9A5W7_pdTcN0MBB9GgzZuOJh7dQmg5gx7ACvLmuf5YX96wBimFsnGbYtimx3Ue8KEOK6sCqxOqjn_c2ftwkiNKYhY2sqkV17KEou3pL0GJtiIRJwIWjdBS65lflkOVW1C6eRFPm-8ga8R7ufl1zYkMCeTXhPesVuQwQ4Qrg08XJ3g6tmeN82T6hgg3tA7VFA.QOc5DkKbo5rfi87-6n1xJSgJ_TOkNRnKZXh3b2Vebsc]
+ request-id: [e7ce4ca2-f289-431d-9489-f972e8c2b93c]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: '{"url": "https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/directoryObjects/649c0cdc-2f45-4f78-b1d9-f555756dedba"}'
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group member add]
+ Connection: [keep-alive]
+ Content-Length: ['127']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: POST
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04/$links/members?api-version=1.6
+ response:
+ body: {string: ''}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ DataServiceVersion: [1.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:55 GMT']
+ Duration: ['2588595']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [O47BPeqbxW4dIh1dbaaiyT5Lss9ZWY0UVhN/+FnW4PY=]
+ ocp-aad-session-key: [KgIPVZbeF1-PL2sO3Kq1GECy_eOyO76-rtcBT5GQPHLLl7N1ZokI5rqNitIKraWaBreIZ3jXYLgzlHMUQNMtwzrndGu-_uhPi5S9ZfS4Fs8yv2OcXMz2j_pFKMbDtFI9E0vGk4Sr9yAbKBOJnTgGak-yRYYo8UFB7TId3itnKuZWXEyTJq4L6UciG-kb8eyP_u1enjZivXzDqcCVVGY8cg.r_TJVu8lMP-4xXIuuhve7oo8HbA-AHdX7kHcI6zklY4]
+ request-id: [f7c039e8-5f75-4478-8606-dc0997ef1780]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 204, message: No Content}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group show]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: GET
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['555']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:52 GMT']
+ Duration: ['967824']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [cze88VSQ6HNztT9BK1BBqepYViZ+GvMC7osQIs0Tj5w=]
+ ocp-aad-session-key: [-5j5Ahwc7IMTKpWeF-kh3_QD14JFDesEmh8WUaXsIe5DPRG0PLSt_hO9LNUVYwOruRczAEPAbYxyb6u1A660EkqUCguZnZ80Dr4BMjyCZX7W0I3oK9kg8X0_KQMBLo7fP0vOZfLt0Mb1WTU9nM4atfC0fpO0sDzZUiXssuMWO0RD0BOxK1gWtd_pszIHl9CRKaPqHVQ05EFKP62TVDXveg.iJ8127LwB9Up_Urrj0xvV-NV7k3u0wZDDSvuuRd36Rc]
+ request-id: [0afe37e2-23a2-426d-844b-3f514ecd2a71]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group show]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: GET
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04?api-version=1.6
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group/@Element","odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['552']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:53 GMT']
+ Duration: ['532282']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [bKebP66qgjbXsGkb8RKjEOK0Di4Z+mUFNK2uc4Kp3R8=]
+ ocp-aad-session-key: [DKS6X08Gzb4T4ohSw7NjrENjB-mLnbMLkOko1uC7zV5c7m2iakb2NG-ShAfDb-E1Rr-DwCq2FxxbowwD6Wwdr_TpzYWtJgULrB_ubgyAYbVkczf3Ycia8L0WyxKMXjk1HH3MbXXgZguiRXa6xSeVZcKS5_3UQE45TmCtVtNp9UzxMGBndJqmoDLrD429ppoJhlfA6jDJ1ok_dvSLgrWtoQ.Igsp3oo_oqgVSiCn5TWYqSXIghR4S2l2ghfvtMiaKQM]
+ request-id: [ef46cf12-ae59-4187-8170-eca9b76a29d9]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group show]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: GET
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04?api-version=1.6
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group/@Element","odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['552']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:56 GMT']
+ Duration: ['591932']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [GWBF+FqKrwi9lJ0Nz2UosGLK6d7IORKv9drCwOzHa0Q=]
+ ocp-aad-session-key: [YDIS_R4fAoyGIX0WhWxYFw1FDWyLY1HsyiMA3x6aTFyMyvnE637IV3Lz7H8clHb12vOw01PBH-sOscshSTjL11HPmJIDlwOcvBuRtOXvuZSWUyp4V8_jO4VdTIuK5zbjThFZS15oAV2ujYB_ND36x2GP4NkAmz6BeE8nVhwyPh15XqqbwVVgOjcKwRvcTV1QqkKezvHgqKy1DLkMbw2D_g.WHyFdJ3G1HsN6XQ9FsTfBpbcbd1q_QgBaLtqFYBIFug]
+ request-id: [0da9d692-6a81-469d-8202-ccb68bf23e9f]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group list]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: GET
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['555']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:54 GMT']
+ Duration: ['636208']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [nG3hKVoq5XXuUdcuvSQIIaqQRGfFv8ulezCBqMPQCRQ=]
+ ocp-aad-session-key: [_hasrBAPYrcMyTqk7-JKvJ4RF_E-Q_0dnzcSp-N7p0WApD5pO_i0HzI0DCGesNwEcHm4k6o5g6n6uKj8xSDMCk7FnzOfWFt5CJlkdWphgf_AD2STxTEuyHFoLw9RTjN_zmklZHDhiMKtRDl1eMKUzMHgGucn0yh5jV1qpoYA3qeSjWVkPcm2tinQG3OLMk5XXEugvwGrczZfee0XgUDvOQ.pCR1otnzCj8LPTz0-pOtvCKF9lU7DmNKmNUOjR_kUsk]
+ request-id: [fb2902c6-d7b6-43be-86e5-f5c308ed2a07]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group get-member-groups]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: GET
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['555']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:55 GMT']
+ Duration: ['602504']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [xU4JSRnBDDuUT0qZaU7x6kfvEIokIxo5omNgFl2G0G4=]
+ ocp-aad-session-key: [OTQMxLHuUsIgc3ZFQJfpfavOnhw_OX1uMKuj3-9lXQgemAd6Tl_qVYvMxqJd1eOK5BiMQqfpqktUM4hlumWo_1oEF1PiA_X0EGhEkiq1Wos7YLfDDtLhSGyJq8FtaltULVlTfSmnGD2Y56-KxCvrL5NenemOd5zCAJpt3QIWu4xJtUAcEXF3O4CkAGEXQNY6FqEIHnAAcY1LQgtp7YgAaA.Hk_VuLh7XR6rRAn66nmruKCFAtxoaCI04ld9oeZ1uzI]
+ request-id: [d6450c5b-c7ee-4a5a-96bb-5f2156e9ebfd]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: '{"securityEnabledOnly": false}'
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group get-member-groups]
+ Connection: [keep-alive]
+ Content-Length: ['30']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: POST
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04/getMemberGroups?api-version=1.6
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#Collection(Edm.String)","value":[]}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['127']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:57 GMT']
+ Duration: ['860475']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [2mzsumD7v4laEobzcd1BLO71t/RyrMmpEcVHR0ySBgI=]
+ ocp-aad-session-key: [CSlAkP3jSRRDYfT6gT36QzmwtPMLYLL1LgowcGHVZ4RFpymPbEI9Qd2HGpjuLrTZ2HC0iHL4vF1nYL_5CX_4ucK_wR8wobcCom93gvO9vH_qbu46h7sUSJoqtyPc7l0prau_VRTMenswmCWPnwpmHfcxzLeE5MkRZAjwWFFT1wozXKZRe90LJgkpfhCdWvdf95CbQZyIlkVZsKHc7WKgpw.KohCAEDmIrkgl533DVtAMiM36kmniAQPMrN5_Q5eupg]
+ request-id: [59972335-0452-498f-aac4-1e884a21f767]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group member check]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: GET
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['555']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:55 GMT']
+ Duration: ['669783']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [v4ImhedTSMLcBqRGrUg4p+YYyJPNNYsWlqCUOR8+Elg=]
+ ocp-aad-session-key: [fKytxFLzaKADa9Bj5TrZUEHhLwxnse5FP-NjTz6VUot1t9uEEqCAeNB5WzLnJGg9M8suutqxkx9Xdpd8BcZn0gTwo2W0Zv5NAdOdW-jWTYUuq6NShKhVkMocF4_ympjuMl91J8bwd71aVZcgy3bYlXOD-exyOqD0EgjiNr49dsBmsfcGXmfnDdtJP5Z3VSdkpt9EerqPWIGNoANAMk9q6A.CoXW9B-GDT0SMGocGBhmNouBV5eNzZYlIzuOz4N_jpg]
+ request-id: [209df732-f113-4a39-8949-953eefadd24e]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: '{"groupId": "b511b706-141f-48e5-a700-7015860dbb04", "memberId": "41109d4c-94f8-4308-a702-0a6f541d16a4"}'
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group member check]
+ Connection: [keep-alive]
+ Content-Length: ['103']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: POST
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/isMemberOf?api-version=1.6
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#Edm.Boolean","value":true}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['118']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:54 GMT']
+ Duration: ['810984']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [0lQ4vCmckKCyRLoL4AoEX4aKPw4qTo7BdYx2Pv/0osg=]
+ ocp-aad-session-key: [_JpCop26AtTqhzRT-f7kL870Cu-5buOlVaE8K2g8_Rd2jWW0iNt7stu5Iks2HBZngb442bG8iY0qXd-_L7GP-Uskag_kslAHZ9_AjfhxTZN7Sf3jECQVY0-ptyTGtzuH8Kwn8eSXNlXYujbMzaGY-SDGsKe6PAcvqdRCAvIMdPTY_JbiA8zMoLC8W38mru5qJZL3UZzx7KkMtA_v4GHAAg.dqfTW22-j6WG-x5hDsmTEDe4GivwGJnEQbTtwrRvWxA]
+ request-id: [2e0c0686-9861-4efd-b05a-117df3c4b83c]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group member check]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: GET
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['555']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:57 GMT']
+ Duration: ['657067']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [pl1kFb+g22xnnvGQgyu9q8Kv53mcwJTK0gXSbnmQHzY=]
+ ocp-aad-session-key: [D_nZv7BCyyH6hlTvgKbDTE9IazhxY-nkG1TuujzN3aIMX7Bd3iDvXMexnWqfxoqTZ-L-B80C5RPPCzHumjjdt0Pfc_g_dqyS_w-i6-kou6l74Zcf8URH_MldqFcP5qbxAm4HqVfDQnCeGX69Fmu2y02B7X37AZX-d-xoPPriC-CRq_6Q_of5IXQ016ZxTN_WWJbjw60cVV-nSaT7kkExew.EwnlKxADC8uYpvoJLAyjx2X5ah-tUT3CvsXDLLb3urU]
+ request-id: [ad92ec24-7416-4f12-8ddb-904ba9b727c2]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: '{"groupId": "b511b706-141f-48e5-a700-7015860dbb04", "memberId": "649c0cdc-2f45-4f78-b1d9-f555756dedba"}'
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group member check]
+ Connection: [keep-alive]
+ Content-Length: ['103']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: POST
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/isMemberOf?api-version=1.6
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#Edm.Boolean","value":true}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['118']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:58 GMT']
+ Duration: ['1363446']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [zBnO1zgN2HN/dAMzOnN35k2SLefJt7CbCenk7Vv7NR0=]
+ ocp-aad-session-key: [-TiuX6eJNiZR5sLdWaZrYhs1vdOlVQPbB7WGntmO-Ih8Sy-tgqZ231YAiFWoQ2vCeYr1pq3B5UGCuGhedAGVmCQOQqBTBRwP2TQklHXsYpMykYL5MkRcOhAe_hoYiwaFbCUt-3nRBTIgPl2Kr_fPelty82eT09gMO62-wEWE6kGZRqTLH_pC0xkLsLX547Kz12pSvACjjpIeCwyntegALw.Jg6m9-Tptl_sHwTs-qSTZjYkowuz5wne44awV_BfMv8]
+ request-id: [b0e3ec2f-6e1d-4a01-94af-fc1f3631f9e1]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group member list]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: GET
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['555']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:56 GMT']
+ Duration: ['503530']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [WJ9iNj7ky7Q0raKkGm6593SGt4ZAaZkDQgVPLNeXP0c=]
+ ocp-aad-session-key: [s4MzuxF7PdUctiURqSCyFM4YarHwm4Xu5NDwpXdGD5My5mOBj_10DJCTTiy9AoPB4yK-XLVblTzodQjoUCNqRrGmN7kWzDaBABnY07YXqM4yos8WfnagpjNKUOFwojko2DKzCRyozLN7zkI83OPUW0gpumTT756eA3CWeg9uzLPg1rDaDSEKfqWZQDZSnqHBpKTvuElFgi_zI9mZfjSqSQ.r6CVQarU5-XzxmQNj--scdG-3Js9D3MbCZE_kJmbriE]
+ request-id: [231fc766-9c95-4a42-a7af-5f3d513f9b4c]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group member list]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: GET
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04/members?api-version=1.6
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects","value":[{"odata.type":"Microsoft.DirectoryServices.User","objectType":"User","objectId":"41109d4c-94f8-4308-a702-0a6f541d16a4","deletionTimestamp":null,"accountEnabled":true,"signInNames":[],"assignedLicenses":[],"assignedPlans":[],"city":null,"companyName":null,"country":null,"creationType":null,"department":null,"dirSyncEnabled":null,"displayName":"deleteme1","facsimileTelephoneNumber":null,"givenName":null,"immutableId":null,"isCompromised":null,"jobTitle":null,"lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme1","mobile":null,"onPremisesSecurityIdentifier":null,"otherMails":[],"passwordPolicies":null,"passwordProfile":null,"physicalDeliveryOfficeName":null,"postalCode":null,"preferredLanguage":null,"provisionedPlans":[],"provisioningErrors":[],"proxyAddresses":[],"refreshTokensValidFromDateTime":"2017-04-21T02:34:51Z","showInAddressList":null,"sipProxyAddress":null,"state":null,"streetAddress":null,"surname":null,"telephoneNumber":null,"usageLocation":null,"userPrincipalName":"[email protected]","userType":"Member"},{"odata.type":"Microsoft.DirectoryServices.User","objectType":"User","objectId":"649c0cdc-2f45-4f78-b1d9-f555756dedba","deletionTimestamp":null,"accountEnabled":true,"signInNames":[],"assignedLicenses":[],"assignedPlans":[],"city":null,"companyName":null,"country":null,"creationType":null,"department":null,"dirSyncEnabled":null,"displayName":"deleteme2","facsimileTelephoneNumber":null,"givenName":null,"immutableId":null,"isCompromised":null,"jobTitle":null,"lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme2","mobile":null,"onPremisesSecurityIdentifier":null,"otherMails":[],"passwordPolicies":null,"passwordProfile":null,"physicalDeliveryOfficeName":null,"postalCode":null,"preferredLanguage":null,"provisionedPlans":[],"provisioningErrors":[],"proxyAddresses":[],"refreshTokensValidFromDateTime":"2017-04-21T02:34:52Z","showInAddressList":null,"sipProxyAddress":null,"state":null,"streetAddress":null,"surname":null,"telephoneNumber":null,"usageLocation":null,"userPrincipalName":"[email protected]","userType":"Member"}]}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['2236']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:58 GMT']
+ Duration: ['830347']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [JI7Ca0Wtacsn3e2Y1FRjFO8qh6f3DNYttzXsIANsgIA=]
+ ocp-aad-session-key: [MyKWg_I_7XGy3aU0fv7IykF3JWU1LUc76ZrFlJDEvtngI9fjM9DxLbid04bmhYoZBAvaqjFJaKjxrlGFcS0NelPbaxVPvznRSXuK7NcWM-IkpLYC8luNgPfTljTa1pp5k5HiAqVf92DeIoUa_wymsCnUzIxUiKghvZEatWPw9MJBgHQ-lnZabqBHu1w0txkA3UJqmExlJDkBg0TQmZWS2Q.gpY5bTlXcwfHZilpCGbJQz-Ylxl0IhfTIxagx5dUeqg]
+ request-id: [f4acfc1e-6b2f-4a79-a502-03cd8f5801d2]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group member remove]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: GET
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['555']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:56 GMT']
+ Duration: ['506900']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [O47BPeqbxW4dIh1dbaaiyT5Lss9ZWY0UVhN/+FnW4PY=]
+ ocp-aad-session-key: [z3lSHGlTSyWGBXraRiHc-kHSCzKy0CuH27o-v5Pwjd4NwNooZ8I_jmixBVTiX7R6x8sS0E9PL-ob1hIfN18dGzZestDbSPnaCmKn_4yjDCXWf_dh9_KfzB4OeIKyFiCwr5NcQU_FdngQuzO8rIgAaj5LK_KVRtwkeYMBlL-2EQxL1iDyGC7bF4t0rFxg-NVW_Y2i9mf-lPcJaLLprYsp1g.zOxy-ZzKq9pq0K03tQs5zxP8SKJy7WhxY8OkRrXu8bE]
+ request-id: [f1df41ee-cd2b-47c2-a7a4-26ab3d4ea6ce]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group member remove]
+ Connection: [keep-alive]
+ Content-Length: ['0']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: DELETE
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04/$links/members/41109d4c-94f8-4308-a702-0a6f541d16a4?api-version=1.6
+ response:
+ body: {string: ''}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ DataServiceVersion: [1.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:56 GMT']
+ Duration: ['2264001']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [Gn/SyFs1dI76n3DdqL7J62Lgmc/wMbIjPyRQ+vCls0k=]
+ ocp-aad-session-key: [isZqfNhyBGpSID-iupVpM_ceSzx5HasaP6wT7cUFjc3dCRd5lXE7q6NOyFu3X6TdoL46o3pCXbouBhVkFww7EuyeivddBZrlDoW8157LvM5fc3EgDsbWa1fJien5MrYKog38AmLG-vKsiBShDkYm7bY2wX1dM053D7EldRlq23ogZyWLuTufr1AwWqw6IwAfVHCTmSyYdiDqcM2EaHp7uA.MdO06y-NG9KQaVpO4ZZQx5UZErNAGqsaIheOrl2WkK8]
+ request-id: [c95e201a-2ef2-4d3e-8c4c-289d67778d25]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 204, message: No Content}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group member check]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: GET
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['555']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:56 GMT']
+ Duration: ['902544']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [JI7Ca0Wtacsn3e2Y1FRjFO8qh6f3DNYttzXsIANsgIA=]
+ ocp-aad-session-key: [Ixi9Zw0nnJ_cLexDXVKMMyDHI12GEB7Bqe6jHvOJto-z3SrIRxrBmmL2C2e7Ei0JYvrKblOJQyxcEM10Ko6Tux1bJizCcnOgaGfbwoUArfpn4L5i5npLxYycpIvC9ccou4aZwEGBgTGrpU6ikpTtq7EHnwZuauUIhOWgw5YxKsoF8h_ALWrwV78X5jLy_XG_96DnNf_Tf2-YUm-TkXWXMw.ZWBUBsEQ0fvQGQLF_nUNzojvb7Ipzl_tmXCmDH0npWQ]
+ request-id: [23dc0b65-1128-421b-8e22-115ac2a482fd]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: '{"groupId": "b511b706-141f-48e5-a700-7015860dbb04", "memberId": "41109d4c-94f8-4308-a702-0a6f541d16a4"}'
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group member check]
+ Connection: [keep-alive]
+ Content-Length: ['103']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: POST
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/isMemberOf?api-version=1.6
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#Edm.Boolean","value":false}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['119']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:58 GMT']
+ Duration: ['930994']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [iyH1L5ZSeWH83EP1icIOAwr148oY/OGtb+Pw+quNhWk=]
+ ocp-aad-session-key: [saU0G3jLDN3q38j_e89BHbOJSXIG3CVkdt7Wzj52cGrFX_KKTJv3sCwz_bDEdZnCi76bYCIGqFaM6ruj-zlJSp67G3nr1qJ-4_vOdVvtj6Mz3rE9v5MF61aRVPLevQCXCER_cCG_-9geT4yiKlsZ0SzyEgwC3PnnTIm30HJHoNYXoqTTyVm2ak-m_JdxzufWwOvB37r7dSN5Eknri5Z9Jg.uOFMAEkCGQ8MG7fjBTzaDP_d32TUwjLPLSYErDY4x00]
+ request-id: [00e0dbe2-a8d1-46d0-b626-d3dfedcf2ec1]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group delete]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: GET
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=startswith%28displayName%2C%27deleteme_g%27%29%20or%20displayName%20eq%20%27deleteme_g%27
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"b511b706-141f-48e5-a700-7015860dbb04","deletionTimestamp":null,"description":null,"dirSyncEnabled":null,"displayName":"deleteme_g","lastDirSyncTime":null,"mail":null,"mailNickname":"deleteme_g","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['555']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:59 GMT']
+ Duration: ['534658']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [JI7Ca0Wtacsn3e2Y1FRjFO8qh6f3DNYttzXsIANsgIA=]
+ ocp-aad-session-key: [LLv91GFqIBDylaY8nCzsIu6ncyPFpFrDgwSG5WbQ6uaZziEtmR7JQCx7IHENvL0dC2pinnGg_rj3OpLKlW0HwIFosf_3nAVT83SjKP6HVF84kO2ggLil7PUMAgOr6QhVLuWxxzuqzmT_IeHnROOHR4HvuF7sw4fGyktpP-pGW3SKpHzjRmHdX1ot2Lv9Y35VQ9hVAwYKMzVMr2msGZ2SFw.Wzrkhf5M2eSmF3zPf8n-dtwLe1x9hXpSmHJRqSJt4p4]
+ request-id: [1eb02221-6565-4bd8-9e69-8260b570f66f]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group delete]
+ Connection: [keep-alive]
+ Content-Length: ['0']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: DELETE
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups/b511b706-141f-48e5-a700-7015860dbb04?api-version=1.6
+ response:
+ body: {string: ''}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ DataServiceVersion: [1.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:59 GMT']
+ Duration: ['1432029']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [kuyxkXWpuMdFkyXupIcvORPNJ/cSc7C7Qv+yP0H/SL8=]
+ ocp-aad-session-key: [5r2cXJ4JlXL82zHO6N1eHSUTyf3gOowRwmmNcHP6io1291uQMjaFaSsBWVfvY04uFFhEqScMhiNyWuhF8DSty1LbfZulags2SjweEr93IPhdd2osXW5VF1gQEKruYOdwCLfyEI4RMk-CgkmgFAep4ED7FQI1CT-etHGenE2rawllPxncHXpunP3DvbMsSUys7dAyWaVFDChC9FfxQNzDew.c1-LftJXGu5ega3zTPx8GcZab8-viwiyOdm0nsBqKl0]
+ request-id: [a0a2c6e8-50d0-4950-b862-709348956edf]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 204, message: No Content}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad group list]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: GET
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/groups?api-version=1.6&$filter=
+ response:
+ body: {string: '{"odata.metadata":"https://graph.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/$metadata#directoryObjects/Microsoft.DirectoryServices.Group","value":[{"odata.type":"Microsoft.DirectoryServices.Group","objectType":"Group","objectId":"d758a069-52cc-47f6-bc00-961cea17be39","deletionTimestamp":null,"description":"for
+ bug investigation and will delete ","dirSyncEnabled":null,"displayName":"yugangwTestGroup","lastDirSyncTime":null,"mail":null,"mailNickname":"fb7f38a2-3b88-49a7-b890-71105a0091b7","mailEnabled":false,"onPremisesSecurityIdentifier":null,"provisioningErrors":[],"proxyAddresses":[],"securityEnabled":true}]}'}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ Content-Length: ['623']
+ Content-Type: [application/json;odata=minimalmetadata;streaming=true;charset=utf-8]
+ DataServiceVersion: [3.0;]
+ Date: ['Fri, 21 Apr 2017 02:34:59 GMT']
+ Duration: ['648611']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [u3zz2DALsiEmtzDI1/lFfQ0UcLsw4WkTvQJPQAl1nu0=]
+ ocp-aad-session-key: [gdefyo02rjZpQ4alGN3LlhbqHuofuYFfbrWf8_HmgDE1RAsyLPD9__rN2qS7S7pnyeDJpd34iBfACME1vnWmEs8V3I7vNh5CiQcoy6VOIKwWfXLy7uFM_3H_w8A6f3hxqbuymCeTN0-4vP9b1SizZTrj9u3qYyPvznP2mGgSCO98zHyQLWPUG0t9fhxJlWb8pUHB7b0fNXxwjHDAAFnNxw.I9mpazRb1lY7F7iXf1Dn36KhFfZm-SNSVZu2NrR_DU8]
+ request-id: [a38f7538-9554-4955-bfb7-be38e1fcc9e9]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad user delete]
+ Connection: [keep-alive]
+ Content-Length: ['0']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: DELETE
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/users/41109d4c-94f8-4308-a702-0a6f541d16a4?api-version=1.6
+ response:
+ body: {string: ''}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ DataServiceVersion: [1.0;]
+ Date: ['Fri, 21 Apr 2017 02:35:01 GMT']
+ Duration: ['11793485']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [1sP0P7WxKcBID6yc4fbz9MeUVowvkTIjVOQX5YMG/jY=]
+ ocp-aad-session-key: [JmkBUmhKvkEH-OeCNAXbnL4RSo-pgfrl4ubNDoMR7CaPOU_shaDJPHayz3PX_Gl3DSdPB_ingGSo2F7gb6CP87Il9yNmzvqM6ssWKm1RVSQU8ME4oYn-Qdhs7aXNRADVZVcefIgHUyDXRZDpZLp8YM6sauBkkyIfzcaum7CcjwGdeC6K04NUuwHA1n7HRx3ZKlbDGoDhAkUfRNsdM8_fjQ.mhlltQ0G6fsfwX-hzU4_V88B5c1IX8mwSx4QYhntv18]
+ request-id: [bd02d713-ee43-4416-b722-12e4385ace1e]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 204, message: No Content}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [ad user delete]
+ Connection: [keep-alive]
+ Content-Length: ['0']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.3 (Windows-10-10.0.14393-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 graphrbacmanagementclient/0.30.0rc6 Azure-SDK-For-Python
+ AZURECLI/2.0.3+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [17e413a2-263b-11e7-9185-64510658e3b3]
+ method: DELETE
+ uri: https://graph.windows.net/00000000-0000-0000-0000-000000000000/users/649c0cdc-2f45-4f78-b1d9-f555756dedba?api-version=1.6
+ response:
+ body: {string: ''}
+ headers:
+ Access-Control-Allow-Origin: ['*']
+ Cache-Control: [no-cache]
+ DataServiceVersion: [1.0;]
+ Date: ['Fri, 21 Apr 2017 02:35:02 GMT']
+ Duration: ['12149129']
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-IIS/8.5]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ X-AspNet-Version: [4.0.30319]
+ X-Content-Type-Options: [nosniff]
+ X-Powered-By: [ASP.NET, ASP.NET]
+ ocp-aad-diagnostics-server-name: [DJl/5bFSkj1cqgm9u7PtSoh9YAGkLAPecUruXCQn6TE=]
+ ocp-aad-session-key: [njJm2iHZLEr7FCWeEBDNfjLMWjYHetqMGYgkQtXxVNV1MQ8WvEv2k9pcmTeXTng_zRF32wu714hTx3tXrQu6VvrLiLVnD61UKLRgTgLDxB59lSVfw6TiXIDCK32RzuStmWhNz33YkvLtjikdMd7sb3_4WDKff2j_8UsbUvxrz2vsYKg1ldnwhf1JnFqm8RlX1FcSKD_uTIWnbP9k9fIpKg.7J0h-ySRCH2ygywgtd1ktEKsMc4J1dy1wk5adRmYi3I]
+ request-id: [0c718af5-bcc8-4339-81c2-95653fe7aa58]
+ x-ms-dirapi-data-contract-version: ['1.6']
+ status: {code: 204, message: No Content}
+version: 1
diff --git a/src/command_modules/azure-cli-role/tests/test_graph.py b/src/command_modules/azure-cli-role/tests/test_graph.py
index ad32ff733..95f3b3655 100644
--- a/src/command_modules/azure-cli-role/tests/test_graph.py
+++ b/src/command_modules/azure-cli-role/tests/test_graph.py
@@ -2,8 +2,11 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
-
+import json
from azure.cli.core.test_utils.vcr_test_base import VCRTestBase, JMESPathCheck, NoneCheck
+from azure.cli.testsdk import ScenarioTest
+from azure.cli.testsdk import JMESPathCheck as JMESPathCheck2
+from azure.cli.testsdk import NoneCheck as NoneCheck2
class ServicePrincipalExpressCreateScenarioTest(VCRTestBase):
@@ -85,3 +88,71 @@ class ApplicationSetScenarioTest(VCRTestBase):
# delete app
self.cmd('ad app delete --id {}'.format(app_id_uri))
self.cmd('ad app list --identifier-uri {}'.format(app_id_uri), checks=NoneCheck())
+
+
+class GraphGroupScenarioTest(ScenarioTest):
+
+ def test_graph_group_scenario(self):
+ self.user1 = 'deleteme1'
+ self.user1 = 'deleteme2'
+ upn = self.cmd('account show --query "user.name" -o tsv').output
+ _, domain = upn.split('@', 1)
+ user1 = 'deleteme1'
+ user2 = 'deleteme2'
+ group = 'deleteme_g'
+ password = 'Test1234!!'
+ try:
+ # create user1
+ user1_result = json.loads(self.cmd('ad user create --display-name {0} --password {1} --user-principal-name {0}@{2}'.format(user1, password, domain)).output)
+ # create user2
+ user2_result = json.loads(self.cmd('ad user create --display-name {0} --password {1} --user-principal-name {0}@{2}'.format(user2, password, domain)).output)
+ # create group
+ group_result = json.loads(self.cmd('ad group create --display-name {0} --mail-nickname {0}'.format(group)).output)
+ # add user1 into group
+ self.cmd('ad group member add -g {} --member-id {}'.format(group, user1_result['objectId']), checks=NoneCheck2())
+ # add user2 into group
+ self.cmd('ad group member add -g {} --member-id {}'.format(group, user2_result['objectId']), checks=NoneCheck2())
+ # show group
+ self.cmd('ad group show -g ' + group, checks=[
+ JMESPathCheck2('objectId', group_result['objectId']),
+ JMESPathCheck2('displayName', group)
+ ])
+ self.cmd('ad group show -g ' + group_result['objectId'], checks=[
+ JMESPathCheck2('displayName', group)
+ ])
+ # list group
+ self.cmd('ad group list --display-name ' + group, checks=[
+ JMESPathCheck2('[0].displayName', group)
+ ])
+ # show member groups
+ self.cmd('ad group get-member-groups -g ' + group, checks=[
+ JMESPathCheck2('length([])', 0)
+ ])
+ # check user1 memebership
+ self.cmd('ad group member check -g {} --member-id {}'.format(group, user1_result['objectId']), checks=[
+ JMESPathCheck2('value', True)
+ ])
+ # check user2 memebership
+ self.cmd('ad group member check -g {} --member-id {}'.format(group, user2_result['objectId']), checks=[
+ JMESPathCheck2('value', True)
+ ])
+ # list memebers
+ self.cmd('ad group member list -g ' + group, checks=[
+ JMESPathCheck2("length([?displayName=='{}'])".format(user1), 1),
+ JMESPathCheck2("length([?displayName=='{}'])".format(user2), 1),
+ JMESPathCheck2("length([])", 2),
+ ])
+ # remove user1
+ self.cmd('ad group member remove -g {} --member-id {}'.format(group, user1_result['objectId']))
+ # check user1 memebership
+ self.cmd('ad group member check -g {} --member-id {}'.format(group, user1_result['objectId']), checks=[
+ JMESPathCheck2('value', False)
+ ])
+ # delete the group
+ self.cmd('ad group delete -g ' + group)
+ self.cmd('ad group list', checks=[
+ JMESPathCheck2("length([?displayName=='{}'])".format(group), 0)
+ ])
+ finally:
+ self.cmd('ad user delete --upn-or-object-id ' + user1_result['objectId'])
+ self.cmd('ad user delete --upn-or-object-id ' + user2_result['objectId'])
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 5
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "python scripts/dev_setup.py",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.5",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
adal==0.4.3
applicationinsights==0.10.0
argcomplete==1.8.0
astroid==1.4.9
attrs==22.2.0
autopep8==1.2.4
azure-batch==2.0.0
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli&subdirectory=src/azure-cli
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_container&subdirectory=src/command_modules/azure-cli-container
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_core&subdirectory=src/azure-cli-core
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_dla&subdirectory=src/command_modules/azure-cli-dla
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_dls&subdirectory=src/command_modules/azure-cli-dls
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_documentdb&subdirectory=src/command_modules/azure-cli-documentdb
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_find&subdirectory=src/command_modules/azure-cli-find
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_lab&subdirectory=src/command_modules/azure-cli-lab
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_monitor&subdirectory=src/command_modules/azure-cli-monitor
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_testsdk&subdirectory=src/azure-cli-testsdk
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_utility_automation&subdirectory=scripts
-e git+https://github.com/Azure/azure-cli.git@3079f47653297161fd877f994cfaa0bc202f039f#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm
azure-common==1.1.28
azure-core==1.24.2
azure-datalake-store==0.0.6
azure-graphrbac==0.30.0rc6
azure-keyvault==0.1.0
azure-mgmt-authorization==0.30.0rc6
azure-mgmt-batch==3.0.0
azure-mgmt-compute==1.0.0rc1
azure-mgmt-containerregistry==0.2.0
azure-mgmt-datalake-analytics==0.1.3
azure-mgmt-datalake-nspkg==3.0.1
azure-mgmt-datalake-store==0.1.3
azure-mgmt-dns==1.0.0
azure-mgmt-documentdb==0.1.1
azure-mgmt-iothub==0.2.1
azure-mgmt-keyvault==0.30.0
azure-mgmt-monitor==0.2.0
azure-mgmt-network==1.0.0rc2
azure-mgmt-nspkg==3.0.2
azure-mgmt-redis==1.0.0
azure-mgmt-resource==1.0.0rc1
azure-mgmt-sql==0.4.0
azure-mgmt-storage==1.0.0rc1
azure-mgmt-trafficmanager==0.30.0rc6
azure-mgmt-web==0.31.0
azure-monitor==0.3.0
azure-multiapi-storage==0.1.0
azure-nspkg==3.0.2
certifi==2021.5.30
cffi==1.15.1
colorama==0.3.7
coverage==4.2
cryptography==40.0.2
flake8==3.2.1
futures==3.1.1
importlib-metadata==4.8.3
iniconfig==1.1.1
isodate==0.7.0
jeepney==0.7.1
jmespath==0.10.0
keyring==23.4.1
lazy-object-proxy==1.7.1
mccabe==0.5.3
mock==1.3.0
msrest==0.4.29
msrestazure==0.4.34
nose==1.3.7
oauthlib==3.2.2
packaging==21.3
paramiko==2.0.2
pbr==6.1.1
pep8==1.7.1
pluggy==1.0.0
py==1.11.0
pyasn1==0.5.1
pycodestyle==2.2.0
pycparser==2.21
pyflakes==1.3.0
Pygments==2.1.3
PyJWT==2.4.0
pylint==1.5.4
pyOpenSSL==16.2.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
PyYAML==3.11
requests==2.9.1
requests-oauthlib==2.0.0
scp==0.15.0
SecretStorage==3.3.3
six==1.10.0
sshtunnel==0.4.0
tabulate==0.7.5
tomli==1.2.3
typing-extensions==4.1.1
urllib3==1.16
vcrpy==1.10.3
Whoosh==2.7.4
wrapt==1.16.0
xmltodict==0.14.2
zipp==3.6.0
|
name: azure-cli
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- adal==0.4.3
- applicationinsights==0.10.0
- argcomplete==1.8.0
- astroid==1.4.9
- attrs==22.2.0
- autopep8==1.2.4
- azure-batch==2.0.0
- azure-common==1.1.28
- azure-core==1.24.2
- azure-datalake-store==0.0.6
- azure-graphrbac==0.30.0rc6
- azure-keyvault==0.1.0
- azure-mgmt-authorization==0.30.0rc6
- azure-mgmt-batch==3.0.0
- azure-mgmt-compute==1.0.0rc1
- azure-mgmt-containerregistry==0.2.0
- azure-mgmt-datalake-analytics==0.1.3
- azure-mgmt-datalake-nspkg==3.0.1
- azure-mgmt-datalake-store==0.1.3
- azure-mgmt-dns==1.0.0
- azure-mgmt-documentdb==0.1.1
- azure-mgmt-iothub==0.2.1
- azure-mgmt-keyvault==0.30.0
- azure-mgmt-monitor==0.2.0
- azure-mgmt-network==1.0.0rc2
- azure-mgmt-nspkg==3.0.2
- azure-mgmt-redis==1.0.0
- azure-mgmt-resource==1.0.0rc1
- azure-mgmt-sql==0.4.0
- azure-mgmt-storage==1.0.0rc1
- azure-mgmt-trafficmanager==0.30.0rc6
- azure-mgmt-web==0.31.0
- azure-monitor==0.3.0
- azure-multiapi-storage==0.1.0
- azure-nspkg==3.0.2
- cffi==1.15.1
- colorama==0.3.7
- coverage==4.2
- cryptography==40.0.2
- flake8==3.2.1
- futures==3.1.1
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- isodate==0.7.0
- jeepney==0.7.1
- jmespath==0.10.0
- keyring==23.4.1
- lazy-object-proxy==1.7.1
- mccabe==0.5.3
- mock==1.3.0
- msrest==0.4.29
- msrestazure==0.4.34
- nose==1.3.7
- oauthlib==3.2.2
- packaging==21.3
- paramiko==2.0.2
- pbr==6.1.1
- pep8==1.7.1
- pip==9.0.1
- pluggy==1.0.0
- py==1.11.0
- pyasn1==0.5.1
- pycodestyle==2.2.0
- pycparser==2.21
- pyflakes==1.3.0
- pygments==2.1.3
- pyjwt==2.4.0
- pylint==1.5.4
- pyopenssl==16.2.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pyyaml==3.11
- requests==2.9.1
- requests-oauthlib==2.0.0
- scp==0.15.0
- secretstorage==3.3.3
- setuptools==30.4.0
- six==1.10.0
- sshtunnel==0.4.0
- tabulate==0.7.5
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.16
- vcrpy==1.10.3
- whoosh==2.7.4
- wrapt==1.16.0
- xmltodict==0.14.2
- zipp==3.6.0
prefix: /opt/conda/envs/azure-cli
|
[
"src/command_modules/azure-cli-role/tests/test_graph.py::GraphGroupScenarioTest::test_graph_group_scenario"
] |
[] |
[
"src/command_modules/azure-cli-role/tests/test_graph.py::ServicePrincipalExpressCreateScenarioTest::test_sp_create_scenario",
"src/command_modules/azure-cli-role/tests/test_graph.py::ApplicationSetScenarioTest::test_application_set_scenario"
] |
[] |
MIT License
| 1,205 |
ESSS__conda-devenv-51
|
320f7fdd672abf4122506850982a6b4095614e55
|
2017-04-24 13:37:58
|
7867067acadb89f7da61af330d85caa31b284dd8
|
diff --git a/HISTORY.rst b/HISTORY.rst
index 608aaa0..f9fafd4 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -3,6 +3,12 @@ History
=======
+0.9.5 (2017-04-24)
+------------------
+
+* Handle ``None`` correctly, which actually fixes (`#49`_).
+
+
0.9.4 (2017-04-20)
------------------
diff --git a/conda_devenv/devenv.py b/conda_devenv/devenv.py
index 16d174c..44df72e 100644
--- a/conda_devenv/devenv.py
+++ b/conda_devenv/devenv.py
@@ -373,7 +373,7 @@ def main(args=None):
# Call conda-env update
retcode = __call_conda_env_update(args, output_filename)
- if retcode != 0:
+ if retcode:
return retcode
if is_devenv_input_file:
|
0.9.3 broken: no longer generates activate/deactivate scripts
#46 introduced a bug: `conda-devenv` now calls `conda_env.main` directly, which probably calls `sys.exit()`, which skips activate/deactivate scripts generation.
|
ESSS/conda-devenv
|
diff --git a/tests/test_main.py b/tests/test_main.py
index 4f0db10..feb2425 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -21,16 +21,20 @@ def patch_conda_calls(mocker):
('environment.devenv.yml', 1),
('environment.yml', 0),
])
[email protected]('return_none', [True, False])
@pytest.mark.usefixtures('patch_conda_calls')
-def test_handle_input_file(tmpdir, input_name, write_scripts_call_count):
+def test_handle_input_file(tmpdir, input_name, write_scripts_call_count, return_none):
"""
Test how conda-devenv handles input files: devenv.yml and pure .yml files.
"""
argv = []
def call_conda_mock():
argv[:] = sys.argv[:]
- # simulate that we actually called conda's main, which calls sys.exit()
- sys.exit(0)
+ # conda's env main() function sometimes returns None and other times raises SystemExit
+ if return_none:
+ return None
+ else:
+ sys.exit(0)
devenv._call_conda.side_effect = call_conda_mock
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 2
}
|
0.9
|
{
"env_vars": null,
"env_yml_path": [],
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-datadir"
],
"pre_install": [],
"python": "3.6",
"reqs_path": [
"requirements_dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
attrs==22.2.0
Babel==2.11.0
bump2version==1.0.1
bumpversion==0.6.0
certifi==2021.5.30
cffi==1.15.1
charset-normalizer==2.0.12
-e git+https://github.com/ESSS/conda-devenv.git@320f7fdd672abf4122506850982a6b4095614e55#egg=conda_devenv
coverage==6.2
cryptography==40.0.2
distlib==0.3.9
docutils==0.17.1
filelock==3.4.1
flake8==5.0.4
idna==3.10
imagesize==1.4.1
importlib-metadata==4.2.0
importlib-resources==5.4.0
iniconfig==1.1.1
Jinja2==3.0.3
MarkupSafe==2.0.1
mccabe==0.7.0
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pycparser==2.21
pyflakes==2.5.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytest-datadir==1.4.1
pytest-mock==3.6.1
pytz==2025.2
PyYAML==6.0.1
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==4.3.2
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
toml==0.10.2
tomli==1.2.3
tox==3.28.0
typing_extensions==4.1.1
urllib3==1.26.20
virtualenv==20.16.2
watchdog==2.3.1
zipp==3.6.0
|
name: conda-devenv
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- attrs==22.2.0
- babel==2.11.0
- bump2version==1.0.1
- bumpversion==0.6.0
- cffi==1.15.1
- charset-normalizer==2.0.12
- coverage==6.2
- cryptography==40.0.2
- distlib==0.3.9
- docutils==0.17.1
- filelock==3.4.1
- flake8==5.0.4
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==4.2.0
- importlib-resources==5.4.0
- iniconfig==1.1.1
- jinja2==3.0.3
- markupsafe==2.0.1
- mccabe==0.7.0
- packaging==21.3
- platformdirs==2.4.0
- pluggy==1.0.0
- py==1.11.0
- pycodestyle==2.9.1
- pycparser==2.21
- pyflakes==2.5.0
- pygments==2.14.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-datadir==1.4.1
- pytest-mock==3.6.1
- pytz==2025.2
- pyyaml==6.0.1
- requests==2.27.1
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==4.3.2
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- toml==0.10.2
- tomli==1.2.3
- tox==3.28.0
- typing-extensions==4.1.1
- urllib3==1.26.20
- virtualenv==20.16.2
- watchdog==2.3.1
- zipp==3.6.0
prefix: /opt/conda/envs/conda-devenv
|
[
"tests/test_main.py::test_handle_input_file[True-environment.yml-0]"
] |
[
"tests/test_main.py::test_handle_input_file[True-environment.devenv.yml-1]",
"tests/test_main.py::test_handle_input_file[False-environment.devenv.yml-1]",
"tests/test_main.py::test_print[environment.devenv.yml]",
"tests/test_main.py::test_print_full"
] |
[
"tests/test_main.py::test_handle_input_file[False-environment.yml-0]",
"tests/test_main.py::test_print[environment.yml]"
] |
[] |
MIT License
| 1,207 |
|
Duke-GCB__DukeDSClient-131
|
e158990c3f68aef9ed4731aa446cea6d49be2950
|
2017-04-25 13:35:08
|
bffebebd86d09f5924461959401ef3698b4e47d5
|
diff --git a/ddsc/core/localstore.py b/ddsc/core/localstore.py
index db0fa4b..9ced1a4 100644
--- a/ddsc/core/localstore.py
+++ b/ddsc/core/localstore.py
@@ -231,7 +231,14 @@ class LocalFile(object):
self.remote_id = remote_id
def count_chunks(self, bytes_per_chunk):
- return math.ceil(float(self.size) / float(bytes_per_chunk))
+ """
+ Based on the size of the file determine how many chunks we will need to upload.
+ For empty files 1 chunk is returned (DukeDS requires an empty chunk for empty files).
+ :param bytes_per_chunk: int: how many bytes should chunks to spglit the file into
+ :return: int: number of chunks that will need to be sent
+ """
+ chunks = math.ceil(float(self.size) / float(bytes_per_chunk))
+ return max(chunks, 1)
def __str__(self):
return 'file:{}'.format(self.name)
|
File Synchronization issue between portal and ddsclient
User feedback:
> As you may be aware, if a project has been modified via the web-portal, ddsclient seems to get confused. For example, If a file from a project has been removed via the web-portal, the ddsclient will ignore an upload request that would re-instantiate that file; it will report "Uploading 0 projects, 0 folders, 1 file.", but no files will be uploaded and the nothing will happen.
|
Duke-GCB/DukeDSClient
|
diff --git a/ddsc/core/tests/test_localstore.py b/ddsc/core/tests/test_localstore.py
index ff182bf..b4bb9da 100644
--- a/ddsc/core/tests/test_localstore.py
+++ b/ddsc/core/tests/test_localstore.py
@@ -1,9 +1,9 @@
import shutil
import tarfile
from unittest import TestCase
-
from ddsc.core.localstore import LocalFile, LocalFolder, LocalProject, FileFilter
from ddsc.config import FILE_EXCLUDE_REGEX_DEFAULT
+from mock import patch
INCLUDE_ALL = ''
@@ -159,3 +159,20 @@ class TestFileFilter(TestCase):
# exclude bad filenames
for bad_filename in bad_files:
self.assertEqual(include_file(bad_filename), False)
+
+
+class TestLocalFile(TestCase):
+ @patch('ddsc.core.localstore.os')
+ @patch('ddsc.core.localstore.PathData')
+ def test_count_chunks_values(self, mock_path_data, mock_os):
+ values = [
+ # file_size, bytes_per_chunk, expected
+ (200, 10, 20),
+ (200, 150, 2),
+ (3, 150, 1),
+ (0, 10, 1), # Empty files must send 1 empty chunk to DukeDS
+ ]
+ f = LocalFile('fakefile.txt')
+ for file_size, bytes_per_chunk, expected in values:
+ f.size = file_size
+ self.assertEqual(expected, f.count_chunks(bytes_per_chunk))
diff --git a/ddsc/core/tests/test_upload.py b/ddsc/core/tests/test_upload.py
index d3a4099..6fcbac1 100644
--- a/ddsc/core/tests/test_upload.py
+++ b/ddsc/core/tests/test_upload.py
@@ -1,6 +1,7 @@
from __future__ import absolute_import
from unittest import TestCase
-from ddsc.core.upload import ProjectUpload
+from ddsc.core.upload import ProjectUpload, LocalOnlyCounter
+from ddsc.core.localstore import LocalFile
from mock import MagicMock, patch
@@ -24,3 +25,19 @@ class TestUploadCommand(TestCase):
self.assertIn("Files/Folders that need to be uploaded:", dry_run_report)
self.assertIn("data.txt", dry_run_report)
self.assertIn("data2.txt", dry_run_report)
+
+
+class TestLocalOnlyCounter(TestCase):
+ @patch('ddsc.core.localstore.os')
+ @patch('ddsc.core.localstore.PathData')
+ def test_total_items(self, mock_path_data, mock_os):
+ counter = LocalOnlyCounter(bytes_per_chunk=100)
+ self.assertEqual(0, counter.total_items())
+ f = LocalFile('fakefile.txt')
+ f.size = 0
+ counter.visit_file(f, None)
+ self.assertEqual(1, counter.total_items())
+ f = LocalFile('fakefile2.txt')
+ f.size = 200
+ counter.visit_file(f, None)
+ self.assertEqual(3, counter.total_items())
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 1
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio",
"pytest-bdd",
"pytest-benchmark",
"pytest-randomly",
"responses",
"mock",
"hypothesis",
"freezegun",
"trustme",
"requests-mock",
"requests",
"tomlkit"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==25.3.0
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
coverage==7.8.0
cryptography==44.0.2
-e git+https://github.com/Duke-GCB/DukeDSClient.git@e158990c3f68aef9ed4731aa446cea6d49be2950#egg=DukeDSClient
exceptiongroup==1.2.2
execnet==2.1.1
freezegun==1.5.1
future==0.16.0
gherkin-official==29.0.0
hypothesis==6.130.5
idna==3.10
importlib_metadata==8.6.1
iniconfig==2.1.0
Mako==1.3.9
MarkupSafe==3.0.2
mock==5.2.0
packaging==24.2
parse==1.20.2
parse_type==0.6.4
pluggy==1.5.0
py-cpuinfo==9.0.0
pycparser==2.22
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-bdd==8.1.0
pytest-benchmark==5.1.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-randomly==3.16.0
pytest-xdist==3.6.1
python-dateutil==2.9.0.post0
PyYAML==3.12
requests==2.32.3
requests-mock==1.12.1
responses==0.25.7
six==1.17.0
sortedcontainers==2.4.0
tomli==2.2.1
tomlkit==0.13.2
trustme==1.2.1
typing_extensions==4.13.0
urllib3==2.3.0
zipp==3.21.0
|
name: DukeDSClient
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==25.3.0
- certifi==2025.1.31
- cffi==1.17.1
- charset-normalizer==3.4.1
- coverage==7.8.0
- cryptography==44.0.2
- exceptiongroup==1.2.2
- execnet==2.1.1
- freezegun==1.5.1
- future==0.16.0
- gherkin-official==29.0.0
- hypothesis==6.130.5
- idna==3.10
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- mako==1.3.9
- markupsafe==3.0.2
- mock==5.2.0
- packaging==24.2
- parse==1.20.2
- parse-type==0.6.4
- pluggy==1.5.0
- py-cpuinfo==9.0.0
- pycparser==2.22
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-bdd==8.1.0
- pytest-benchmark==5.1.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-randomly==3.16.0
- pytest-xdist==3.6.1
- python-dateutil==2.9.0.post0
- pyyaml==3.12
- requests==2.32.3
- requests-mock==1.12.1
- responses==0.25.7
- six==1.17.0
- sortedcontainers==2.4.0
- tomli==2.2.1
- tomlkit==0.13.2
- trustme==1.2.1
- typing-extensions==4.13.0
- urllib3==2.3.0
- zipp==3.21.0
prefix: /opt/conda/envs/DukeDSClient
|
[
"ddsc/core/tests/test_upload.py::TestLocalOnlyCounter::test_total_items",
"ddsc/core/tests/test_localstore.py::TestLocalFile::test_count_chunks_values"
] |
[
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_nested_folder_str",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_big_folder_str"
] |
[
"ddsc/core/tests/test_upload.py::TestUploadCommand::test_nothing_to_do",
"ddsc/core/tests/test_upload.py::TestUploadCommand::test_two_files_to_upload",
"ddsc/core/tests/test_localstore.py::TestProjectFolderFile::test_empty_folder_str",
"ddsc/core/tests/test_localstore.py::TestProjectFolderFile::test_folder_one_child_str",
"ddsc/core/tests/test_localstore.py::TestProjectFolderFile::test_folder_two_children_str",
"ddsc/core/tests/test_localstore.py::TestProjectFolderFile::test_nested_folder_str",
"ddsc/core/tests/test_localstore.py::TestProjectFolderFile::test_file_str",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_folder_name_removes_slash",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_empty_folder_str",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_folder_up_and_back",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_folder_dot_name",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_exclude_dot_files",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_top_level_file_str",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_one_folder_str",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_empty_folder_and_file_str",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_empty_str",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_folder_name_no_slash",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_include_dot_files",
"ddsc/core/tests/test_localstore.py::TestFileFilter::test_default_file_exclude_regex"
] |
[] |
MIT License
| 1,211 |
|
python-cmd2__cmd2-89
|
90330f29a7fd1ebf03ef2b639f8bc44caf5c379a
|
2017-04-26 19:54:18
|
ddfd3d9a400ae81468e9abcc89fe690c30b7ec7f
|
diff --git a/cmd2.py b/cmd2.py
index d14c36f8..e2201632 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -618,7 +618,7 @@ class Cmd(cmd.Cmd):
for editor in ['vim', 'vi', 'emacs', 'nano', 'pico', 'gedit', 'kate', 'subl', 'geany', 'atom']:
if _which(editor):
break
- feedback_to_output = False # Do include nonessentials in >, | output
+ feedback_to_output = True # Do include nonessentials in >, | output
locals_in_py = True
quiet = False # Do not suppress nonessential output
timing = False # Prints elapsed time for each command
@@ -1691,7 +1691,7 @@ Script should contain one command per line, just like command would be typed in
:param callargs: List[str] - list of transcript test file names
"""
class TestMyAppCase(Cmd2TestCase):
- CmdApp = self.__class__
+ cmdapp = self
self.__class__.testfiles = callargs
sys.argv = [sys.argv[0]] # the --test argument upsets unittest.main()
@@ -1731,12 +1731,12 @@ Script should contain one command per line, just like command would be typed in
if callopts.test:
self._transcript_files = callargs
+ # Always run the preloop first
+ self.preloop()
+
if self._transcript_files is not None:
self.run_transcript_tests(self._transcript_files)
else:
- # Always run the preloop first
- self.preloop()
-
# If an intro was supplied in the method call, allow it to override the default
if intro is not None:
self.intro = intro
@@ -1754,8 +1754,8 @@ Script should contain one command per line, just like command would be typed in
if not stop:
self._cmdloop()
- # Run the postloop() no matter what
- self.postloop()
+ # Run the postloop() no matter what
+ self.postloop()
class HistoryItem(str):
@@ -1960,25 +1960,11 @@ class Statekeeper(object):
setattr(self.obj, attrib, getattr(self, attrib))
-class Borg(object):
- """All instances of any Borg subclass will share state.
- from Python Cookbook, 2nd Ed., recipe 6.16"""
- _shared_state = {}
-
- def __new__(cls, *a, **k):
- obj = object.__new__(cls)
- obj.__dict__ = cls._shared_state
- return obj
-
-
-class OutputTrap(Borg):
- """Instantiate an OutputTrap to divert/capture ALL stdout output. For use in unit testing.
- Call `tearDown()` to return to normal output."""
+class OutputTrap(object):
+ """Instantiate an OutputTrap to divert/capture ALL stdout output. For use in transcript testing."""
def __init__(self):
self.contents = ''
- self.old_stdout = sys.stdout
- sys.stdout = self
def write(self, txt):
"""Add text to the internal contents.
@@ -1996,17 +1982,12 @@ class OutputTrap(Borg):
self.contents = ''
return result
- def tear_down(self):
- """Restores normal output."""
- sys.stdout = self.old_stdout
- self.contents = ''
-
class Cmd2TestCase(unittest.TestCase):
"""Subclass this, setting CmdApp, to make a unittest.TestCase class
that will execute the commands in a transcript file and expect the results shown.
See example.py"""
- CmdApp = None
+ cmdapp = None
regexPattern = pyparsing.QuotedString(quoteChar=r'/', escChar='\\', multiline=True, unquoteResults=True)
regexPattern.ignore(pyparsing.cStyleComment)
notRegexPattern = pyparsing.Word(pyparsing.printables)
@@ -2016,7 +1997,7 @@ class Cmd2TestCase(unittest.TestCase):
def fetchTranscripts(self):
self.transcripts = {}
- for fileset in self.CmdApp.testfiles:
+ for fileset in self.cmdapp.testfiles:
for fname in glob.glob(fileset):
tfile = open(fname)
self.transcripts[fname] = iter(tfile.readlines())
@@ -2025,17 +2006,15 @@ class Cmd2TestCase(unittest.TestCase):
raise Exception("No test files found - nothing to test.")
def setUp(self):
- if self.CmdApp:
- self.outputTrap = OutputTrap()
- self.cmdapp = self.CmdApp()
+ if self.cmdapp:
self.fetchTranscripts()
- # Make sure any required initialization gets done and flush the output buffer
- self.cmdapp.preloop()
- self.outputTrap.read()
+ # Trap stdout
+ self._orig_stdout = self.cmdapp.stdout
+ self.cmdapp.stdout = OutputTrap()
def runTest(self): # was testall
- if self.CmdApp:
+ if self.cmdapp:
its = sorted(self.transcripts.items())
for (fname, transcript) in its:
self._test_transcript(fname, transcript)
@@ -2071,7 +2050,7 @@ class Cmd2TestCase(unittest.TestCase):
# Send the command into the application and capture the resulting output
# TODO: Should we get the return value and act if stop == True?
self.cmdapp.onecmd_plus_hooks(command)
- result = self.outputTrap.read()
+ result = self.cmdapp.stdout.read()
# Read the expected result from transcript
if line.startswith(self.cmdapp.prompt):
message = '\nFile %s, line %d\nCommand was:\n%r\nExpected: (nothing)\nGot:\n%r\n' % \
@@ -2098,11 +2077,9 @@ class Cmd2TestCase(unittest.TestCase):
self.assertTrue(re.match(expected, result, re.MULTILINE | re.DOTALL), message)
def tearDown(self):
- if self.CmdApp:
- # Make sure any required cleanup gets done
- self.cmdapp.postloop()
-
- self.outputTrap.tear_down()
+ if self.cmdapp:
+ # Restore stdout
+ self.cmdapp.stdout = self._orig_stdout
def namedtuple_with_two_defaults(typename, field_names, default_values=('', '')):
|
Transcript tests create apparently unnecessary 2nd instance of cmd2.Cmd class
Transcript testing creates a 2nd instance of the class derived from cmd2.Cmd. This appears to be unecessary and done primarily for redirecting stdout.
This should probably be handled in a better and more efficient way which doesn't require creating a second instance.
|
python-cmd2/cmd2
|
diff --git a/tests/conftest.py b/tests/conftest.py
index 6f3131e7..b036943d 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -55,7 +55,7 @@ debug: False
default_file_name: command.txt
echo: False
editor: vim
-feedback_to_output: False
+feedback_to_output: True
locals_in_py: True
prompt: (Cmd)
quiet: False
@@ -75,7 +75,7 @@ debug: False # Show full error stack on error
default_file_name: command.txt # for ``save``, ``load``, etc.
echo: False # Echo command issued into output
editor: vim # Program used by ``edit``
-feedback_to_output: False # include nonessentials in `|`, `>` results
+feedback_to_output: True # include nonessentials in `|`, `>` results
locals_in_py: True # Allow access to your application in py via self
prompt: (Cmd) # The prompt issued to solicit input
quiet: False # Don't print nonessential feedback
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 99409d46..10ae4329 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -266,16 +266,15 @@ _relative_load {}
assert out == expected
-def test_base_save(base_app, capsys):
+def test_base_save(base_app):
# TODO: Use a temporary directory for the file
filename = 'deleteme.txt'
run_cmd(base_app, 'help')
run_cmd(base_app, 'help save')
# Test the * form of save which saves all commands from history
- run_cmd(base_app, 'save * {}'.format(filename))
- out, err = capsys.readouterr()
- assert out == 'Saved to {}\n'.format(filename)
+ out = run_cmd(base_app, 'save * {}'.format(filename))
+ assert out == normalize('Saved to {}\n'.format(filename))
expected = normalize("""
help
@@ -288,18 +287,16 @@ save * deleteme.txt
assert content == expected
# Test the N form of save which saves a numbered command from history
- run_cmd(base_app, 'save 1 {}'.format(filename))
- out, err = capsys.readouterr()
- assert out == 'Saved to {}\n'.format(filename)
+ out = run_cmd(base_app, 'save 1 {}'.format(filename))
+ assert out == normalize('Saved to {}\n'.format(filename))
expected = normalize('help')
with open(filename) as f:
content = normalize(f.read())
assert content == expected
# Test the blank form of save which saves the most recent command from history
- run_cmd(base_app, 'save {}'.format(filename))
- out, err = capsys.readouterr()
- assert out == 'Saved to {}\n'.format(filename)
+ out = run_cmd(base_app, 'save {}'.format(filename))
+ assert out == normalize('Saved to {}\n'.format(filename))
expected = normalize('save 1 {}'.format(filename))
with open(filename) as f:
content = normalize(f.read())
@@ -397,6 +394,7 @@ def test_send_to_paste_buffer(base_app):
def test_base_timing(base_app, capsys):
+ base_app.feedback_to_output = False
out = run_cmd(base_app, 'set timing True')
expected = normalize("""timing - was: False
now: True
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index 89f2ea7c..6049119f 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -149,6 +149,7 @@ set maxrepeats 5
-------------------------[6]
say -ps --repeat=5 goodnight, Gracie
(Cmd) run 4
+say -ps --repeat=5 goodnight, Gracie
OODNIGHT, GRACIEGAY
OODNIGHT, GRACIEGAY
OODNIGHT, GRACIEGAY
diff --git a/tests/transcript_regex.txt b/tests/transcript_regex.txt
index b8e0e654..a44870e9 100644
--- a/tests/transcript_regex.txt
+++ b/tests/transcript_regex.txt
@@ -10,7 +10,7 @@ debug: False
default_file_name: command.txt
echo: False
editor: /([^\s]+)/
-feedback_to_output: False
+feedback_to_output: True
locals_in_py: True
maxrepeats: 3
prompt: (Cmd)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 1
}
|
0.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/python-cmd2/cmd2.git@90330f29a7fd1ebf03ef2b639f8bc44caf5c379a#egg=cmd2
exceptiongroup==1.2.2
iniconfig==2.1.0
mock==5.2.0
packaging==24.2
pluggy==1.5.0
pyparsing==3.2.3
pytest==8.3.5
six==1.17.0
tomli==2.2.1
|
name: cmd2
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- exceptiongroup==1.2.2
- iniconfig==2.1.0
- mock==5.2.0
- packaging==24.2
- pluggy==1.5.0
- pyparsing==3.2.3
- pytest==8.3.5
- six==1.17.0
- tomli==2.2.1
prefix: /opt/conda/envs/cmd2
|
[
"tests/test_cmd2.py::test_base_show",
"tests/test_cmd2.py::test_base_show_long",
"tests/test_cmd2.py::test_base_save",
"tests/test_transcript.py::test_base_with_transcript",
"tests/test_transcript.py::test_regex_transcript"
] |
[
"tests/test_cmd2.py::test_output_redirection"
] |
[
"tests/test_cmd2.py::test_ver",
"tests/test_cmd2.py::test_base_help",
"tests/test_cmd2.py::test_base_help_history",
"tests/test_cmd2.py::test_base_shortcuts",
"tests/test_cmd2.py::test_base_set",
"tests/test_cmd2.py::test_base_set_not_supported",
"tests/test_cmd2.py::test_base_shell",
"tests/test_cmd2.py::test_base_py",
"tests/test_cmd2.py::test_base_run_python_script",
"tests/test_cmd2.py::test_base_error",
"tests/test_cmd2.py::test_base_history",
"tests/test_cmd2.py::test_base_list",
"tests/test_cmd2.py::test_list_with_string_argument",
"tests/test_cmd2.py::test_list_with_integer_argument",
"tests/test_cmd2.py::test_list_with_integer_span",
"tests/test_cmd2.py::test_base_cmdenvironment",
"tests/test_cmd2.py::test_base_load",
"tests/test_cmd2.py::test_base_load_default_file",
"tests/test_cmd2.py::test_base_relative_load",
"tests/test_cmd2.py::test_allow_redirection",
"tests/test_cmd2.py::test_input_redirection",
"tests/test_cmd2.py::test_pipe_to_shell",
"tests/test_cmd2.py::test_send_to_paste_buffer",
"tests/test_cmd2.py::test_base_timing",
"tests/test_cmd2.py::test_base_debug",
"tests/test_cmd2.py::test_base_colorize",
"tests/test_cmd2.py::test_edit_no_editor",
"tests/test_cmd2.py::test_edit_file",
"tests/test_cmd2.py::test_edit_number",
"tests/test_cmd2.py::test_edit_blank",
"tests/test_cmd2.py::test_base_py_interactive",
"tests/test_cmd2.py::test_base_cmdloop_with_queue",
"tests/test_cmd2.py::test_base_cmdloop_without_queue",
"tests/test_cmd2.py::test_cmdloop_without_rawinput",
"tests/test_transcript.py::Cmd2TestCase::runTest",
"tests/test_transcript.py::TestMyAppCase::runTest",
"tests/test_transcript.py::test_optparser",
"tests/test_transcript.py::test_optparser_nosuchoption",
"tests/test_transcript.py::test_comment_stripping",
"tests/test_transcript.py::test_optarser_correct_args_with_quotes_and_midline_options",
"tests/test_transcript.py::test_optarser_options_with_spaces_in_quotes",
"tests/test_transcript.py::test_commands_at_invocation",
"tests/test_transcript.py::test_select_options",
"tests/test_transcript.py::test_transcript_from_cmdloop",
"tests/test_transcript.py::test_multiline_command_transcript_with_comments_at_beginning",
"tests/test_transcript.py::test_invalid_syntax"
] |
[] |
MIT License
| 1,214 |
|
google__mobly-194
|
5960e218c4006d8b7681ffe9698cbef160ad112f
|
2017-04-28 05:46:23
|
5960e218c4006d8b7681ffe9698cbef160ad112f
|
adorokhine:
Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.
---
*[mobly/controllers/android_device.py, line 762 at r1](https://reviewable.io:443/reviews/google/mobly/194#-Kin5wTIpvyhcpSOfSyt:-Kin5wTJNBtMJIyFu1bh:b-twcozc) ([raw file](https://github.com/google/mobly/blob/7d4fb4ef105e2e00a9657f4c9dc45c4dc953a501/mobly/controllers/android_device.py#L762)):*
> ```Python
> extra_params = self.adb_logcat_param
> except AttributeError:
> extra_params = '-b main -b crash -b system -b radio'
> ```
Are we leaving out 'events' on purpose?
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)*
<!-- Sent from Reviewable.io -->
xpconanfan:
Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.
---
*[mobly/controllers/android_device.py, line 762 at r1](https://reviewable.io:443/reviews/google/mobly/194#-Kin5wTIpvyhcpSOfSyt:-KinHEozjaAsJESifOf6:bjhi5gh) ([raw file](https://github.com/google/mobly/blob/7d4fb4ef105e2e00a9657f4c9dc45c4dc953a501/mobly/controllers/android_device.py#L762)):*
<details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote>
Are we leaving out 'events' on purpose?
</blockquote></details>
I just realized that `-b radio` will not work for tablets...
Perhaps we should drop the custom '-b' values for good and use default?...
But that means all internal users would need to supply `-b radio` to get radio logs...
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)*
<!-- Sent from Reviewable.io -->
adorokhine:
Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions.
---
*[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-Kj5Th6VbQv3k2tRBlhx:b-2ypkyj) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):*
> ```Python
> try:
> process = utils.start_standing_subprocess(
> cmd, check_health_delay=0.1, shell=True)
> ```
Instead of assuming 100ms is enough for logcat to start up on a potentially overloaded machine and potentially slow phone, and dropping all log buffers, is there a way to detect which buffers are available so we can solve both problems? Does it perhaps show up in logcat --help?
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)*
<!-- Sent from Reviewable.io -->
xpconanfan:
Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions.
---
*[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-Kj5UlCJxa19whyjUC1-:b-2w7mwb) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):*
<details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote>
Instead of assuming 100ms is enough for logcat to start up on a potentially overloaded machine and potentially slow phone, and dropping all log buffers, is there a way to detect which buffers are available so we can solve both problems? Does it perhaps show up in logcat --help?
</blockquote></details>
there is no reliable way.
parsing the help menu is not reliable bc each manufacturer may have different text for it.
We don't need to wait for logcat to start up though, the wait is to make sure the process didn't die.
Or could you think of other ways.
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)*
<!-- Sent from Reviewable.io -->
adorokhine:
Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions.
---
*[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-Kj5VWTp0QWe-4A_lrD3:bwaslzj) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):*
<details><summary><i>Previously, xpconanfan (Ang Li) wrote…</i></summary><blockquote>
there is no reliable way.
parsing the help menu is not reliable bc each manufacturer may have different text for it.
We don't need to wait for logcat to start up though, the wait is to make sure the process didn't die.
Or could you think of other ways.
</blockquote></details>
Can we add the buffers to the `logcat -c` call and wait for it to complete? According to the documentation, `logcat -c` takes the same set of buffers so it should be possible to use its success as a gauge for what buffers are supported right?
https://developer.android.com/studio/command-line/logcat.html
I want to get away from time-based checks.
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)*
<!-- Sent from Reviewable.io -->
xpconanfan:
Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions.
---
*[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-Kj5X8lbdIYnw5sMxRDw:b-u395ce) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):*
<details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote>
Can we add the buffers to the `logcat -c` call and wait for it to complete? According to the documentation, `logcat -c` takes the same set of buffers so it should be possible to use its success as a gauge for what buffers are supported right?
https://developer.android.com/studio/command-line/logcat.html
I want to get away from time-based checks.
</blockquote></details>
We actually can't bc the failure does not cause ret code to be non-zero........
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)*
<!-- Sent from Reviewable.io -->
adorokhine:
Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions.
---
*[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-Kj6-Y3nqYU7kijXUXdC:beebema) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):*
<details><summary><i>Previously, xpconanfan (Ang Li) wrote…</i></summary><blockquote>
We actually can't bc the failure does not cause ret code to be non-zero........
</blockquote></details>
What does it print in the correct and incorrect case? Anything we can key off of? I really want to move away from blanket catching all errors and doing something else. In my experience, especially when it comes to Android, the thing you "expect" went wrong is actually totally unrelated to what actually went wrong. :)
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)*
<!-- Sent from Reviewable.io -->
xpconanfan:
Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions.
---
*[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-Kj9LLZZp_DzFKO9mzNl:b-7n246i) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):*
<details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote>
What does it print in the correct and incorrect case? Anything we can key off of? I really want to move away from blanket catching all errors and doing something else. In my experience, especially when it comes to Android, the thing you "expect" went wrong is actually totally unrelated to what actually went wrong. :)
</blockquote></details>
It prints the help menu, which we shouldn't really rely on.
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)*
<!-- Sent from Reviewable.io -->
adorokhine:
Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions.
---
*[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-KjA1vWp7SbQlXNZHUPd:basxykf) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):*
<details><summary><i>Previously, xpconanfan (Ang Li) wrote…</i></summary><blockquote>
It prints the help menu, which we shouldn't really rely on.
</blockquote></details>
And what does it print if it does work correctly?
My concern with this approach is twofold:
a) 100ms is not necessarily enough time to make sure logcat started on an arbitrarily slow system and phone; recall our unit test flake
b) we shouldn't blanket catching all errors and assuming the cause was anything in particular without some type of validation. I've seen cases already where our blanket catch was squashing exceptions for the wrong reason.
So I would like to find something we can do to make sure the issue is what we think it is. I would much rather have a solution that works 100% of the time on 90% of the phones (because we can always improve the check) than a solution that works 90% of the time on 100% of the phones (because people will abandon our framework).
If there's absolutely no way to do this automatically we could just use `-b all` by default and expose a config param to completely override it; let people manage it manually in case they have a non-compliant phone.
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)*
<!-- Sent from Reviewable.io -->
xpconanfan:
Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions.
---
*[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-KjA36Jgtf8-r1sqc9C5:b-w4xiel) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):*
<details><summary><i>Previously, adorokhine (Alexander Dorokhine) wrote…</i></summary><blockquote>
And what does it print if it does work correctly?
My concern with this approach is twofold:
a) 100ms is not necessarily enough time to make sure logcat started on an arbitrarily slow system and phone; recall our unit test flake
b) we shouldn't blanket catching all errors and assuming the cause was anything in particular without some type of validation. I've seen cases already where our blanket catch was squashing exceptions for the wrong reason.
So I would like to find something we can do to make sure the issue is what we think it is. I would much rather have a solution that works 100% of the time on 90% of the phones (because we can always improve the check) than a solution that works 90% of the time on 100% of the phones (because people will abandon our framework).
If there's absolutely no way to do this automatically we could just use `-b all` by default and expose a config param to completely override it; let people manage it manually in case they have a non-compliant phone.
</blockquote></details>
It doesn't print anything on my phone if it works fine, but this is no guarantee that it won't print on other NBU devices.
Maybe we should not use '-b all' as a default in the first place.
If somebody has a special need for extra buffer like 'radio', they should use the param option to enable radio buffer collection.
For the default behavior, the default logcat option should be used, which is to not pass '-b' at all.
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)*
<!-- Sent from Reviewable.io -->
adorokhine:
Review status: 0 of 2 files reviewed at latest revision, 2 unresolved discussions.
---
*[mobly/controllers/android_device.py, line 769 at r2](https://reviewable.io:443/reviews/google/mobly/194#-Kj5Th6VbQv3k2tRBlhw:-KjA4yUN5r_m01yPfUdZ:b9lhgqa) ([raw file](https://github.com/google/mobly/blob/f348704d60b0f72ce656b0376e3feaceaa03284a/mobly/controllers/android_device.py#L769)):*
<details><summary><i>Previously, xpconanfan (Ang Li) wrote…</i></summary><blockquote>
It doesn't print anything on my phone if it works fine, but this is no guarantee that it won't print on other NBU devices.
Maybe we should not use '-b all' as a default in the first place.
If somebody has a special need for extra buffer like 'radio', they should use the param option to enable radio buffer collection.
For the default behavior, the default logcat option should be used, which is to not pass '-b' at all.
</blockquote></details>
Sure, default logcat settings unless manually overridden sgtm as long as it's ok by David.
---
*Comments from [Reviewable](https://reviewable.io:443/reviews/google/mobly/194)*
<!-- Sent from Reviewable.io -->
|
diff --git a/docs/tutorial.md b/docs/tutorial.md
index 67f66b0..2c64dae 100644
--- a/docs/tutorial.md
+++ b/docs/tutorial.md
@@ -9,18 +9,13 @@ various devices and you can also use your own custom hardware/equipment.
* A computer with at least 2 USB ports.
* Mobly package and its system dependencies installed on the computer.
-* One or two Android devices with the app SL4A* installed.
+* One or two Android devices with the [Mobly Bundled Snippets]
+ (https://github.com/google/mobly-bundled-snippets) (MBS) installed. We will
+ use MBS to trigger actions on the Android devices.
* A working adb setup. To check, connect one Android device to the computer
and make sure it has "USB debugging" enabled. Make sure the device shows up
in the list printed by `adb devices`.
-\* You can get SL4A from the
-[Android repo](https://source.android.com/source/downloading.html), under
-project `<aosp>/external/sl4a`
-
-It can be built like a regular system app with `mm` commands. It needs to be
-signed with the build you use on your Android devices.
-
# Example 1: Hello World!
Let's start with the simple example of posting "Hello World" on the Android
@@ -51,10 +46,11 @@ class HelloWorldTest(base_test.BaseTestClass):
# object is created from this.
self.ads = self.register_controller(android_device)
self.dut = self.ads[0]
- self.dut.load_sl4a() # starts sl4a.
+ # Start Mobly Bundled Snippets (MBS).
+ self.dut.load_snippet('mbs', 'com.google.android.mobly.snippet.bundled')
def test_hello(self):
- self.dut.sl4a.makeToast('Hello World!')
+ self.dut.mbs.makeToast('Hello World!')
if __name__ == '__main__':
test_runner.main()
@@ -97,13 +93,13 @@ class HelloWorldTest(base_test.BaseTestClass):
def setup_class(self):
self.ads = self.register_controller(android_device)
self.dut = self.ads[0]
- self.dut.load_sl4a()
+ self.dut.load_snippet('mbs', 'com.google.android.mobly.snippet.bundled')
def test_hello(self):
- self.dut.sl4a.makeToast('Hello World!')
+ self.dut.mbs.makeToast('Hello World!')
def test_bye(self):
- self.dut.sl4a.makeToast('Goodbye!')
+ self.dut.mbs.makeToast('Goodbye!')
if __name__ == '__main__':
test_runner.main()
@@ -152,9 +148,9 @@ In the test script, you could access the user parameter:
def test_favorite_food(self):
food = self.user_params.get('favorite_food')
if food:
- self.dut.sl4a.makeToast("I'd like to eat %s." % food)
+ self.dut.mbs.makeToast("I'd like to eat %s." % food)
else:
- self.dut.sl4a.makeToast("I'm not hungry.")
+ self.dut.mbs.makeToast("I'm not hungry.")
```
# Example 4: Multiple Test Beds and Default Test Parameters
@@ -201,7 +197,7 @@ screen.
In this example, we use one Android device to discover another Android device
via bluetooth. This test demonstrates several essential elements in test
-writing, like logging and asserts.
+writing, like asserts, device debug tag, and general logging vs logging with device tag.
**sample_config.yml**
@@ -211,111 +207,90 @@ TestBeds:
Controllers:
AndroidDevice:
- serial: xyz,
- label: dut
+ label: target
- serial: abc,
label: discoverer
TestParams:
bluetooth_name: MagicBluetooth,
bluetooth_timeout: 5
-
-
+
```
**sample_test.py**
```python
+import logging
+import pprint
+
+from mobly import asserts
from mobly import base_test
from mobly import test_runner
-from mobly.controllerse import android_device
-
+from mobly.controllers import android_device
+
+# Number of seconds for the target to stay discoverable on Bluetooth.
+DISCOVERABLE_TIME = 60
+
+
class HelloWorldTest(base_test.BaseTestClass):
-
-
- def setup_class(self):
- # Registering android_device controller module, and declaring that the test
- # requires at least two Android devices.
- self.ads = self.register_controller(android_device, min_number=2)
- self.dut = android_device.get_device(self.ads, label='dut')
- self.dut.load_sl4a()
- self.discoverer = android_device.get_device(self.ads, label='discoverer')
- self.discoverer.load_sl4a()
- self.dut.ed.clear_all_events()
- self.discoverer.ed.clear_all_events()
-
- def setup_test(self):
- # Make sure bluetooth is on
- self.dut.sl4a.bluetoothToggleState(True)
- self.discoverer.sl4a.bluetoothToggleState(True)
- self.dut.ed.pop_event(event_name='BluetoothStateChangedOn',
- timeout=10)
- self.discoverer.ed.pop_event(event_name='BluetoothStateChangedOn',
- timeout=10)
- if (not self.dut.sl4a.bluetoothCheckState() or
- not self.discoverer.sl4a.bluetoothCheckState()):
- asserts.abort_class('Could not turn on Bluetooth on both devices.')
-
- # Set the name of device #1 and verify the name properly registered.
- self.dut.sl4a.bluetoothSetLocalName(self.bluetooth_name)
- asserts.assert_equal(self.dut.sl4a.bluetoothGetLocalName(),
- self.bluetooth_name,
- 'Failed to set bluetooth name to %s on %s' %
- (self.bluetooth_name, self.dut.serial))
-
- def test_bluetooth_discovery(self):
- # Make dut discoverable.
- self.dut.sl4a.bluetoothMakeDiscoverable()
- scan_mode = self.dut.sl4a.bluetoothGetScanMode()
- asserts.assert_equal(
- scan_mode, 3, # 3 signifies CONNECTABLE and DISCOVERABLE
- 'Android device %s failed to make blueooth discoverable.' %
- self.dut.serial)
-
- # Start the discovery process on #discoverer.
- self.discoverer.ed.clear_all_events()
- self.discoverer.sl4a.bluetoothStartDiscovery()
- self.discoverer.ed.pop_event(
- event_name='BluetoothDiscoveryFinished',
- timeout=self.bluetooth_timeout)
-
- # The following log entry demonstrates AndroidDevice log object, which
- # prefixes log entries with "[AndroidDevice|<serial>] "
- self.discoverer.log.info('Discovering other bluetooth devices.')
-
- # Get a list of discovered devices
- discovered_devices = self.discoverer.sl4a.bluetoothGetDiscoveredDevices()
- self.discoverer.log.info('Found devices: %s', discovered_devices)
- matching_devices = [d for d in discovered_devices
- if d.get('name') == self.bluetooth_name]
- if not matching_devices:
- asserts.fail('Android device %s did not discover %s.' %
- (self.discoverer.serial, self.dut.serial))
- self.discoverer.log.info('Discovered at least 1 device named '
- '%s: %s', self.bluetooth_name, matching_devices)
-
+ def setup_class(self):
+ # Registering android_device controller module, and declaring that the test
+ # requires at least two Android devices.
+ self.ads = self.register_controller(android_device, min_number=2)
+ # The device used to discover Bluetooth devices.
+ self.discoverer = android_device.get_device(
+ self.ads, label='discoverer')
+ # Sets the tag that represents this device in logs.
+ self.discoverer.debug_tag = 'discoverer'
+ # The device that is expected to be discovered
+ self.target = android_device.get_device(self.ads, label='target')
+ self.target.debug_tag = 'target'
+ self.target.load_snippet('mbs',
+ 'com.google.android.mobly.snippet.bundled')
+ self.discoverer.load_snippet(
+ 'mbs', 'com.google.android.mobly.snippet.bundled')
+
+ def setup_test(self):
+ # Make sure bluetooth is on.
+ self.target.mbs.btEnable()
+ self.discoverer.mbs.btEnable()
+ # Set Bluetooth name on target device.
+ self.target.mbs.btSetName('LookForMe!')
+
+ def test_bluetooth_discovery(self):
+ target_name = self.target.mbs.btGetName()
+ self.target.log.info('Become discoverable with name "%s" for %ds.',
+ target_name, DISCOVERABLE_TIME)
+ self.target.mbs.btBecomeDiscoverable(DISCOVERABLE_TIME)
+ self.discoverer.log.info('Looking for Bluetooth devices.')
+ discovered_devices = self.discoverer.mbs.btDiscoverAndGetResults()
+ self.discoverer.log.debug('Found Bluetooth devices: %s',
+ pprint.pformat(discovered_devices, indent=2))
+ discovered_names = [device['Name'] for device in discovered_devices]
+ logging.info('Verifying the target is discovered by the discoverer.')
+ asserts.assert_true(
+ target_name in discovered_names,
+ 'Failed to discover the target device %s over Bluetooth.' %
+ target_name)
+
+ def teardown_test(self):
+ # Turn Bluetooth off on both devices after test finishes.
+ self.target.mbs.btDisable()
+ self.discoverer.mbs.btDisable()
+
+
if __name__ == '__main__':
- test_runner.main()
+ test_runner.main()
+
```
-
-One will notice that this is not the most robust test (another nearby device
-could be using the same name), but in the interest of simplicity, we've limited
-the number of RPCs sent to each Android device to just two:
-
-* For `self.dut`, we asked it to make itself discoverable and checked that it
- did it.
-* For `self.discoverer`, we asked it to start scanning for nearby bluetooth
- devices, and then we pulled the list of devices seen.
-
-There's potentially a lot more we could do to write a thorough test (e.g., check
-the hardware address, see whether we can pair devices, transfer files, etc.).
-
-# Event Dispatcher
-
-You'll notice above that we've used `self.{device_alias}.ed.pop_event()`. The
-`ed` attribute of an Android device object is an EventDispatcher, which provides
-APIs to interact with async events.
-
-For example, `pop_event` is a function which will block until either a
-specified event is seen or the call times out, and by using it we avoid the use
-of busy loops that constantly check the device state. For more, see the APIs in
-`mobly.controllers.android_device_lib.event_dispatcher`.
+
+There's potentially a lot more we could do in this test, e.g. check
+the hardware address, see whether we can pair devices, transfer files, etc.
+
+To learn more about the features included in MBS, go to [MBS repo]
+(https://github.com/google/mobly-bundled-snippets) to see how to check its help
+menu.
+
+To learn more about Mobly Snippet Lib, including features like Espresso support
+and asynchronous calls, see the [snippet lib examples]
+(https://github.com/google/mobly-snippet-lib/tree/master/examples).
diff --git a/mobly/controllers/android_device.py b/mobly/controllers/android_device.py
index 159f587..a77e787 100644
--- a/mobly/controllers/android_device.py
+++ b/mobly/controllers/android_device.py
@@ -350,7 +350,7 @@ class AndroidDevice(object):
android device should be stored.
log: A logger adapted from root logger with an added prefix specific
to an AndroidDevice instance. The default prefix is
- [AndroidDevice|<serial>]. Use self.set_debug_tag to use a
+ [AndroidDevice|<serial>]. Use self.debug_tag = 'tag' to use a
different tag in the prefix.
adb_logcat_file_path: A string that's the full path to the adb logcat
file collected, if any.
@@ -408,6 +408,7 @@ class AndroidDevice(object):
The tag can be customized with `ad.debug_tag = 'Caller'`:
'INFO [AndroidDevice|Caller] One pending call ringing.'
"""
+ self.log.info('Logging debug tag set to "%s"', tag)
self._debug_tag = tag
self.log.extra['tag'] = tag
@@ -759,11 +760,11 @@ class AndroidDevice(object):
try:
extra_params = self.adb_logcat_param
except AttributeError:
- extra_params = '-b all'
+ extra_params = ''
cmd = 'adb -s %s logcat -v threadtime %s >> %s' % (
self.serial, extra_params, logcat_file_path)
- self._adb_logcat_process = utils.start_standing_subprocess(
- cmd, shell=True)
+ process = utils.start_standing_subprocess(cmd, shell=True)
+ self._adb_logcat_process = process
self.adb_logcat_file_path = logcat_file_path
def stop_adb_logcat(self):
|
logcat is empty for some NBU devices
When starting adb logcat, we use `-b all` to catch all buffers.
But some NBU devices (like HTC Desire 526g+) don't have the buffer option "all", and their adb logcat would only have one line saying "Unable to open log device '/dev/log/all': No such file or directory".
We need to handle this properly so we get the logs from the buffers the device does have, like 'main', 'system', 'radio', and 'events'.
|
google/mobly
|
diff --git a/tests/mobly/controllers/android_device_test.py b/tests/mobly/controllers/android_device_test.py
index 136bbba..b1cd7fe 100755
--- a/tests/mobly/controllers/android_device_test.py
+++ b/tests/mobly/controllers/android_device_test.py
@@ -280,7 +280,7 @@ class AndroidDeviceTest(unittest.TestCase):
"AndroidDevice%s" % ad.serial,
"adblog,fakemodel,%s.txt" % ad.serial)
creat_dir_mock.assert_called_with(os.path.dirname(expected_log_path))
- adb_cmd = 'adb -s %s logcat -v threadtime -b all >> %s'
+ adb_cmd = 'adb -s %s logcat -v threadtime >> %s'
start_proc_mock.assert_called_with(
adb_cmd % (ad.serial, expected_log_path), shell=True)
self.assertEqual(ad.adb_logcat_file_path, expected_log_path)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 2
}
|
1.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
future==1.0.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
-e git+https://github.com/google/mobly.git@5960e218c4006d8b7681ffe9698cbef160ad112f#egg=mobly
mock==1.0.1
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
portpicker==1.6.0
psutil==7.0.0
pytest @ file:///croot/pytest_1738938843180/work
pytz==2025.2
PyYAML==6.0.2
timeout-decorator==0.5.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
|
name: mobly
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- future==1.0.0
- mock==1.0.1
- portpicker==1.6.0
- psutil==7.0.0
- pytz==2025.2
- pyyaml==6.0.2
- timeout-decorator==0.5.0
prefix: /opt/conda/envs/mobly
|
[
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_logcat"
] |
[] |
[
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_build_info",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_cat_adb_log",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_debug_tag",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_instantiation",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet_dup_attribute_name",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet_dup_package",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_load_snippet_dup_snippet_name",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_snippet_cleanup",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_bug_report",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_bug_report_fail",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_bug_report_fallback",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_AndroidDevice_take_logcat_with_user_param",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_dict_list",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_empty_config",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_no_valid_config",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_not_list_config",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_pickup_all",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_create_with_string_list",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_no_match",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_success_with_serial",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_success_with_serial_and_extra_field",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_get_device_too_many_matches",
"tests/mobly/controllers/android_device_test.py::AndroidDeviceTest::test_start_services_on_ads"
] |
[] |
Apache License 2.0
| 1,216 |
dask__dask-2274
|
c136b9dde885ba35dde85ba84afe2ad03c20e32d
|
2017-04-28 19:24:50
|
bdb021c7dcd94ae1fa51c82fae6cf4cf7319aa14
|
diff --git a/dask/array/core.py b/dask/array/core.py
index 9bf4edb3e..83c5160b4 100644
--- a/dask/array/core.py
+++ b/dask/array/core.py
@@ -514,7 +514,8 @@ def map_blocks(func, *args, **kwargs):
drop_axis : number or iterable, optional
Dimensions lost by the function.
new_axis : number or iterable, optional
- New dimensions created by the function.
+ New dimensions created by the function. Note that these are applied
+ after ``drop_axis`` (if present).
name : string, optional
The key name to use for the array. If not provided, will be determined
by a hash of the arguments.
@@ -611,9 +612,6 @@ def map_blocks(func, *args, **kwargs):
if isinstance(new_axis, Number):
new_axis = [new_axis]
- if drop_axis and new_axis:
- raise ValueError("Can't specify drop_axis and new_axis together")
-
arrs = [a for a in args if isinstance(a, Array)]
other = [(i, a) for i, a in enumerate(args) if not isinstance(a, Array)]
@@ -666,15 +664,22 @@ def map_blocks(func, *args, **kwargs):
if i - 1 not in drop_axis), v)
for k, v in dsk.items())
numblocks = [n for i, n in enumerate(numblocks) if i not in drop_axis]
- elif new_axis:
+ if new_axis:
+ new_axis = sorted(new_axis)
+ for i in new_axis:
+ if not 0 <= i <= len(numblocks):
+ ndim = len(numblocks)
+ raise ValueError("Can't add axis %d when current "
+ "axis are %r. Missing axis: "
+ "%r" % (i, list(range(ndim)),
+ list(range(ndim, i))))
+ numblocks.insert(i, 1)
dsk, old_dsk = dict(), dsk
for key in old_dsk:
new_key = list(key)
for i in new_axis:
new_key.insert(i + 1, 0)
dsk[tuple(new_key)] = old_dsk[key]
- for i in sorted(new_axis):
- numblocks.insert(i, 1)
if chunks:
if len(chunks) != len(numblocks):
@@ -702,7 +707,7 @@ def map_blocks(func, *args, **kwargs):
"`chunks` kwarg.")
if drop_axis:
chunks2 = [c for (i, c) in enumerate(chunks2) if i not in drop_axis]
- elif new_axis:
+ if new_axis:
for i in sorted(new_axis):
chunks2.insert(i, (1,))
@@ -2255,6 +2260,9 @@ def stack(seq, axis=0):
uc_args = list(concat((x, ind) for x in seq))
_, seq = unify_chunks(*uc_args)
+ dt = reduce(np.promote_types, [a.dtype for a in seq])
+ seq = [x.astype(dt) for x in seq]
+
assert len(set(a.chunks for a in seq)) == 1 # same chunks
chunks = (seq[0].chunks[:axis] + ((1,) * n,) + seq[0].chunks[axis:])
@@ -2271,8 +2279,6 @@ def stack(seq, axis=0):
dsk = dict(zip(keys, values))
dsk2 = sharedict.merge((name, dsk), *[a.dask for a in seq])
- dt = reduce(np.promote_types, [a.dtype for a in seq])
-
return Array(dsk2, name, chunks, dtype=dt)
|
da.stack dtype
Greetings dask dudes,
I'm using `dask` version `0.14.1`
I stumbled across the following behaviour with respect to the `dtype` of a **computed** `stack`, and I was curious as to whether it is as expected:
First, create some data ...
```python
import dask.array as da
import numpy as np
# integer
i = np.array(np.arange(3), dtype='i4')
# float
f = np.array(np.arange(3), dtype='f4')
di = da.from_array(i, chunks=i.shape)
df = da.from_array(f, chunks=f.shape)
```
Now, `stack` the arrays in alternate orders ...
```python
didf = da.stack([di, df], axis=0)
dfdi = da.stack([df, di], axis=0)
```
And show the results, paying attention to the lazy `dtype` and the computed `dtype` ...
```python
print(didf)
print(dfdi)
print(didf.compute().dtype)
print(dfdi.compute().dtype)
```
Yields ...
```python
dask.array<stack, shape=(2, 3), dtype=float64, chunksize=(1, 3)>
dask.array<stack, shape=(2, 3), dtype=float64, chunksize=(1, 3)>
int32
float32
```
Comparing this with `concatenate`, we see a different result, but a result I would expect ...
```python
didf = da.concatenate([di, df], axis=0)
dfdi = da.concatenate([df, di], axis=0)
print(didf)
print(dfdi)
print(didf.compute().dtype)
print(dfdi.compute().dtype)
```
Yields ...
```python
dask.array<concatenate, shape=(6,), dtype=float64, chunksize=(3,)>
dask.array<concatenate, shape=(6,), dtype=float64, chunksize=(3,)>
float64
float64
```
Is this non-symmetric `dtype` behaviour of `stack` as you would expect?
Many thanks!
|
dask/dask
|
diff --git a/dask/array/tests/test_array_core.py b/dask/array/tests/test_array_core.py
index b31efda9f..8feff88cb 100644
--- a/dask/array/tests/test_array_core.py
+++ b/dask/array/tests/test_array_core.py
@@ -277,6 +277,15 @@ def test_stack_scalars():
assert s.compute().tolist() == [np.arange(4).mean(), np.arange(4).sum()]
+def test_stack_promote_type():
+ i = np.arange(10, dtype='i4')
+ f = np.arange(10, dtype='f4')
+ di = da.from_array(i, chunks=5)
+ df = da.from_array(f, chunks=5)
+ res = da.stack([di, df])
+ assert_eq(res, np.stack([i, f]))
+
+
@pytest.mark.skipif(LooseVersion(np.__version__) < '1.10.0',
reason="NumPy doesn't yet support stack")
def test_stack_rechunk():
@@ -2106,9 +2115,9 @@ def test_map_blocks_with_changed_dimension():
with pytest.raises(ValueError):
d.map_blocks(lambda b: b.sum(axis=1), drop_axis=1, dtype=d.dtype)
- # Can't use both drop_axis and new_axis
+ # Adding axis with a gap
with pytest.raises(ValueError):
- d.map_blocks(lambda b: b, drop_axis=1, new_axis=1)
+ d.map_blocks(lambda b: b, new_axis=(3, 4))
d = da.from_array(x, chunks=(4, 8))
e = d.map_blocks(lambda b: b.sum(axis=1), drop_axis=1, dtype=d.dtype)
@@ -2127,6 +2136,19 @@ def test_map_blocks_with_changed_dimension():
assert e.chunks == ((1,), (4, 4), (4, 4), (1,))
assert_eq(e, x[None, :, :, None])
+ # Both new_axis and drop_axis
+ d = da.from_array(x, chunks=(8, 4))
+ e = d.map_blocks(lambda b: b.sum(axis=0)[:, None, None],
+ drop_axis=0, new_axis=(1, 2), dtype=d.dtype)
+ assert e.chunks == ((4, 4), (1,), (1,))
+ assert_eq(e, x.sum(axis=0)[:, None, None])
+
+ d = da.from_array(x, chunks=(4, 8))
+ e = d.map_blocks(lambda b: b.sum(axis=1)[:, None, None],
+ drop_axis=1, new_axis=(1, 2), dtype=d.dtype)
+ assert e.chunks == ((4, 4), (1,), (1,))
+ assert_eq(e, x.sum(axis=1)[:, None, None])
+
def test_broadcast_chunks():
assert broadcast_chunks(((5, 5),), ((5, 5),)) == ((5, 5),)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
1.16
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[complete]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"flake8",
"pandas_datareader"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
aiobotocore==2.1.2
aiohttp==3.8.6
aioitertools==0.11.0
aiosignal==1.2.0
async-timeout==4.0.2
asynctest==0.13.0
attrs==22.2.0
botocore==1.23.24
certifi==2021.5.30
charset-normalizer==2.0.12
click==8.0.4
cloudpickle==2.2.1
-e git+https://github.com/dask/dask.git@c136b9dde885ba35dde85ba84afe2ad03c20e32d#egg=dask
distributed==1.19.3
flake8==5.0.4
frozenlist==1.2.0
fsspec==2022.1.0
HeapDict==1.0.1
idna==3.10
idna-ssl==1.1.0
importlib-metadata==4.2.0
iniconfig==1.1.1
jmespath==0.10.0
locket==1.0.0
lxml==5.3.1
mccabe==0.7.0
msgpack-python==0.5.6
multidict==5.2.0
numpy==1.19.5
packaging==21.3
pandas==1.1.5
pandas-datareader==0.10.0
partd==1.2.0
pluggy==1.0.0
psutil==7.0.0
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
requests==2.27.1
s3fs==2022.1.0
six==1.17.0
sortedcontainers==2.4.0
tblib==1.7.0
tomli==1.2.3
toolz==0.12.0
tornado==6.1
typing_extensions==4.1.1
urllib3==1.26.20
wrapt==1.16.0
yarl==1.7.2
zict==2.1.0
zipp==3.6.0
|
name: dask
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- aiobotocore==2.1.2
- aiohttp==3.8.6
- aioitertools==0.11.0
- aiosignal==1.2.0
- async-timeout==4.0.2
- asynctest==0.13.0
- attrs==22.2.0
- botocore==1.23.24
- charset-normalizer==2.0.12
- click==8.0.4
- cloudpickle==2.2.1
- distributed==1.19.3
- flake8==5.0.4
- frozenlist==1.2.0
- fsspec==2022.1.0
- heapdict==1.0.1
- idna==3.10
- idna-ssl==1.1.0
- importlib-metadata==4.2.0
- iniconfig==1.1.1
- jmespath==0.10.0
- locket==1.0.0
- lxml==5.3.1
- mccabe==0.7.0
- msgpack-python==0.5.6
- multidict==5.2.0
- numpy==1.19.5
- packaging==21.3
- pandas==1.1.5
- pandas-datareader==0.10.0
- partd==1.2.0
- pluggy==1.0.0
- psutil==7.0.0
- py==1.11.0
- pycodestyle==2.9.1
- pyflakes==2.5.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pytz==2025.2
- requests==2.27.1
- s3fs==2022.1.0
- six==1.17.0
- sortedcontainers==2.4.0
- tblib==1.7.0
- tomli==1.2.3
- toolz==0.12.0
- tornado==6.1
- typing-extensions==4.1.1
- urllib3==1.26.20
- wrapt==1.16.0
- yarl==1.7.2
- zict==2.1.0
- zipp==3.6.0
prefix: /opt/conda/envs/dask
|
[
"dask/array/tests/test_array_core.py::test_stack_promote_type",
"dask/array/tests/test_array_core.py::test_map_blocks_with_changed_dimension"
] |
[
"dask/array/tests/test_array_core.py::test_field_access",
"dask/array/tests/test_array_core.py::test_field_access_with_shape",
"dask/array/tests/test_array_core.py::test_setitem_mixed_d"
] |
[
"dask/array/tests/test_array_core.py::test_getem",
"dask/array/tests/test_array_core.py::test_top",
"dask/array/tests/test_array_core.py::test_top_supports_broadcasting_rules",
"dask/array/tests/test_array_core.py::test_concatenate3_on_scalars",
"dask/array/tests/test_array_core.py::test_chunked_dot_product",
"dask/array/tests/test_array_core.py::test_chunked_transpose_plus_one",
"dask/array/tests/test_array_core.py::test_transpose",
"dask/array/tests/test_array_core.py::test_broadcast_dimensions_works_with_singleton_dimensions",
"dask/array/tests/test_array_core.py::test_broadcast_dimensions",
"dask/array/tests/test_array_core.py::test_Array",
"dask/array/tests/test_array_core.py::test_uneven_chunks",
"dask/array/tests/test_array_core.py::test_numblocks_suppoorts_singleton_block_dims",
"dask/array/tests/test_array_core.py::test_keys",
"dask/array/tests/test_array_core.py::test_Array_computation",
"dask/array/tests/test_array_core.py::test_stack",
"dask/array/tests/test_array_core.py::test_short_stack",
"dask/array/tests/test_array_core.py::test_stack_scalars",
"dask/array/tests/test_array_core.py::test_stack_rechunk",
"dask/array/tests/test_array_core.py::test_concatenate",
"dask/array/tests/test_array_core.py::test_concatenate_rechunk",
"dask/array/tests/test_array_core.py::test_concatenate_fixlen_strings",
"dask/array/tests/test_array_core.py::test_vstack",
"dask/array/tests/test_array_core.py::test_hstack",
"dask/array/tests/test_array_core.py::test_dstack",
"dask/array/tests/test_array_core.py::test_take",
"dask/array/tests/test_array_core.py::test_compress",
"dask/array/tests/test_array_core.py::test_binops",
"dask/array/tests/test_array_core.py::test_isnull",
"dask/array/tests/test_array_core.py::test_isclose",
"dask/array/tests/test_array_core.py::test_broadcast_shapes",
"dask/array/tests/test_array_core.py::test_elemwise_on_scalars",
"dask/array/tests/test_array_core.py::test_partial_by_order",
"dask/array/tests/test_array_core.py::test_elemwise_with_ndarrays",
"dask/array/tests/test_array_core.py::test_elemwise_differently_chunked",
"dask/array/tests/test_array_core.py::test_operators",
"dask/array/tests/test_array_core.py::test_operator_dtype_promotion",
"dask/array/tests/test_array_core.py::test_tensordot",
"dask/array/tests/test_array_core.py::test_tensordot_2[0]",
"dask/array/tests/test_array_core.py::test_tensordot_2[1]",
"dask/array/tests/test_array_core.py::test_tensordot_2[axes2]",
"dask/array/tests/test_array_core.py::test_tensordot_2[axes3]",
"dask/array/tests/test_array_core.py::test_tensordot_2[axes4]",
"dask/array/tests/test_array_core.py::test_tensordot_2[axes5]",
"dask/array/tests/test_array_core.py::test_tensordot_2[axes6]",
"dask/array/tests/test_array_core.py::test_dot_method",
"dask/array/tests/test_array_core.py::test_T",
"dask/array/tests/test_array_core.py::test_norm",
"dask/array/tests/test_array_core.py::test_choose",
"dask/array/tests/test_array_core.py::test_where",
"dask/array/tests/test_array_core.py::test_where_has_informative_error",
"dask/array/tests/test_array_core.py::test_coarsen",
"dask/array/tests/test_array_core.py::test_coarsen_with_excess",
"dask/array/tests/test_array_core.py::test_insert",
"dask/array/tests/test_array_core.py::test_multi_insert",
"dask/array/tests/test_array_core.py::test_broadcast_to",
"dask/array/tests/test_array_core.py::test_ravel",
"dask/array/tests/test_array_core.py::test_roll[None-3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[None-3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[None-7-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[None-7-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[None-9-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[None-9-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[None-shift3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[None-shift3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[None-shift4-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[None-shift4-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[0-3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[0-3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[0-7-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[0-7-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[0-9-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[0-9-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[0-shift3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[0-shift3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[0-shift4-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[0-shift4-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[1-3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[1-3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[1-7-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[1-7-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[1-9-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[1-9-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[1-shift3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[1-shift3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[1-shift4-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[1-shift4-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[-1-3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[-1-3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[-1-7-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[-1-7-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[-1-9-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[-1-9-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[-1-shift3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[-1-shift3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[-1-shift4-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[-1-shift4-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis4-3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis4-3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis4-7-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis4-7-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis4-9-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis4-9-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis4-shift3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis4-shift3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis4-shift4-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis4-shift4-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis5-3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis5-3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis5-7-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis5-7-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis5-9-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis5-9-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis5-shift3-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis5-shift3-chunks1]",
"dask/array/tests/test_array_core.py::test_roll[axis5-shift4-chunks0]",
"dask/array/tests/test_array_core.py::test_roll[axis5-shift4-chunks1]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape0-new_shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape1-new_shape1-5]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape2-new_shape2-5]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape3-new_shape3-12]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape4-new_shape4-12]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape5-new_shape5-chunks5]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape6-new_shape6-4]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape7-new_shape7-4]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape8-new_shape8-4]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape9-new_shape9-2]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape10-new_shape10-2]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape11-new_shape11-2]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape12-new_shape12-2]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape13-new_shape13-2]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape14-new_shape14-2]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape15-new_shape15-2]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape16-new_shape16-chunks16]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape17-new_shape17-3]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape18-new_shape18-4]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape19-new_shape19-chunks19]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape20-new_shape20-1]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape21-new_shape21-1]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape22-new_shape22-24]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape23-new_shape23-6]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape24-new_shape24-6]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape25-new_shape25-6]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape26-new_shape26-chunks26]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape27-new_shape27-chunks27]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape28-new_shape28-chunks28]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape29-new_shape29-chunks29]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape30-new_shape30-chunks30]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape31-new_shape31-chunks31]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape32-new_shape32-chunks32]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape33-new_shape33-chunks33]",
"dask/array/tests/test_array_core.py::test_reshape[original_shape34-new_shape34-chunks34]",
"dask/array/tests/test_array_core.py::test_reshape_exceptions",
"dask/array/tests/test_array_core.py::test_reshape_splat",
"dask/array/tests/test_array_core.py::test_reshape_fails_for_dask_only",
"dask/array/tests/test_array_core.py::test_reshape_unknown_dimensions",
"dask/array/tests/test_array_core.py::test_full",
"dask/array/tests/test_array_core.py::test_map_blocks",
"dask/array/tests/test_array_core.py::test_map_blocks2",
"dask/array/tests/test_array_core.py::test_map_blocks_with_constants",
"dask/array/tests/test_array_core.py::test_map_blocks_with_kwargs",
"dask/array/tests/test_array_core.py::test_map_blocks_with_chunks",
"dask/array/tests/test_array_core.py::test_map_blocks_dtype_inference",
"dask/array/tests/test_array_core.py::test_fromfunction",
"dask/array/tests/test_array_core.py::test_from_function_requires_block_args",
"dask/array/tests/test_array_core.py::test_repr",
"dask/array/tests/test_array_core.py::test_slicing_with_ellipsis",
"dask/array/tests/test_array_core.py::test_slicing_with_ndarray",
"dask/array/tests/test_array_core.py::test_dtype",
"dask/array/tests/test_array_core.py::test_blockdims_from_blockshape",
"dask/array/tests/test_array_core.py::test_coerce",
"dask/array/tests/test_array_core.py::test_store_delayed_target",
"dask/array/tests/test_array_core.py::test_store",
"dask/array/tests/test_array_core.py::test_store_regions",
"dask/array/tests/test_array_core.py::test_store_compute_false",
"dask/array/tests/test_array_core.py::test_store_locks",
"dask/array/tests/test_array_core.py::test_np_array_with_zero_dimensions",
"dask/array/tests/test_array_core.py::test_unique",
"dask/array/tests/test_array_core.py::test_dtype_complex",
"dask/array/tests/test_array_core.py::test_astype",
"dask/array/tests/test_array_core.py::test_arithmetic",
"dask/array/tests/test_array_core.py::test_elemwise_consistent_names",
"dask/array/tests/test_array_core.py::test_optimize",
"dask/array/tests/test_array_core.py::test_slicing_with_non_ndarrays",
"dask/array/tests/test_array_core.py::test_getarray",
"dask/array/tests/test_array_core.py::test_squeeze",
"dask/array/tests/test_array_core.py::test_size",
"dask/array/tests/test_array_core.py::test_nbytes",
"dask/array/tests/test_array_core.py::test_itemsize",
"dask/array/tests/test_array_core.py::test_Array_normalizes_dtype",
"dask/array/tests/test_array_core.py::test_from_array_with_lock",
"dask/array/tests/test_array_core.py::test_from_array_slicing_results_in_ndarray",
"dask/array/tests/test_array_core.py::test_asarray",
"dask/array/tests/test_array_core.py::test_from_func",
"dask/array/tests/test_array_core.py::test_topk",
"dask/array/tests/test_array_core.py::test_topk_k_bigger_than_chunk",
"dask/array/tests/test_array_core.py::test_bincount",
"dask/array/tests/test_array_core.py::test_bincount_with_weights",
"dask/array/tests/test_array_core.py::test_bincount_raises_informative_error_on_missing_minlength_kwarg",
"dask/array/tests/test_array_core.py::test_digitize",
"dask/array/tests/test_array_core.py::test_histogram",
"dask/array/tests/test_array_core.py::test_histogram_alternative_bins_range",
"dask/array/tests/test_array_core.py::test_histogram_return_type",
"dask/array/tests/test_array_core.py::test_histogram_extra_args_and_shapes",
"dask/array/tests/test_array_core.py::test_concatenate3_2",
"dask/array/tests/test_array_core.py::test_map_blocks3",
"dask/array/tests/test_array_core.py::test_from_array_with_missing_chunks",
"dask/array/tests/test_array_core.py::test_cache",
"dask/array/tests/test_array_core.py::test_take_dask_from_numpy",
"dask/array/tests/test_array_core.py::test_normalize_chunks",
"dask/array/tests/test_array_core.py::test_raise_on_no_chunks",
"dask/array/tests/test_array_core.py::test_chunks_is_immutable",
"dask/array/tests/test_array_core.py::test_raise_on_bad_kwargs",
"dask/array/tests/test_array_core.py::test_long_slice",
"dask/array/tests/test_array_core.py::test_ellipsis_slicing",
"dask/array/tests/test_array_core.py::test_point_slicing",
"dask/array/tests/test_array_core.py::test_point_slicing_with_full_slice",
"dask/array/tests/test_array_core.py::test_slice_with_floats",
"dask/array/tests/test_array_core.py::test_vindex_errors",
"dask/array/tests/test_array_core.py::test_vindex_merge",
"dask/array/tests/test_array_core.py::test_empty_array",
"dask/array/tests/test_array_core.py::test_array",
"dask/array/tests/test_array_core.py::test_cov",
"dask/array/tests/test_array_core.py::test_corrcoef",
"dask/array/tests/test_array_core.py::test_memmap",
"dask/array/tests/test_array_core.py::test_to_npy_stack",
"dask/array/tests/test_array_core.py::test_view",
"dask/array/tests/test_array_core.py::test_view_fortran",
"dask/array/tests/test_array_core.py::test_broadcast_chunks",
"dask/array/tests/test_array_core.py::test_chunks_error",
"dask/array/tests/test_array_core.py::test_array_compute_forward_kwargs",
"dask/array/tests/test_array_core.py::test_dont_fuse_outputs",
"dask/array/tests/test_array_core.py::test_dont_dealias_outputs",
"dask/array/tests/test_array_core.py::test_timedelta_op",
"dask/array/tests/test_array_core.py::test_to_delayed",
"dask/array/tests/test_array_core.py::test_cumulative",
"dask/array/tests/test_array_core.py::test_eye",
"dask/array/tests/test_array_core.py::test_diag",
"dask/array/tests/test_array_core.py::test_tril_triu",
"dask/array/tests/test_array_core.py::test_tril_triu_errors",
"dask/array/tests/test_array_core.py::test_atop_names",
"dask/array/tests/test_array_core.py::test_atop_new_axes",
"dask/array/tests/test_array_core.py::test_atop_kwargs",
"dask/array/tests/test_array_core.py::test_atop_chunks",
"dask/array/tests/test_array_core.py::test_from_delayed",
"dask/array/tests/test_array_core.py::test_A_property",
"dask/array/tests/test_array_core.py::test_copy_mutate",
"dask/array/tests/test_array_core.py::test_npartitions",
"dask/array/tests/test_array_core.py::test_astype_gh1151",
"dask/array/tests/test_array_core.py::test_elemwise_name",
"dask/array/tests/test_array_core.py::test_map_blocks_name",
"dask/array/tests/test_array_core.py::test_from_array_names",
"dask/array/tests/test_array_core.py::test_array_picklable",
"dask/array/tests/test_array_core.py::test_swapaxes",
"dask/array/tests/test_array_core.py::test_from_array_raises_on_bad_chunks",
"dask/array/tests/test_array_core.py::test_concatenate_axes",
"dask/array/tests/test_array_core.py::test_atop_concatenate",
"dask/array/tests/test_array_core.py::test_common_blockdim",
"dask/array/tests/test_array_core.py::test_uneven_chunks_that_fit_neatly",
"dask/array/tests/test_array_core.py::test_elemwise_uneven_chunks",
"dask/array/tests/test_array_core.py::test_uneven_chunks_atop",
"dask/array/tests/test_array_core.py::test_warn_bad_rechunking",
"dask/array/tests/test_array_core.py::test_optimize_fuse_keys",
"dask/array/tests/test_array_core.py::test_round",
"dask/array/tests/test_array_core.py::test_repeat",
"dask/array/tests/test_array_core.py::test_tile[0-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile[0-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile[1-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile[1-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile[2-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile[2-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile[3-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile[3-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile[5-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile[5-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile_neg_reps[-1-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile_neg_reps[-1-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile_neg_reps[-5-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile_neg_reps[-5-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile_array_reps[reps0-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile_array_reps[reps0-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_tile_array_reps[reps1-shape0-chunks0]",
"dask/array/tests/test_array_core.py::test_tile_array_reps[reps1-shape1-chunks1]",
"dask/array/tests/test_array_core.py::test_concatenate_stack_dont_warn",
"dask/array/tests/test_array_core.py::test_map_blocks_delayed",
"dask/array/tests/test_array_core.py::test_no_chunks",
"dask/array/tests/test_array_core.py::test_no_chunks_2d",
"dask/array/tests/test_array_core.py::test_no_chunks_yes_chunks",
"dask/array/tests/test_array_core.py::test_raise_informative_errors_no_chunks",
"dask/array/tests/test_array_core.py::test_no_chunks_slicing_2d",
"dask/array/tests/test_array_core.py::test_index_array_with_array_1d",
"dask/array/tests/test_array_core.py::test_index_array_with_array_2d",
"dask/array/tests/test_array_core.py::test_setitem_1d",
"dask/array/tests/test_array_core.py::test_setitem_2d",
"dask/array/tests/test_array_core.py::test_setitem_errs",
"dask/array/tests/test_array_core.py::test_zero_slice_dtypes",
"dask/array/tests/test_array_core.py::test_zero_sized_array_rechunk",
"dask/array/tests/test_array_core.py::test_atop_zero_shape",
"dask/array/tests/test_array_core.py::test_atop_zero_shape_new_axes",
"dask/array/tests/test_array_core.py::test_broadcast_against_zero_shape",
"dask/array/tests/test_array_core.py::test_fast_from_array",
"dask/array/tests/test_array_core.py::test_random_from_array",
"dask/array/tests/test_array_core.py::test_concatenate_errs",
"dask/array/tests/test_array_core.py::test_stack_errs",
"dask/array/tests/test_array_core.py::test_transpose_negative_axes",
"dask/array/tests/test_array_core.py::test_atop_with_numpy_arrays",
"dask/array/tests/test_array_core.py::test_elemwise_with_lists[other0-100]",
"dask/array/tests/test_array_core.py::test_elemwise_with_lists[other0-6]",
"dask/array/tests/test_array_core.py::test_elemwise_with_lists[other1-100]",
"dask/array/tests/test_array_core.py::test_elemwise_with_lists[other1-6]",
"dask/array/tests/test_array_core.py::test_elemwise_with_lists[other2-100]",
"dask/array/tests/test_array_core.py::test_elemwise_with_lists[other2-6]",
"dask/array/tests/test_array_core.py::test_constructor_plugin"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 1,217 |
|
lbl-srg__BuildingsPy-156
|
ef15ad34246ac1d4cddf7a45feb1bfeac69936bf
|
2017-05-03 14:44:15
|
923b1087e255f7f35224aa7c1653abf9c038f849
|
diff --git a/buildingspy/development/validator.py b/buildingspy/development/validator.py
index 2e9cf30..f34224a 100644
--- a/buildingspy/development/validator.py
+++ b/buildingspy/development/validator.py
@@ -184,14 +184,14 @@ Modelica package. Expected file '%s'."
return (document, errors)
def _recursive_glob(self, rootdir='.', suffix=''):
- """
+ """
Return all files with given extension.
-
+
:param rootdir: Root directory.
:param suffix: File extension.
:return: List of files with given extension.
-
+
"""
return [os.path.join(rootdir, filename) for rootdir, dirnames,
@@ -200,15 +200,15 @@ Modelica package. Expected file '%s'."
and ("ConvertBuildings_from" not in filename)) ]
def _check_experiment(self, name, val, value, model_path, mos_file):
- """
+ """
Check experiment annotation parameters in mo file.
-
+
:param name: Parameter name.
:param val: Value found in mo file.
:param value: Value found in mos file.
:param model_path: Path to mo file.
:param mos_file: Path to mos file.
-
+
"""
if("*" in str(val)):
@@ -230,14 +230,14 @@ Modelica package. Expected file '%s'."
raise ValueError(s)
def _missing_parameter(self, name, value, model_path, mos_file):
- """
+ """
Check missing experiment annotation parameter in mo file.
-
+
:param name: Parameter name.
:param value: Value found in mos file.
:param model_path: Path to mo file.
:param mos_file: Path to mos file.
-
+
"""
s = ("Found mo file={!s} without parameter {!s} defined.\n"
@@ -248,24 +248,24 @@ Modelica package. Expected file '%s'."
raise ValueError(s)
def _capitalize_first(self, name):
- """
+ """
Capitalize the first letter of the given word.
Return a word with first letter capitalized.
-
+
:param name: Word to be capitalized.
:return: Word with first letter capitalized.
-
+
"""
lst = [word[0].upper() + word[1:] for word in name.split()]
return " ".join(lst)
def _missing_experiment_stoptime(self, mos_files):
- """
+ """
Check missing experiment and StopTime annotation in mo file.
Return number of mo files with experiment.
-
+
:param mos_files: List of mos files.
-
+
"""
n_mo_files = 0
@@ -300,16 +300,16 @@ Modelica package. Expected file '%s'."
return n_mo_files
def _separate_mos_files(self, mos_files):
- """
+ """
Return number of files with tolerance parameter
and two lists of mos files file, one with the simulateModel
and the other one with the translateModelFMU command.
-
+
:param mos_files: file path.
:return: Number of files with tolerance parameter,
and two lists of mos files file, one with the simulateModel
and the other one with the translateModelFMU command.
-
+
"""
mos_non_fmus = []
@@ -348,27 +348,27 @@ Modelica package. Expected file '%s'."
return n_tols, mos_non_fmus, mos_fmus
def _check_tolerance(self, content, name, value, mos_file):
- """
+ """
Check value of tolerance in file.
-
+
:param content: file content.
:param name: variable name.
:param value: variable value.
:param mos_file: mos file.
-
+
"""
if (name + "=" == "tolerance=" and float(value) > 1e-6):
self._wrong_parameter (mos_file, name, value)
def _wrong_parameter (self, mos_file, name, value):
- """
+ """
Stop if invalid parameter is found.
-
+
:param mos_file: mos file.
:param name: parameter name.
:param value: parameter value.
-
+
"""
if (name + "=" == "tolerance="):
@@ -390,13 +390,13 @@ Modelica package. Expected file '%s'."
raise ValueError(s)
def _getValue (self, name, line, fil_nam):
- """
+ """
Get value of input parameter.
-
+
:param name: Parameter name.
:param line: Line with parameter name.
:param fil_nam: File with parameter.
-
+
"""
# Split the name
value1 = line.split(name+"=")
@@ -413,27 +413,25 @@ Modelica package. Expected file '%s'."
return value3[0]
def _wrong_literal (self, mos_file, name):
- """
+ """
Stop if invalid literal is found.
-
+
:param mos_file: mos file.
:param name: Parameter name.
-
+
"""
s = ("Found mos file={!s} with invalid expression={!s}.\n"
+ "This is not allowed for cross validation with JModelica.\n").format(mos_file, name+'='+name)
raise ValueError(s)
- def _validate_model_parameters (self, name, mos_files, root_dir):
- """
- Validate parameter settings.
-
+ def _validate_experiment_setup (self, name, mos_files):
+ """
+ Validate experiment setup.
+
:param name: Parameter name.
:param mos_files: List of mos files.
- :param root_dir: Root directory.
-
- """
+ """
N_mos_defect = 0
@@ -538,12 +536,12 @@ Modelica package. Expected file '%s'."
f.close()
- def validateModelParameters(self, root_dir):
- """
- Validate parameter of mo and mos files.
-
+ def validateExperimentSetup(self, root_dir):
+ """
+ Validate the experiment setup in ``.mo`` and ``.mos`` files.
+
:param root_dir: Root directory.
-
+
"""
# Make sure that the parameter root_dir points to a Modelica package.
@@ -567,7 +565,7 @@ Modelica package. Expected file '%s'."
# Validate model parameters
for i in ["stopTime", "tolerance", "startTime"]:
- self._validate_model_parameters(i, mos_non_fmus, root_dir)
+ self._validate_experiment_setup(i, mos_non_fmus)
if(n_tols != n_mo_files):
s = ("The number of tolerances in the mos files={!s} does no match " +
|
change function names that validate experiment setup
The newly introduced functions are called `validateModelParameters` but in fact they validate the experiment setup which are not a Modelica parameter. This branch is to refactor the names.
|
lbl-srg/BuildingsPy
|
diff --git a/buildingspy/tests/test_development_Validator.py b/buildingspy/tests/test_development_Validator.py
index b985da6..f5e881a 100644
--- a/buildingspy/tests/test_development_Validator.py
+++ b/buildingspy/tests/test_development_Validator.py
@@ -32,7 +32,7 @@ end {{model_name}}
MOS_TEMPLATE = """simulateModel("MyModelicaLibrary.Examples.{{model_name}}", method="dassl", {{parameter}} resultFile="{{model_name}}");
createPlot(
- id=1,
+ id=1,
y={"p1", "p2"}
)
"""
@@ -57,15 +57,15 @@ class Test_development_Validator(unittest.TestCase):
def run_case(self, val, mod_lib, mo_param, mos_param, err_msg):
"""
Create and validate mo and mos files
-
-
+
+
:param: val Validator object.
:param: mod_lib Path to model library.
:param: mo_param Parameter of mo file.
- :param: mos_param Parameter of mos file.
- :param: mos_param Parameter of mos file.
- :param: mos_param Expected error message.
-
+ :param: mos_param Parameter of mos file.
+ :param: mos_param Parameter of mos file.
+ :param: mos_param Expected error message.
+
"""
model_name = ''.join(random.choice(string.ascii_uppercase + string.digits)
@@ -90,14 +90,14 @@ class Test_development_Validator(unittest.TestCase):
mos_fil.close()
with self.assertRaises(ValueError) as context:
- val.validateModelParameters(mod_lib)
+ val.validateExperimentSetup(mod_lib)
for path in [path_mo, path_mos]:
if os.path.exists(path):
os.remove(path)
self.assertTrue(err_msg in str(context.exception))
- def test_validateModelParameters(self):
+ def test_validateExperimentSetup(self):
import buildingspy.development.validator as v
val = v.Validator()
@@ -105,7 +105,7 @@ class Test_development_Validator(unittest.TestCase):
#########################################
# Checking default library
- val.validateModelParameters(myMoLib)
+ val.validateExperimentSetup(myMoLib)
#########################################
# Checking missing experiment
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 1
}
|
1.6
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc tidy"
],
"python": "3.6",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
-e git+https://github.com/lbl-srg/BuildingsPy.git@ef15ad34246ac1d4cddf7a45feb1bfeac69936bf#egg=buildingspy
certifi==2021.5.30
coverage==6.2
future==1.0.0
gitdb==4.0.9
GitPython==3.1.18
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==3.0.3
MarkupSafe==2.0.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
pytidylib==0.3.2
smmap==5.0.0
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: BuildingsPy
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- coverage==6.2
- future==1.0.0
- gitdb==4.0.9
- gitpython==3.1.18
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- jinja2==3.0.3
- markupsafe==2.0.1
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- pytidylib==0.3.2
- smmap==5.0.0
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/BuildingsPy
|
[
"buildingspy/tests/test_development_Validator.py::Test_development_Validator::test_validateExperimentSetup"
] |
[] |
[
"buildingspy/tests/test_development_Validator.py::Test_development_Validator::test_validateHTMLInPackage"
] |
[] | null | 1,224 |
|
streamlink__streamlink-886
|
d6a52a53a63ce2648781d529728f9fa9767d6522
|
2017-05-05 16:07:06
|
9ad8bb2f20ea86aaefae89483af8a4f1015e561a
|
diff --git a/.travis.yml b/.travis.yml
index c6871830..874d4514 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -39,6 +39,9 @@ addons:
packages:
- nsis
+before_deploy:
+ - ./script/bintrayconfig.sh
+
deploy:
- provider: releases
api_key: "${RELEASES_API_KEY}"
@@ -54,15 +57,19 @@ deploy:
on:
tags: true
condition: $BUILD_INSTALLER = yes
- - provider: s3
+ - provider: bintray
+ file: build/bintray-nightly.json
+ user: "${BINTRAY_USER}"
+ key: "${BINTRAY_KEY}"
skip_cleanup: true
- local_dir: $STREAMLINK_INSTALLER_DIST_DIR
- bucket: streamlink-builds
- upload-dir: nightly/windows
on:
branch: master
- condition: $BUILD_INSTALLER = yes
- secret_access_key:
- secure: 3abBcpXNxhWDJyznMA/wDmQ+lUSaJVwi62aXHjFxA7Zrz/CidbHmXkNedViWTOivMyVcM4Ypej4JD1V74Uo78GN09TICRbSc9fTF08O8Hu+hKiAcVWepfmuV54nyoQHY5mcxBPwgUZwnTwSYLzKXCqDEmQXrUrM313m4f2cbDSQgo6VPoCqE+U7JTVaUI6asutsErvK7vfw9EqGSumndRNjQdD0triubs5kh6WPv5STpKrkUNWX95fjBbkuf5hy+DIQN22hLpHYwqV3DoTnhWzbPy8/OnCKoUjEAspLehkjr86brwuls1UfR1uC2uG53O2Rb3CCYkZSVC7GKdEw0SnbLNVfbhy500a8AiPbWC0AV75PidXNEe+1zye4n/xKdx0KA8aRXr7v/89x7KibHNpwf6rdpx7axYhlsWcFcyfoOTZJ3thhu7ib9QYJZ7gkRVGWbawZU6I370I5sMJLIwmzBXgZ2y8jFk7LUNbb2GUS3LKcw5gRYOqo+ZEHFdiLpPYXFHUslTkpaMNoPCNUR7Tsa2JPfJ29yEDMsdDs2lJbP+Km8hAnpkyJfpfPcVUcl8Ootd1cTe8iPdD1nqt3KvIy4sCjkCxvQFnmGOTWFqXY/UDD+Yqo3IVOG1aLPR3UxhzHtPX6M5FxtNB22kv8hrbN/QxhBEo/SfNhGIGZJNdI=
- access_key_id:
- secure: sjjc1tM756TvFbD8+0VCs/MOLFRhY+VZv/lq7pvNldtbGdv21lcJguvgg0gUwUZ7SihceyL1YagfUlDU2vWS1N5Si04z0VUcHO4lbj9nUJ4CXy27pMNFuk92HmblxYQ4bJw/xVqzsrT9Zeh4tIrbV+F3lYXtg7FDqjpm5bqrUJ5ULyWbhax31s2k8JRVnG2fxVmJiU+j4zwgzCqeZJXQkvXsfdzSe88mLyIrl7Otfjlp1rySocxStQ8qlmkvRAmsYmsKriUq+VgtX21HFAIJqHQp4WbL15eh0aFFzbmORf7OMIKmsmkyeYYeM6xp+Jm9m7ZcWHZ+7siplVM/9ksmumN3+CGp6pogduZ5zFH4BtRQa9o8N2SWnPiPvMrpoyLbHbQhg/uhcMJkYI1yrzj/s9MEH7DVnDEMmgc/UKsyTC2PRwZcgqYYPHxqRVWXzvBWDUe1wtxdNyaXWWKdD/1E7u8XF2+zPTPaUNAYAF1rSi5GNF38uRNMC+QSuEm8wZ/32KXFN4m+RW3NtpT9YHI8MCo4ofVxpRUMcEUwPDF/jV5zW7Krz7LEeL5/zcHMcNay/Ls8e3eApQShAcLAx1jZo+EjznVGXtlRbH9ABXmPO5AcxUH5+20tMiMoj0q6hJen03X8Jx+OMmcDNDufDgPikSym3KVC3Lvj65lG4G9pAyY=
+ condition: $BUILD_INSTALLER = yes && $TRAVIS_EVENT_TYPE == cron
+ - provider: bintray
+ file: build/bintray-latest.json
+ user: "${BINTRAY_USER}"
+ key: "${BINTRAY_KEY}"
+ skip_cleanup: true
+ on:
+ branch: master
+ condition: $BUILD_INSTALLER = yes && $TRAVIS_EVENT_TYPE == cron
diff --git a/docs/install.rst b/docs/install.rst
index f7385939..b864ae00 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -239,7 +239,7 @@ Windows binaries
You can download the latest stable Windows installer from the `GitHub Releases Page <https://github.com/streamlink/streamlink/releases/latest>`__.
-Alternatively, you can download the latest `nightly Windows installer <https://streamlink-builds.s3.amazonaws.com/nightly/windows/streamlink-latest.exe>`__.
+Alternatively, you can download the latest `nightly Windows installer <https://dl.bintray.com/streamlink/streamlink-nightly/streamlink-latest.exe>`__.
This is a installer which contains:
diff --git a/script/bintrayconfig.sh b/script/bintrayconfig.sh
new file mode 100755
index 00000000..f5c2f7ef
--- /dev/null
+++ b/script/bintrayconfig.sh
@@ -0,0 +1,84 @@
+#!/usr/bin/env bash
+#
+# Script to generate bintray config for nightly builds
+#
+
+build_dir="$(pwd)/build"
+nsis_dir="${build_dir}/nsis"
+# get the dist directory from an environment variable, but default to the build/nsis directory
+dist_dir="${STREAMLINK_INSTALLER_DIST_DIR:-$nsis_dir}"
+
+# TODO: extract this common version detection code in to a separate function
+STREAMLINK_VERSION_PLAIN=$(python setup.py --version)
+# For travis nightly builds generate a version number with commit hash
+if [ -n "${TRAVIS_BRANCH}" ] && [ -z "${TRAVIS_TAG}" ]; then
+ STREAMLINK_VI_VERSION="${STREAMLINK_VERSION_PLAIN}.${TRAVIS_BUILD_NUMBER}"
+ STREAMLINK_INSTALLER="streamlink-${STREAMLINK_VERSION_PLAIN}-${TRAVIS_BUILD_NUMBER}-${TRAVIS_COMMIT:0:7}"
+ STREAMLINK_VERSION="${STREAMLINK_VERSION_PLAIN}+${TRAVIS_COMMIT:0:7}"
+else
+ STREAMLINK_VI_VERSION="${STREAMLINK_VERSION_PLAIN}.${TRAVIS_BUILD_NUMBER:-0}"
+ STREAMLINK_VERSION="${STREAMLINK_VERSION_PLAIN}"
+ STREAMLINK_INSTALLER="streamlink-${STREAMLINK_VERSION}"
+fi
+
+cat > "${build_dir}/bintray-latest.json" <<EOF
+{
+ "package": {
+ "subject": "streamlink",
+ "repo": "streamlink-nightly",
+ "name": "streamlink"
+ },
+
+ "version": {
+ "name": "latest",
+ "released": "$(date +'%Y-%m-%d')",
+ "desc": "Latest version of the installer (${STREAMLINK_VERSION})"
+ },
+
+ "files": [
+ {
+ "includePattern": "${dist_dir}/${STREAMLINK_INSTALLER}.exe",
+ "uploadPattern": "streamlink-latest.exe",
+ "matrixParams": {
+ "override": 1,
+ "publish": 1
+ }
+ }
+ ],
+
+ "publish": true
+}
+EOF
+
+echo "Wrote Bintray config to: ${build_dir}/bintray-latest.json"
+
+cat > "${build_dir}/bintray-nightly.json" <<EOF
+{
+ "package": {
+ "subject": "streamlink",
+ "repo": "streamlink-nightly",
+ "name": "streamlink"
+ },
+
+ "version": {
+ "name": "$(date +'%Y.%m.%d')",
+ "released": "$(date +'%Y-%m-%d')",
+ "desc": "Streamlink Nightly based on ${STREAMLINK_VERSION}"
+ },
+
+ "files": [
+ {
+ "includePattern": "${dist_dir}/${STREAMLINK_INSTALLER}.exe",
+ "uploadPattern": "streamlink-${STREAMLINK_VERSION_PLAIN}-$(date +'%Y%m%d').exe",
+ "matrixParams": {
+ "override": 1,
+ "publish": 1
+ }
+ }
+ ],
+
+ "publish": true
+}
+EOF
+
+echo "Wrote Bintray config to: ${build_dir}/bintray-nightly.json"
diff --git a/script/makeinstaller.sh b/script/makeinstaller.sh
index 935df9ee..259cce34 100755
--- a/script/makeinstaller.sh
+++ b/script/makeinstaller.sh
@@ -208,10 +208,5 @@ cp -r "win32/rtmpdump" "${nsis_dir}/"
pynsist build/streamlink.cfg
-# Make a copy of this build for the "latest" nightly
-if [ -n "${TRAVIS_BRANCH}" ] && [ -z "${TRAVIS_TAG}" ]; then
- cp "${dist_dir}/${STREAMLINK_INSTALLER}.exe" "${dist_dir}/streamlink-latest.exe"
-fi
-
echo "Success!" 1>&2
echo "The installer should be in ${dist_dir}." 1>&2
diff --git a/src/streamlink/plugins/pcyourfreetv.py b/src/streamlink/plugins/pcyourfreetv.py
index c116823b..968ac7d3 100644
--- a/src/streamlink/plugins/pcyourfreetv.py
+++ b/src/streamlink/plugins/pcyourfreetv.py
@@ -1,17 +1,19 @@
import re
-from streamlink.compat import unquote
+from streamlink.compat import parse_qsl, unquote
from streamlink.plugin import Plugin, PluginOptions
from streamlink.plugin.api import http
from streamlink.stream import HLSStream
class PCYourFreeTV(Plugin):
+ LIVE_TV_URL = 'http://pc-yourfreetv.com/indexlivetv.php?page_id=1'
+
_login_url = 'http://pc-yourfreetv.com/home.php'
- _url_re = re.compile(r'http://pc-yourfreetv\.com/index_player\.php\?channel=.+?&page_id=\d+')
- _iframe_re = re.compile(r"<iframe .*?\bsrc='(?P<iframe>.+?)'.*?</iframe>")
+ _url_re = re.compile(r'http://pc-yourfreetv\.com/indexplayer\.php\?channel=.+?&page_id=\d+')
+ _token_re = re.compile(r'\bsrc="indexplayer\.php\?channel=.+?&(?P<tokens>.+?)"')
_player_re = re.compile(r"<script language=JavaScript>m='(?P<player>.+?)'", re.DOTALL)
- _video_url_re = re.compile(r'new YourFreeTV.Player\({source: "(?P<video_url>[^"]+?)".+?}.*\);', re.DOTALL)
+ _video_url_re = re.compile(r"jwplayer\('.+?'\)\.setup\({.+?file: \"(?P<video_url>[^\"]+?)\".+?}\);", re.DOTALL)
options = PluginOptions({
'username': None,
@@ -46,13 +48,14 @@ class PCYourFreeTV(Plugin):
if self.login(username, password):
self.logger.info("Successfully logged in as {0}", username)
- # Retrieve URL iframe
- res = http.get(self.url)
- match = self._iframe_re.search(res.text)
+ # Get a fresh authorization token
+ res = http.get(self.LIVE_TV_URL)
+ match = self._token_re.search(res.text)
if match is None:
return
- res = http.get(match.group('iframe'))
+ # Retrieve URL page and search for stream data
+ res = http.get(self.url, params=parse_qsl(match.group('tokens')))
match = self._player_re.search(res.text)
if match is None:
return
|
Nightly Hosting Costs
I have been reviewing the costs for hosting the nightly builds of streamlink on S3. For the month of April, `streamlink-lastest.exe` was downloaded 11,228 times and used 133GB of transfer bandwidth. The cost of transfers was $11.98 and the cost of storage and HTTP requests was $0.69, with a total cost of $12.67+tax. With the gaining popularity of `streamlink` I can only see that cost increasing, I would like to reduce the cost a bit ($15 a month is fairly expensive for me.)
With the addition of `ffmpeg` we added some nice features, and the possibility for further future enhancements, but we also bloated the installer (and the git repo, as discussed on other issues.) The installer is approx. 38MB including the `ffmpeg.exe`, and approx. 15MB without `ffmpeg.exe`.
I was thinking we could remove `ffmpeg` from the installer and either allow the user to install it themselves, or download the `ffmpeg.exe` on demand in the installer. I prefer the download during the installer option as it means the user doesn't have to install it manually but the installer is smaller (we can download `ffmpeg.exe` from github).
Alternatively we could set up a different repo with scheduled builds on travis, to build the nightly periodically and automatically add a release to that repo.
Thoughts @gravyboat, @bastimeyer, @cdrage?
|
streamlink/streamlink
|
diff --git a/tests/test_plugin_pcyourfreetv.py b/tests/test_plugin_pcyourfreetv.py
index d1ee96dc..f5664754 100644
--- a/tests/test_plugin_pcyourfreetv.py
+++ b/tests/test_plugin_pcyourfreetv.py
@@ -6,13 +6,13 @@ from streamlink.plugins.pcyourfreetv import PCYourFreeTV
class TestPluginPCYourFreeTV(unittest.TestCase):
def test_can_handle_url(self):
# should match
- self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/index_player.php?channel=das%20erste&page_id=41"))
- self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/index_player.php?channel=srf%20eins&page_id=41"))
- self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/index_player.php?channel=bbc%20one&page_id=41"))
- self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/index_player.php?channel=tf1&page_id=41"))
+ self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/indexplayer.php?channel=das%20erste&page_id=41"))
+ self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/indexplayer.php?channel=srf%20eins&page_id=41"))
+ self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/indexplayer.php?channel=bbc%20one&page_id=41"))
+ self.assertTrue(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/indexplayer.php?channel=tf1&page_id=41"))
# shouldn't match
self.assertFalse(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/home.php"))
- self.assertFalse(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/index_livetv.php?page_id=1"))
+ self.assertFalse(PCYourFreeTV.can_handle_url("http://pc-yourfreetv.com/indexlivetv.php?page_id=1"))
self.assertFalse(PCYourFreeTV.can_handle_url("http://tvcatchup.com/"))
self.assertFalse(PCYourFreeTV.can_handle_url("http://youtube.com/"))
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 4
}
|
0.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"codecov",
"coverage",
"mock",
"pynsist"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi==2025.1.31
charset-normalizer==3.4.1
codecov==2.1.13
coverage==7.8.0
distlib==0.3.9
exceptiongroup==1.2.2
idna==3.10
iniconfig==2.1.0
iso-639==0.4.5
iso3166==2.1.1
Jinja2==3.1.6
MarkupSafe==3.0.2
mock==5.2.0
packaging==24.2
pluggy==1.5.0
pycryptodome==3.22.0
pynsist==2.8
pytest==8.3.5
pytest-cov==6.0.0
requests==2.32.3
requests_download==0.1.2
-e git+https://github.com/streamlink/streamlink.git@d6a52a53a63ce2648781d529728f9fa9767d6522#egg=streamlink
tomli==2.2.1
urllib3==2.3.0
yarg==0.1.10
|
name: streamlink
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- certifi==2025.1.31
- charset-normalizer==3.4.1
- codecov==2.1.13
- coverage==7.8.0
- distlib==0.3.9
- exceptiongroup==1.2.2
- idna==3.10
- iniconfig==2.1.0
- iso-639==0.4.5
- iso3166==2.1.1
- jinja2==3.1.6
- markupsafe==3.0.2
- mock==5.2.0
- packaging==24.2
- pluggy==1.5.0
- pycryptodome==3.22.0
- pynsist==2.8
- pytest==8.3.5
- pytest-cov==6.0.0
- requests==2.32.3
- requests-download==0.1.2
- tomli==2.2.1
- urllib3==2.3.0
- yarg==0.1.10
prefix: /opt/conda/envs/streamlink
|
[
"tests/test_plugin_pcyourfreetv.py::TestPluginPCYourFreeTV::test_can_handle_url"
] |
[] |
[] |
[] |
BSD 2-Clause "Simplified" License
| 1,232 |
|
davidhalter__jedi-922
|
c1c3f35e08a2404814d0463a648c562c15f1beb6
|
2017-05-06 12:19:45
|
c1c3f35e08a2404814d0463a648c562c15f1beb6
|
davidhalter: I like! Thanks man. Good test.
|
diff --git a/AUTHORS.txt b/AUTHORS.txt
index b5619dcb..52204a8b 100644
--- a/AUTHORS.txt
+++ b/AUTHORS.txt
@@ -43,6 +43,7 @@ bstaint (@bstaint)
Mathias Rav (@Mortal) <[email protected]>
Daniel Fiterman (@dfit99) <[email protected]>
Simon Ruggier (@sruggier)
+Élie Gouzien (@ElieGouzien)
Note: (@user) means a github user name.
diff --git a/jedi/evaluate/compiled/mixed.py b/jedi/evaluate/compiled/mixed.py
index dfb49657..1390ea47 100644
--- a/jedi/evaluate/compiled/mixed.py
+++ b/jedi/evaluate/compiled/mixed.py
@@ -116,8 +116,21 @@ def _load_module(evaluator, path, python_object):
return module
+def source_findable(python_object):
+ """Check if inspect.getfile has a chance to find the source."""
+ return (inspect.ismodule(python_object) or
+ inspect.isclass(python_object) or
+ inspect.ismethod(python_object) or
+ inspect.isfunction(python_object) or
+ inspect.istraceback(python_object) or
+ inspect.isframe(python_object) or
+ inspect.iscode(python_object))
+
+
def find_syntax_node_name(evaluator, python_object):
try:
+ if not source_findable(python_object):
+ raise TypeError # Prevents computation of `repr` within inspect.
path = inspect.getsourcefile(python_object)
except TypeError:
# The type might not be known (e.g. class_with_dict.__weakref__)
|
Slow completion for existing object with long `__repr__` method
Hi,
For completion with existing objects it seems that the `__repr__()` method is evaluated for an error message within the inspect module which is afterward caught. This makes the completion as slow as `__repr__()` while this evaluation in unnecessary for the user. This method can bee rather slow with big pandas objects or custom class.
This as been seen here :
[qtconsole issue #90](https://github.com/jupyter/qtconsole/issues/90)
A minimal code to reproduce it :
```python
import jedi
class Bugger(object):
def __init__(self, size=10000):
"""Create bigg data."""
self.big_data = [list(range(i)) for i in range(size)]
def easy_method(self):
"""Method that should be really fast."""
return self.big_data[-1][-1]
def __repr__(self):
output = ""
for nested in self.big_data:
for elem in nested:
output += str(elem)
output += '\n'
return output
test = Bugger()
jedi.Interpreter('test.ea', [locals()]).completions()
```
And a more convenient working version :
```python
import jedi, pdb, inspect
class Bugger(object):
def __init__(self, size=10):
"""Create bigg data."""
self.big_data = [list(range(i)) for i in range(size)]
def easy_method(self):
"""Method that should be really fast."""
return self.big_data[-1][-1]
def __repr__(self):
frames = inspect.getouterframes(inspect.currentframe())
for frame in frames:
print(frame)
pdb.set_trace()
output = ""
for nested in self.big_data:
for elem in nested:
output += str(elem)
output += '\n'
return output
test = Bugger()
jedi.Interpreter('test.ea', [locals()]).completions()
```
Jedi seems to end here through jedi/evaluate/compiled/mixed.py, line 121.
Maybe making checks before the calling `inspect.getsourcefile()` could fix it, but not I don't know jedi enough to claim it.
|
davidhalter/jedi
|
diff --git a/test/test_speed.py b/test/test_speed.py
index dcb69840..8d5bc9a3 100644
--- a/test/test_speed.py
+++ b/test/test_speed.py
@@ -51,3 +51,19 @@ class TestSpeed(TestCase):
with open('speed/precedence.py') as f:
line = len(f.read().splitlines())
assert jedi.Script(line=line, path='speed/precedence.py').goto_definitions()
+
+ @_check_speed(0.1)
+ def test_no_repr_computation(self):
+ """
+ For Interpreter completion aquisition of sourcefile can trigger
+ unwanted computation of repr(). Exemple : big pandas data.
+ See issue #919.
+ """
+ class SlowRepr():
+ "class to test what happens if __repr__ is very slow."
+ def some_method(self):
+ pass
+ def __repr__(self):
+ time.sleep(0.2)
+ test = SlowRepr()
+ jedi.Interpreter('test.som', [locals()]).completions()
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 2
}
|
0.10
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
-e git+https://github.com/davidhalter/jedi.git@c1c3f35e08a2404814d0463a648c562c15f1beb6#egg=jedi
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: jedi
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
prefix: /opt/conda/envs/jedi
|
[
"test/test_speed.py::TestSpeed::test_no_repr_computation"
] |
[] |
[
"test/test_speed.py::TestSpeed::test_os_path_join",
"test/test_speed.py::TestSpeed::test_precedence_slowdown",
"test/test_speed.py::TestSpeed::test_scipy_speed"
] |
[] |
MIT License
| 1,233 |
jaywink__federation-73
|
3a2910afc2329fc4f052bd01a1eae6927a0c1ac8
|
2017-05-06 17:27:20
|
3a2910afc2329fc4f052bd01a1eae6927a0c1ac8
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7ef04da..789ed19 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,12 +13,15 @@ Additionally, Diaspora entity mappers `message_to_objects` and `element_to_objec
### Other backwards incompatible changes
* A failed payload signature verification now raises a `SignatureVerificationError` instead of a less specific `AssertionError`.
-### Other additions
-
+### Added
* Three new attributes added to entities.
* Add protocol name to all entities to attribute `_source_protocol`. This might be useful for applications to know which protocol payload the entity was created from once multiple protocols are implemented.
* Add source payload object to the entity at `_source_object` when processing it.
* Add sender public key to the entity at `_sender_key`, but only if it was used for validating signatures.
+* Add support for the new Diaspora payload properties coming in the next protocol version. Old XML payloads are and will be still supported.
+
+### Changed
+* Refactor processing of Diaspora payload XML into entities. Diaspora protocol is dropping the `<XML><post></post></XML>` wrapper for the payloads. Payloads with the wrapper will still be parsed as before.
## [0.10.1] - 2017-03-09
diff --git a/federation/entities/diaspora/mappers.py b/federation/entities/diaspora/mappers.py
index 1094513..66da0d5 100644
--- a/federation/entities/diaspora/mappers.py
+++ b/federation/entities/diaspora/mappers.py
@@ -21,19 +21,24 @@ MAPPINGS = {
"retraction": DiasporaRetraction,
}
-BOOLEAN_KEYS = [
+TAGS = [
+ # Order is important. Any top level tags should be before possibly child tags
+ "status_message", "comment", "like", "request", "profile", "retraction", "photo",
+]
+
+BOOLEAN_KEYS = (
"public",
"nsfw",
-]
+)
-DATETIME_KEYS = [
+DATETIME_KEYS = (
"created_at",
-]
+)
-INTEGER_KEYS = [
+INTEGER_KEYS = (
"height",
"width",
-]
+)
def xml_children_as_dict(node):
"""Turn the children of node <xml> into a dict, keyed by tag name.
@@ -43,8 +48,8 @@ def xml_children_as_dict(node):
return dict((e.tag, e.text) for e in node)
-def element_to_objects(tree, sender_key_fetcher=None):
- """Transform an Element tree to a list of entities recursively.
+def element_to_objects(element, sender_key_fetcher=None):
+ """Transform an Element to a list of entities recursively.
Possible child entities are added to each entity `_children` list.
@@ -54,45 +59,45 @@ def element_to_objects(tree, sender_key_fetcher=None):
:returns: list of entities
"""
entities = []
- for element in tree:
- cls = MAPPINGS.get(element.tag, None)
- if not cls:
- continue
-
- attrs = xml_children_as_dict(element)
- transformed = transform_attributes(attrs)
- if hasattr(cls, "fill_extra_attributes"):
- transformed = cls.fill_extra_attributes(transformed)
- entity = cls(**transformed)
- # Add protocol name
- entity._source_protocol = "diaspora"
- # Save element object to entity for possible later use
- entity._source_object = element
- # If relayable, fetch sender key for validation
- if issubclass(cls, DiasporaRelayableMixin):
- if sender_key_fetcher:
- entity._sender_key = sender_key_fetcher(entity.handle)
- else:
- profile = retrieve_and_parse_profile(entity.handle)
- if profile:
- entity._sender_key = profile.public_key
- try:
- entity.validate()
- except ValueError as ex:
- logger.error("Failed to validate entity %s: %s", entity, ex, extra={
- "attrs": attrs,
- "transformed": transformed,
- })
- continue
- # Do child elements
- entity._children = element_to_objects(element)
- # Add to entities list
- entities.append(entity)
- if cls == DiasporaRequest:
- # We support sharing/following separately, so also generate base Relationship for the following part
- transformed.update({"relationship": "following"})
- relationship = Relationship(**transformed)
- entities.append(relationship)
+ cls = MAPPINGS.get(element.tag, None)
+ if not cls:
+ return []
+
+ attrs = xml_children_as_dict(element)
+ transformed = transform_attributes(attrs, cls)
+ if hasattr(cls, "fill_extra_attributes"):
+ transformed = cls.fill_extra_attributes(transformed)
+ entity = cls(**transformed)
+ # Add protocol name
+ entity._source_protocol = "diaspora"
+ # Save element object to entity for possible later use
+ entity._source_object = element
+ # If relayable, fetch sender key for validation
+ if issubclass(cls, DiasporaRelayableMixin):
+ if sender_key_fetcher:
+ entity._sender_key = sender_key_fetcher(entity.handle)
+ else:
+ profile = retrieve_and_parse_profile(entity.handle)
+ if profile:
+ entity._sender_key = profile.public_key
+ try:
+ entity.validate()
+ except ValueError as ex:
+ logger.error("Failed to validate entity %s: %s", entity, ex, extra={
+ "attrs": attrs,
+ "transformed": transformed,
+ })
+ return []
+ # Do child elements
+ for child in element:
+ entity._children = element_to_objects(child)
+ # Add to entities list
+ entities.append(entity)
+ if cls == DiasporaRequest:
+ # We support sharing/following separately, so also generate base Relationship for the following part
+ transformed.update({"relationship": "following"})
+ relationship = Relationship(**transformed)
+ entities.append(relationship)
return entities
@@ -106,22 +111,32 @@ def message_to_objects(message, sender_key_fetcher=None):
:returns: list of entities
"""
doc = etree.fromstring(message)
- if doc[0].tag == "post":
- # Skip the top <post> element if it exists
- doc = doc[0]
- entities = element_to_objects(doc, sender_key_fetcher)
- return entities
-
-
-def transform_attributes(attrs):
- """Transform some attribute keys."""
+ # Future Diaspora protocol version contains the element at top level
+ if doc.tag in TAGS:
+ return element_to_objects(doc, sender_key_fetcher)
+ # Legacy Diaspora protocol wraps the element in <XML><post></post></XML>, so find the right element
+ for tag in TAGS:
+ element = doc.find(".//%s" % tag)
+ if element is not None:
+ return element_to_objects(element, sender_key_fetcher)
+ return []
+
+
+def transform_attributes(attrs, cls):
+ """Transform some attribute keys.
+
+ :param attrs: Properties from the XML
+ :type attrs: dict
+ :param cls: Class of the entity
+ :type cls: class
+ """
transformed = {}
for key, value in attrs.items():
if key in ["raw_message", "text"]:
transformed["raw_content"] = value
elif key in ["diaspora_handle", "sender_handle", "author"]:
transformed["handle"] = value
- elif key == "recipient_handle":
+ elif key in ["recipient_handle", "recipient"]:
transformed["target_handle"] = value
elif key == "parent_guid":
transformed["target_guid"] = value
@@ -145,7 +160,7 @@ def transform_attributes(attrs):
transformed["raw_content"] = value
elif key == "searchable":
transformed["public"] = True if value == "true" else False
- elif key == "target_type":
+ elif key in ["target_type", "type"] and cls == DiasporaRetraction:
transformed["entity_type"] = DiasporaRetraction.entity_type_from_remote(value)
elif key == "remote_photo_path":
transformed["remote_path"] = value
@@ -156,6 +171,8 @@ def transform_attributes(attrs):
transformed["linked_type"] = "Post"
elif key == "author_signature":
transformed["signature"] = value
+ elif key == "post_guid":
+ transformed["target_guid"] = value
elif key in BOOLEAN_KEYS:
transformed[key] = True if value == "true" else False
elif key in DATETIME_KEYS:
|
Ensure Diaspora entity converters understand all new attributes
Diaspora is unifying the attributes for the entities (see https://github.com/diaspora/diaspora_federation/issues/29). Make sure our converters handle all the new entities since some of the converters have been built from example old entity XML's which are still sent.
Old attributes should still be supported in the converters.
|
jaywink/federation
|
diff --git a/federation/tests/entities/diaspora/test_mappers.py b/federation/tests/entities/diaspora/test_mappers.py
index 0dddc99..848cfc8 100644
--- a/federation/tests/entities/diaspora/test_mappers.py
+++ b/federation/tests/entities/diaspora/test_mappers.py
@@ -15,7 +15,7 @@ from federation.tests.fixtures.keys import get_dummy_private_key
from federation.tests.fixtures.payloads import (
DIASPORA_POST_SIMPLE, DIASPORA_POST_COMMENT, DIASPORA_POST_LIKE,
DIASPORA_REQUEST, DIASPORA_PROFILE, DIASPORA_POST_INVALID, DIASPORA_RETRACTION,
- DIASPORA_POST_WITH_PHOTOS, DIASPORA_POST_LEGACY_TIMESTAMP)
+ DIASPORA_POST_WITH_PHOTOS, DIASPORA_POST_LEGACY_TIMESTAMP, DIASPORA_POST_LEGACY)
def mock_fill(attributes):
@@ -23,7 +23,7 @@ def mock_fill(attributes):
return attributes
-class TestDiasporaEntityMappersReceive(object):
+class TestDiasporaEntityMappersReceive():
def test_message_to_objects_simple_post(self):
entities = message_to_objects(DIASPORA_POST_SIMPLE)
assert len(entities) == 1
@@ -37,6 +37,20 @@ class TestDiasporaEntityMappersReceive(object):
assert post.created_at == datetime(2011, 7, 20, 1, 36, 7)
assert post.provider_display_name == "Socialhome"
+ def test_message_to_objects_post_legacy(self):
+ # This is the previous XML schema used before renewal of protocol
+ entities = message_to_objects(DIASPORA_POST_LEGACY)
+ assert len(entities) == 1
+ post = entities[0]
+ assert isinstance(post, DiasporaPost)
+ assert isinstance(post, Post)
+ assert post.raw_content == "((status message))"
+ assert post.guid == "((guidguidguidguidguidguidguid))"
+ assert post.handle == "[email protected]"
+ assert post.public == False
+ assert post.created_at == datetime(2011, 7, 20, 1, 36, 7)
+ assert post.provider_display_name == "Socialhome"
+
def test_message_to_objects_legact_timestamp(self):
entities = message_to_objects(DIASPORA_POST_LEGACY_TIMESTAMP)
post = entities[0]
@@ -60,19 +74,6 @@ class TestDiasporaEntityMappersReceive(object):
assert photo.handle == "[email protected]"
assert photo.public == False
assert photo.created_at == datetime(2011, 7, 20, 1, 36, 7)
- photo = post._children[1]
- assert isinstance(photo, Image)
- assert photo.remote_path == "https://alice.diaspora.example.org/uploads/images/"
- assert photo.remote_name == "12345.jpg"
- assert photo.raw_content == "foobar"
- assert photo.linked_type == "Post"
- assert photo.linked_guid == "((guidguidguidguidguidguidguid))"
- assert photo.height == 120
- assert photo.width == 120
- assert photo.guid == "((guidguidguidguidguidguidguig))"
- assert photo.handle == "[email protected]"
- assert photo.public == False
- assert photo.created_at == datetime(2011, 7, 20, 1, 36, 7)
@patch("federation.entities.diaspora.mappers.DiasporaComment._validate_signatures")
def test_message_to_objects_comment(self, mock_validate):
@@ -171,7 +172,7 @@ class TestDiasporaEntityMappersReceive(object):
mock_retrieve.assert_called_once_with("[email protected]")
-class TestGetOutboundEntity(object):
+class TestGetOutboundEntity():
def test_already_fine_entities_are_returned_as_is(self):
dummy_key = get_dummy_private_key()
entity = DiasporaPost()
diff --git a/federation/tests/fixtures/payloads.py b/federation/tests/fixtures/payloads.py
index a376140..97f88e6 100644
--- a/federation/tests/fixtures/payloads.py
+++ b/federation/tests/fixtures/payloads.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
ENCRYPTED_DIASPORA_PAYLOAD = """<?xml version='1.0'?>
<diaspora xmlns="https://joindiaspora.com/protocol" xmlns:me="http://salmon-protocol.org/ns/magic-env">
<encrypted_header>{encrypted_header}</encrypted_header>
@@ -28,7 +26,7 @@ UNENCRYPTED_DIASPORA_PAYLOAD = """<?xml version='1.0'?>
"""
-DIASPORA_POST_SIMPLE = """<XML>
+DIASPORA_POST_LEGACY = """<XML>
<post>
<status_message>
<raw_message>((status message))</raw_message>
@@ -43,139 +41,115 @@ DIASPORA_POST_SIMPLE = """<XML>
"""
-DIASPORA_POST_LEGACY_TIMESTAMP = """<XML>
- <post>
- <status_message>
- <raw_message>((status message))</raw_message>
- <guid>((guidguidguidguidguidguidguid))</guid>
- <diaspora_handle>[email protected]</diaspora_handle>
- <public>false</public>
- <created_at>2011-07-20 01:36:07 UTC</created_at>
- <provider_display_name>Socialhome</provider_display_name>
- </status_message>
- </post>
- </XML>
+DIASPORA_POST_SIMPLE = """
+ <status_message>
+ <text>((status message))</text>
+ <guid>((guidguidguidguidguidguidguid))</guid>
+ <author>[email protected]</author>
+ <public>false</public>
+ <created_at>2011-07-20T01:36:07Z</created_at>
+ <provider_display_name>Socialhome</provider_display_name>
+ </status_message>
"""
-DIASPORA_POST_WITH_PHOTOS = """<XML>
- <post>
- <status_message>
- <raw_message>((status message))</raw_message>
- <guid>((guidguidguidguidguidguidguid))</guid>
- <diaspora_handle>[email protected]</diaspora_handle>
- <public>false</public>
- <created_at>2011-07-20T01:36:07Z</created_at>
- <provider_display_name>Socialhome</provider_display_name>
- <photo>
- <guid>((guidguidguidguidguidguidguif))</guid>
- <diaspora_handle>[email protected]</diaspora_handle>
- <public>false</public>
- <created_at>2011-07-20T01:36:07Z</created_at>
- <remote_photo_path>https://alice.diaspora.example.org/uploads/images/</remote_photo_path>
- <remote_photo_name>1234.jpg</remote_photo_name>
- <text/>
- <status_message_guid>((guidguidguidguidguidguidguid))</status_message_guid>
- <height>120</height>
- <width>120</width>
- </photo>
- <photo>
- <guid>((guidguidguidguidguidguidguig))</guid>
- <diaspora_handle>[email protected]</diaspora_handle>
- <public>false</public>
- <created_at>2011-07-20T01:36:07Z</created_at>
- <remote_photo_path>https://alice.diaspora.example.org/uploads/images/</remote_photo_path>
- <remote_photo_name>12345.jpg</remote_photo_name>
- <text>foobar</text>
- <status_message_guid>((guidguidguidguidguidguidguid))</status_message_guid>
- <height>120</height>
- <width>120</width>
- </photo>
- </status_message>
- </post>
- </XML>
+DIASPORA_POST_LEGACY_TIMESTAMP = """
+ <status_message>
+ <text>((status message))</text>
+ <guid>((guidguidguidguidguidguidguid))</guid>
+ <author>[email protected]</author>
+ <public>false</public>
+ <created_at>2011-07-20 01:36:07 UTC</created_at>
+ <provider_display_name>Socialhome</provider_display_name>
+ </status_message>
"""
-DIASPORA_POST_INVALID = """<XML>
- <post>
- <status_message>
- <raw_message>((status message))</raw_message>
- <diaspora_handle>[email protected]</diaspora_handle>
- <public>false</public>
- <created_at>2011-07-20T01:36:07Z</created_at>
- <provider_display_name>Socialhome</provider_display_name>
- </status_message>
- </post>
- </XML>
+DIASPORA_POST_WITH_PHOTOS = """
+ <status_message>
+ <text>((status message))</text>
+ <guid>((guidguidguidguidguidguidguid))</guid>
+ <author>[email protected]</author>
+ <public>false</public>
+ <created_at>2011-07-20T01:36:07Z</created_at>
+ <provider_display_name>Socialhome</provider_display_name>
+ <photo>
+ <guid>((guidguidguidguidguidguidguif))</guid>
+ <author>[email protected]</author>
+ <public>false</public>
+ <created_at>2011-07-20T01:36:07Z</created_at>
+ <remote_photo_path>https://alice.diaspora.example.org/uploads/images/</remote_photo_path>
+ <remote_photo_name>1234.jpg</remote_photo_name>
+ <text/>
+ <status_message_guid>((guidguidguidguidguidguidguid))</status_message_guid>
+ <height>120</height>
+ <width>120</width>
+ </photo>
+ </status_message>
"""
-DIASPORA_POST_COMMENT = """<XML>
- <post>
- <comment>
- <guid>((guidguidguidguidguidguid))</guid>
- <parent_guid>((parent_guidparent_guidparent_guidparent_guid))</parent_guid>
- <author_signature>((base64-encoded data))</author_signature>
- <text>((text))</text>
- <diaspora_handle>[email protected]</diaspora_handle>
- <author_signature>((signature))</author_signature>
- </comment>
- </post>
- </XML>
+
+DIASPORA_POST_INVALID = """
+ <status_message>
+ <text>((status message))</text>
+ <author>[email protected]</author>
+ <public>false</public>
+ <created_at>2011-07-20T01:36:07Z</created_at>
+ <provider_display_name>Socialhome</provider_display_name>
+ </status_message>
"""
-DIASPORA_POST_LIKE = """<XML>
- <post>
- <like>
- <target_type>Post</target_type>
- <guid>((guidguidguidguidguidguid))</guid>
- <parent_guid>((parent_guidparent_guidparent_guidparent_guid))</parent_guid>
- <author_signature>((base64-encoded data))</author_signature>
- <positive>true</positive>
- <diaspora_handle>[email protected]</diaspora_handle>
- <author_signature>((signature))</author_signature>
- </like>
- </post>
- </XML>
+DIASPORA_POST_COMMENT = """
+ <comment>
+ <guid>((guidguidguidguidguidguid))</guid>
+ <parent_guid>((parent_guidparent_guidparent_guidparent_guid))</parent_guid>
+ <author_signature>((base64-encoded data))</author_signature>
+ <text>((text))</text>
+ <author>[email protected]</author>
+ <author_signature>((signature))</author_signature>
+ </comment>
"""
-DIASPORA_REQUEST = """<XML>
- <post>
- <request>
- <sender_handle>[email protected]</sender_handle>
- <recipient_handle>[email protected]</recipient_handle>
- </request>
- </post>
- </XML>
+DIASPORA_POST_LIKE = """
+ <like>
+ <parent_type>Post</parent_type>
+ <guid>((guidguidguidguidguidguid))</guid>
+ <parent_guid>((parent_guidparent_guidparent_guidparent_guid))</parent_guid>
+ <author_signature>((base64-encoded data))</author_signature>
+ <positive>true</positive>
+ <author>[email protected]</author>
+ <author_signature>((signature))</author_signature>
+ </like>
+"""
+
+DIASPORA_REQUEST = """
+ <request>
+ <author>[email protected]</author>
+ <recipient>[email protected]</recipient>
+ </request>
"""
-DIASPORA_PROFILE = """<XML>
- <post>
- <profile>
- <diaspora_handle>[email protected]</diaspora_handle>
- <first_name>Bob Bobertson</first_name>
- <last_name></last_name>
- <image_url>https://example.com/uploads/images/thumb_large_c833747578b5.jpg</image_url>
- <image_url_small>https://example.com/uploads/images/thumb_small_c8b147578b5.jpg</image_url_small>
- <image_url_medium>https://example.com/uploads/images/thumb_medium_c8b1aab04f3.jpg</image_url_medium>
- <gender></gender>
- <bio>A cool bio</bio>
- <location>Helsinki</location>
- <searchable>true</searchable>
- <nsfw>false</nsfw>
- <tag_string>#socialfederation #federation</tag_string>
- </profile>
- </post>
-</XML>
+DIASPORA_PROFILE = """
+ <profile>
+ <author>[email protected]</author>
+ <first_name>Bob Bobertson</first_name>
+ <last_name></last_name>
+ <image_url>https://example.com/uploads/images/thumb_large_c833747578b5.jpg</image_url>
+ <image_url_small>https://example.com/uploads/images/thumb_small_c8b147578b5.jpg</image_url_small>
+ <image_url_medium>https://example.com/uploads/images/thumb_medium_c8b1aab04f3.jpg</image_url_medium>
+ <gender></gender>
+ <bio>A cool bio</bio>
+ <location>Helsinki</location>
+ <searchable>true</searchable>
+ <nsfw>false</nsfw>
+ <tag_string>#socialfederation #federation</tag_string>
+ </profile>
"""
-DIASPORA_RETRACTION = """<XML>
- <post>
- <retraction>
- <author>[email protected]</author>
- <target_guid>xxxxxxxxxxxxxxxx</target_guid>
- <target_type>Post</target_type>
- </retraction>
- </post>
-</XML>
+DIASPORA_RETRACTION = """
+ <retraction>
+ <author>[email protected]</author>
+ <target_guid>xxxxxxxxxxxxxxxx</target_guid>
+ <target_type>Post</target_type>
+ </retraction>
"""
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 2
}
|
0.10
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-warnings"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc libxml2-dev libxslt1-dev"
],
"python": "3.6",
"reqs_path": [
"dev-requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
arrow==1.2.3
attrs==22.2.0
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
colorama==0.4.5
commonmark==0.9.1
coverage==6.2
cssselect==1.1.0
dirty-validators==0.3.2
docutils==0.18.1
factory-boy==3.2.1
Faker==14.2.1
-e git+https://github.com/jaywink/federation.git@3a2910afc2329fc4f052bd01a1eae6927a0c1ac8#egg=federation
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
iniconfig==1.1.1
isodate==0.6.1
Jinja2==3.0.3
jsonschema==2.6.0
livereload==2.6.3
lxml==3.8.0
MarkupSafe==2.0.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pycrypto==2.6.1
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
pytest-warnings==0.3.1
python-dateutil==2.9.0.post0
python-xrd==0.1
pytz==2025.2
recommonmark==0.7.1
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-autobuild==2021.3.14
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tomli==1.2.3
tornado==6.1
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0
|
name: federation
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- arrow==1.2.3
- attrs==22.2.0
- babel==2.11.0
- charset-normalizer==2.0.12
- codecov==2.1.13
- colorama==0.4.5
- commonmark==0.9.1
- coverage==6.2
- cssselect==1.1.0
- dirty-validators==0.3.2
- docutils==0.18.1
- factory-boy==3.2.1
- faker==14.2.1
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- isodate==0.6.1
- jinja2==3.0.3
- jsonschema==2.6.0
- livereload==2.6.3
- lxml==3.8.0
- markupsafe==2.0.1
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pycrypto==2.6.1
- pygments==2.14.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- pytest-warnings==0.3.1
- python-dateutil==2.9.0.post0
- python-xrd==0.1
- pytz==2025.2
- recommonmark==0.7.1
- requests==2.27.1
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==5.3.0
- sphinx-autobuild==2021.3.14
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- tomli==1.2.3
- tornado==6.1
- typing-extensions==4.1.1
- urllib3==1.26.20
- zipp==3.6.0
prefix: /opt/conda/envs/federation
|
[
"federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_simple_post",
"federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_legact_timestamp",
"federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_post_with_photos",
"federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_comment",
"federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_like",
"federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_request",
"federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_profile",
"federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_retraction",
"federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_invalid_entity_logs_an_error",
"federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_adds_source_protocol_to_entity",
"federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_element_to_objects_calls_sender_key_fetcher",
"federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_element_to_objects_calls_retrieve_remote_profile"
] |
[] |
[
"federation/tests/entities/diaspora/test_mappers.py::TestDiasporaEntityMappersReceive::test_message_to_objects_post_legacy",
"federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_already_fine_entities_are_returned_as_is",
"federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_post_is_converted_to_diasporapost",
"federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_comment_is_converted_to_diasporacomment",
"federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_reaction_of_like_is_converted_to_diasporalike",
"federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_relationship_of_sharing_or_following_is_converted_to_diasporarequest",
"federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_profile_is_converted_to_diasporaprofile",
"federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_other_reaction_raises",
"federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_other_relation_raises",
"federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_retraction_is_converted_to_diasporaretraction",
"federation/tests/entities/diaspora/test_mappers.py::TestGetOutboundEntity::test_signs_relayable_if_no_signature"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 1,234 |
|
pre-commit__pre-commit-537
|
e3b14c35f782ed464e3f96b44e8509048187689f
|
2017-05-10 19:53:23
|
e3b14c35f782ed464e3f96b44e8509048187689f
|
diff --git a/pre_commit/git.py b/pre_commit/git.py
index d4277e7..2ed0299 100644
--- a/pre_commit/git.py
+++ b/pre_commit/git.py
@@ -48,10 +48,10 @@ def is_in_merge_conflict():
def parse_merge_msg_for_conflicts(merge_msg):
# Conflicted files start with tabs
return [
- line.lstrip('#').strip()
+ line.lstrip(b'#').strip().decode('UTF-8')
for line in merge_msg.splitlines()
# '#\t' for git 2.4.1
- if line.startswith(('\t', '#\t'))
+ if line.startswith((b'\t', b'#\t'))
]
@@ -60,7 +60,7 @@ def get_conflicted_files():
logger.info('Checking merge-conflict files only.')
# Need to get the conflicted files from the MERGE_MSG because they could
# have resolved the conflict by choosing one side or the other
- merge_msg = open(os.path.join(get_git_dir('.'), 'MERGE_MSG')).read()
+ merge_msg = open(os.path.join(get_git_dir('.'), 'MERGE_MSG'), 'rb').read()
merge_conflict_filenames = parse_merge_msg_for_conflicts(merge_msg)
# This will get the rest of the changes made after the merge.
|
Unicode error: python 2 + merge conflict + non-ascii commit message
The important part of the stack:
```
File "...python2.7/site-packages/pre_commit/commands/run.py", line 52, in get_filenames
return getter(include_expr, exclude_expr)
File "...python2.7/site-packages/pre_commit/util.py", line 46, in wrapper
ret = wrapper._cache[key] = func(*args)
File "...python2.7/site-packages/pre_commit/git.py", line 98, in wrapper
for filename in all_file_list_strategy()
File "...python2.7/site-packages/pre_commit/util.py", line 46, in wrapper
ret = wrapper._cache[key] = func(*args)
File "...python2.7/site-packages/pre_commit/git.py", line 64, in get_conflicted_files
merge_conflict_filenames = parse_merge_msg_for_conflicts(merge_msg)
File "...python2.7/site-packages/pre_commit/git.py", line 54, in parse_merge_msg_for_conflicts
if line.startswith(('\t', '#\t'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 37: ordinal not in range(128)
```
An easy fix: https://github.com/pre-commit/pre-commit/blob/e3b14c35f782ed464e3f96b44e8509048187689f/pre_commit/git.py#L63
|
pre-commit/pre-commit
|
diff --git a/tests/commands/install_uninstall_test.py b/tests/commands/install_uninstall_test.py
index cd4c685..ad8d245 100644
--- a/tests/commands/install_uninstall_test.py
+++ b/tests/commands/install_uninstall_test.py
@@ -1,3 +1,4 @@
+# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
@@ -190,6 +191,18 @@ def test_commit_am(tempdir_factory):
assert ret == 0
+def test_unicode_merge_commit_message(tempdir_factory):
+ path = make_consuming_repo(tempdir_factory, 'script_hooks_repo')
+ with cwd(path):
+ assert install(Runner(path, C.CONFIG_FILE)) == 0
+ cmd_output('git', 'checkout', 'master', '-b', 'foo')
+ cmd_output('git', 'commit', '--allow-empty', '-m', 'branch2')
+ cmd_output('git', 'checkout', 'master')
+ cmd_output('git', 'merge', 'foo', '--no-ff', '--no-commit', '-m', '☃')
+ # Used to crash
+ cmd_output('git', 'commit', '--no-edit')
+
+
def test_install_idempotent(tempdir_factory):
path = make_consuming_repo(tempdir_factory, 'script_hooks_repo')
with cwd(path):
diff --git a/tests/git_test.py b/tests/git_test.py
index c18dcd8..ffe1c1a 100644
--- a/tests/git_test.py
+++ b/tests/git_test.py
@@ -142,8 +142,8 @@ def test_get_conflicted_files_unstaged_files(in_merge_conflict):
assert ret == {'conflict_file'}
-MERGE_MSG = "Merge branch 'foo' into bar\n\nConflicts:\n\tconflict_file\n"
-OTHER_MERGE_MSG = MERGE_MSG + '\tother_conflict_file\n'
+MERGE_MSG = b"Merge branch 'foo' into bar\n\nConflicts:\n\tconflict_file\n"
+OTHER_MERGE_MSG = MERGE_MSG + b'\tother_conflict_file\n'
@pytest.mark.parametrize(
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 1
},
"num_modified_files": 1
}
|
0.13
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"numpy>=1.16.0",
"pandas>=1.0.0",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
aspy.yaml==1.3.0
cached-property==2.0.1
coverage==7.8.0
distlib==0.3.9
exceptiongroup==1.2.2
filelock==3.18.0
flake8==7.2.0
iniconfig==2.1.0
mccabe==0.7.0
mock==5.2.0
nodeenv==1.9.1
numpy==2.0.2
packaging==24.2
pandas==2.2.3
platformdirs==4.3.7
pluggy==1.5.0
-e git+https://github.com/pre-commit/pre-commit.git@e3b14c35f782ed464e3f96b44e8509048187689f#egg=pre_commit
pycodestyle==2.13.0
pyflakes==3.3.1
pytest==8.3.5
pytest-env==1.1.5
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.2
six==1.17.0
tomli==2.2.1
tzdata==2025.2
virtualenv==20.29.3
|
name: pre-commit
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- aspy-yaml==1.3.0
- cached-property==2.0.1
- coverage==7.8.0
- distlib==0.3.9
- exceptiongroup==1.2.2
- filelock==3.18.0
- flake8==7.2.0
- iniconfig==2.1.0
- mccabe==0.7.0
- mock==5.2.0
- nodeenv==1.9.1
- numpy==2.0.2
- packaging==24.2
- pandas==2.2.3
- platformdirs==4.3.7
- pluggy==1.5.0
- pycodestyle==2.13.0
- pyflakes==3.3.1
- pytest==8.3.5
- pytest-env==1.1.5
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==6.0.2
- setuptools==18.4
- six==1.17.0
- tomli==2.2.1
- tzdata==2025.2
- virtualenv==20.29.3
prefix: /opt/conda/envs/pre-commit
|
[
"tests/git_test.py::test_parse_merge_msg_for_conflicts[Merge"
] |
[
"tests/commands/install_uninstall_test.py::test_install_pre_commit_and_run",
"tests/commands/install_uninstall_test.py::test_install_in_submodule_and_run",
"tests/commands/install_uninstall_test.py::test_install_idempotent",
"tests/commands/install_uninstall_test.py::test_failing_hooks_returns_nonzero",
"tests/commands/install_uninstall_test.py::test_install_existing_hooks_no_overwrite",
"tests/commands/install_uninstall_test.py::test_install_existing_hook_no_overwrite_idempotent",
"tests/commands/install_uninstall_test.py::test_failing_existing_hook_returns_1",
"tests/commands/install_uninstall_test.py::test_install_overwrite_no_existing_hooks",
"tests/commands/install_uninstall_test.py::test_install_overwrite",
"tests/commands/install_uninstall_test.py::test_replace_old_commit_script",
"tests/commands/install_uninstall_test.py::test_installs_hooks_with_hooks_True",
"tests/commands/install_uninstall_test.py::test_install_hooks_command",
"tests/commands/install_uninstall_test.py::test_installed_from_venv"
] |
[
"tests/commands/install_uninstall_test.py::test_is_not_script",
"tests/commands/install_uninstall_test.py::test_is_script",
"tests/commands/install_uninstall_test.py::test_is_previous_pre_commit",
"tests/commands/install_uninstall_test.py::test_install_pre_commit",
"tests/commands/install_uninstall_test.py::test_install_hooks_directory_not_present",
"tests/commands/install_uninstall_test.py::test_install_hooks_dead_symlink",
"tests/commands/install_uninstall_test.py::test_uninstall_does_not_blow_up_when_not_there",
"tests/commands/install_uninstall_test.py::test_uninstall",
"tests/commands/install_uninstall_test.py::test_commit_am",
"tests/commands/install_uninstall_test.py::test_unicode_merge_commit_message",
"tests/commands/install_uninstall_test.py::test_environment_not_sourced",
"tests/commands/install_uninstall_test.py::test_uninstall_restores_legacy_hooks",
"tests/commands/install_uninstall_test.py::test_uninstall_doesnt_remove_not_our_hooks",
"tests/commands/install_uninstall_test.py::test_pre_push_integration_failing",
"tests/commands/install_uninstall_test.py::test_pre_push_integration_accepted",
"tests/commands/install_uninstall_test.py::test_pre_push_integration_empty_push",
"tests/commands/install_uninstall_test.py::test_install_disallow_mising_config",
"tests/commands/install_uninstall_test.py::test_install_allow_mising_config",
"tests/commands/install_uninstall_test.py::test_install_temporarily_allow_mising_config",
"tests/git_test.py::test_get_root_at_root",
"tests/git_test.py::test_get_root_deeper",
"tests/git_test.py::test_get_root_not_git_dir",
"tests/git_test.py::test_get_staged_files_deleted",
"tests/git_test.py::test_is_not_in_merge_conflict",
"tests/git_test.py::test_is_in_merge_conflict",
"tests/git_test.py::test_cherry_pick_conflict",
"tests/git_test.py::test_get_files_matching_base",
"tests/git_test.py::test_get_files_matching_total_match",
"tests/git_test.py::test_does_search_instead_of_match",
"tests/git_test.py::test_does_not_include_deleted_fileS",
"tests/git_test.py::test_exclude_removes_files",
"tests/git_test.py::test_get_conflicted_files",
"tests/git_test.py::test_get_conflicted_files_unstaged_files"
] |
[] |
MIT License
| 1,238 |
|
erikrose__parsimonious-113
|
30b94f1be71a7be640f3f4285a34cc495e18b87a
|
2017-05-11 00:15:58
|
30b94f1be71a7be640f3f4285a34cc495e18b87a
|
diff --git a/parsimonious/expressions.py b/parsimonious/expressions.py
index 5e2d2b9..dda8fd9 100644
--- a/parsimonious/expressions.py
+++ b/parsimonious/expressions.py
@@ -78,7 +78,7 @@ def expression(callable, rule_name, grammar):
else:
# Node or None
return result
- return Node(self.name, text, pos, end, children=children)
+ return Node(self, text, pos, end, children=children)
def _as_rhs(self):
return '{custom function "%s"}' % callable.__name__
@@ -94,10 +94,20 @@ class Expression(StrAndRepr):
# http://stackoverflow.com/questions/1336791/dictionary-vs-object-which-is-more-efficient-and-why
# Top-level expressions--rules--have names. Subexpressions are named ''.
- __slots__ = ['name']
+ __slots__ = ['name', 'identity_tuple']
def __init__(self, name=''):
self.name = name
+ self.identity_tuple = (self.name, )
+
+ def __hash__(self):
+ return hash(self.identity_tuple)
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__) and self.identity_tuple == other.identity_tuple
+
+ def __ne__(self, other):
+ return not (self == other)
def parse(self, text, pos=0):
"""Return a parse tree of ``text``.
@@ -180,10 +190,9 @@ class Expression(StrAndRepr):
return node
def __str__(self):
- return u'<%s %s at 0x%s>' % (
+ return u'<%s %s>' % (
self.__class__.__name__,
- self.as_rule(),
- id(self))
+ self.as_rule())
def as_rule(self):
"""Return the left- and right-hand sides of a rule that represents me.
@@ -223,10 +232,11 @@ class Literal(Expression):
def __init__(self, literal, name=''):
super(Literal, self).__init__(name)
self.literal = literal
+ self.identity_tuple = (name, literal)
def _uncached_match(self, text, pos, cache, error):
if text.startswith(self.literal, pos):
- return Node(self.name, text, pos, pos + len(self.literal))
+ return Node(self, text, pos, pos + len(self.literal))
def _as_rhs(self):
# TODO: Get backslash escaping right.
@@ -241,7 +251,7 @@ class TokenMatcher(Literal):
"""
def _uncached_match(self, token_list, pos, cache, error):
if token_list[pos].type == self.literal:
- return Node(self.name, token_list, pos, pos + 1)
+ return Node(self, token_list, pos, pos + 1)
class Regex(Expression):
@@ -262,13 +272,14 @@ class Regex(Expression):
(dot_all and re.S) |
(unicode and re.U) |
(verbose and re.X))
+ self.identity_tuple = (self.name, self.re)
def _uncached_match(self, text, pos, cache, error):
"""Return length of match, ``None`` if no match."""
m = self.re.match(text, pos)
if m is not None:
span = m.span()
- node = RegexNode(self.name, text, pos, pos + span[1] - span[0])
+ node = RegexNode(self, text, pos, pos + span[1] - span[0])
node.match = m # TODO: A terrible idea for cache size?
return node
@@ -293,6 +304,18 @@ class Compound(Expression):
super(Compound, self).__init__(kwargs.get('name', ''))
self.members = members
+ def __hash__(self):
+ # Note we leave members out of the hash computation, since compounds can get added to
+ # sets, then have their members mutated. See RuleVisitor._resolve_refs.
+ # Equality should still work, but we want the rules to go into the correct hash bucket.
+ return hash((self.__class__, self.name))
+
+ def __eq__(self, other):
+ return (
+ isinstance(other, self.__class__) and
+ self.name == other.name and
+ self.members == other.members)
+
class Sequence(Compound):
"""A series of expressions that must match contiguous, ordered pieces of
@@ -315,7 +338,7 @@ class Sequence(Compound):
new_pos += length
length_of_sequence += length
# Hooray! We got through all the members!
- return Node(self.name, text, pos, pos + length_of_sequence, children)
+ return Node(self, text, pos, pos + length_of_sequence, children)
def _as_rhs(self):
return u'({0})'.format(u' '.join(self._unicode_members()))
@@ -333,7 +356,7 @@ class OneOf(Compound):
node = m.match_core(text, pos, cache, error)
if node is not None:
# Wrap the succeeding child in a node representing the OneOf:
- return Node(self.name, text, pos, node.end, children=[node])
+ return Node(self, text, pos, node.end, children=[node])
def _as_rhs(self):
return u'({0})'.format(u' / '.join(self._unicode_members()))
@@ -350,7 +373,7 @@ class Lookahead(Compound):
def _uncached_match(self, text, pos, cache, error):
node = self.members[0].match_core(text, pos, cache, error)
if node is not None:
- return Node(self.name, text, pos, pos)
+ return Node(self, text, pos, pos)
def _as_rhs(self):
return u'&%s' % self._unicode_members()[0]
@@ -367,7 +390,7 @@ class Not(Compound):
# not bother to cache NOTs directly.
node = self.members[0].match_core(text, pos, cache, error)
if node is None:
- return Node(self.name, text, pos, pos)
+ return Node(self, text, pos, pos)
def _as_rhs(self):
# TODO: Make sure this parenthesizes the member properly if it's an OR
@@ -386,8 +409,8 @@ class Optional(Compound):
"""
def _uncached_match(self, text, pos, cache, error):
node = self.members[0].match_core(text, pos, cache, error)
- return (Node(self.name, text, pos, pos) if node is None else
- Node(self.name, text, pos, node.end, children=[node]))
+ return (Node(self, text, pos, pos) if node is None else
+ Node(self, text, pos, node.end, children=[node]))
def _as_rhs(self):
return u'%s?' % self._unicode_members()[0]
@@ -404,7 +427,7 @@ class ZeroOrMore(Compound):
node = self.members[0].match_core(text, new_pos, cache, error)
if node is None or not (node.end - node.start):
# Node was None or 0 length. 0 would otherwise loop infinitely.
- return Node(self.name, text, pos, new_pos, children)
+ return Node(self, text, pos, new_pos, children)
children.append(node)
new_pos += node.end - node.start
@@ -441,7 +464,7 @@ class OneOrMore(Compound):
break
new_pos += length
if len(children) >= self.min:
- return Node(self.name, text, pos, new_pos, children)
+ return Node(self, text, pos, new_pos, children)
def _as_rhs(self):
return u'%s+' % self._unicode_members()[0]
diff --git a/parsimonious/grammar.py b/parsimonious/grammar.py
index b6386d0..b7b1c29 100644
--- a/parsimonious/grammar.py
+++ b/parsimonious/grammar.py
@@ -420,8 +420,8 @@ class RuleVisitor(NodeVisitor):
# of `expr.members` can refer back to `expr`, but it can't go
# any farther.
done.add(expr)
- expr.members = [self._resolve_refs(rule_map, member, done)
- for member in expr.members]
+ expr.members = tuple(self._resolve_refs(rule_map, member, done)
+ for member in expr.members)
return expr
def visit_rules(self, node, rules_list):
diff --git a/parsimonious/nodes.py b/parsimonious/nodes.py
index 77ad1f9..8c8d1af 100644
--- a/parsimonious/nodes.py
+++ b/parsimonious/nodes.py
@@ -34,20 +34,25 @@ class Node(object):
"""
# I tried making this subclass list, but it got ugly. I had to construct
# invalid ones and patch them up later, and there were other problems.
- __slots__ = ['expr_name', # The name of the expression that generated me
+ __slots__ = ['expr', # The expression that generated me
'full_text', # The full text fed to the parser
'start', # The position in the text where that expr started matching
'end', # The position after start where the expr first didn't
# match. [start:end] follow Python slice conventions.
'children'] # List of child parse tree nodes
- def __init__(self, expr_name, full_text, start, end, children=None):
- self.expr_name = expr_name
+ def __init__(self, expr, full_text, start, end, children=None):
+ self.expr = expr
self.full_text = full_text
self.start = start
self.end = end
self.children = children or []
+ @property
+ def expr_name(self):
+ # backwards compatibility
+ return self.expr.name
+
def __iter__(self):
"""Support looping over my children and doing tuple unpacks on me.
@@ -92,7 +97,7 @@ class Node(object):
if not isinstance(other, Node):
return NotImplemented
- return (self.expr_name == other.expr_name and
+ return (self.expr == other.expr and
self.full_text == other.full_text and
self.start == other.start and
self.end == other.end and
@@ -109,7 +114,7 @@ class Node(object):
ret = ["s = %r" % self.full_text] if top_level else []
ret.append("%s(%r, s, %s, %s%s)" % (
self.__class__.__name__,
- self.expr_name,
+ self.expr,
self.start,
self.end,
(', children=[%s]' %
@@ -233,8 +238,8 @@ class NodeVisitor(with_metaclass(RuleDecoratorMeta, object)):
for now.
"""
- raise NotImplementedError('No visitor method was defined for "%s".' %
- node.expr_name)
+ raise NotImplementedError('No visitor method was defined for this expression: %s' %
+ node.expr.as_rule())
# Convenience methods:
diff --git a/tox.ini b/tox.ini
index f1fa5e6..9a8519a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -11,4 +11,6 @@ envlist = py27, py33, py34, py35, py36
[testenv]
usedevelop = True
commands = nosetests parsimonious
-deps = nose
+deps =
+ nose
+ six>=1.9.0
|
Unnamed nodes should make up useful names for themselves
When you print a node, you get something like this:
```
<Node called "char_range" matching "c-a">
<Node called "class_char" matching "c">
<RegexNode matching "c">
<Node matching "-">
<Node called "class_char" matching "a">
<RegexNode matching "a">
```
Named nodes get names, but unnamed ones (like the one matching "-") don't. Especially when debugging—for instance, ending up in visit_generic and not knowing what node triggered that dispatch—it would be helpful if nodes would identify themselves by their rule expression: `<Node "class_item*" matching "abc">`. Then we take the "called" out of the named nodes, and everything is frighteningly consistent.
|
erikrose/parsimonious
|
diff --git a/parsimonious/tests/test_expressions.py b/parsimonious/tests/test_expressions.py
index 2d0360b..58734b9 100644
--- a/parsimonious/tests/test_expressions.py
+++ b/parsimonious/tests/test_expressions.py
@@ -82,49 +82,49 @@ class TreeTests(TestCase):
def test_simple_node(self):
"""Test that leaf expressions like ``Literal`` make the right nodes."""
h = Literal('hello', name='greeting')
- eq_(h.match('hello'), Node('greeting', 'hello', 0, 5))
+ eq_(h.match('hello'), Node(h, 'hello', 0, 5))
def test_sequence_nodes(self):
"""Assert that ``Sequence`` produces nodes with the right children."""
s = Sequence(Literal('heigh', name='greeting1'),
Literal('ho', name='greeting2'), name='dwarf')
text = 'heighho'
- eq_(s.match(text), Node('dwarf', text, 0, 7, children=
- [Node('greeting1', text, 0, 5),
- Node('greeting2', text, 5, 7)]))
+ eq_(s.match(text), Node(s, text, 0, 7, children=
+ [Node(s.members[0], text, 0, 5),
+ Node(s.members[1], text, 5, 7)]))
def test_one_of(self):
"""``OneOf`` should return its own node, wrapping the child that succeeds."""
o = OneOf(Literal('a', name='lit'), name='one_of')
text = 'aa'
- eq_(o.match(text), Node('one_of', text, 0, 1, children=[
- Node('lit', text, 0, 1)]))
+ eq_(o.match(text), Node(o, text, 0, 1, children=[
+ Node(o.members[0], text, 0, 1)]))
def test_optional(self):
"""``Optional`` should return its own node wrapping the succeeded child."""
expr = Optional(Literal('a', name='lit'), name='opt')
text = 'a'
- eq_(expr.match(text), Node('opt', text, 0, 1, children=[
- Node('lit', text, 0, 1)]))
+ eq_(expr.match(text), Node(expr, text, 0, 1, children=[
+ Node(expr.members[0], text, 0, 1)]))
# Test failure of the Literal inside the Optional; the
# LengthTests.test_optional is ambiguous for that.
text = ''
- eq_(expr.match(text), Node('opt', text, 0, 0))
+ eq_(expr.match(text), Node(expr, text, 0, 0))
def test_zero_or_more_zero(self):
"""Test the 0 case of ``ZeroOrMore``; it should still return a node."""
expr = ZeroOrMore(Literal('a'), name='zero')
text = ''
- eq_(expr.match(text), Node('zero', text, 0, 0))
+ eq_(expr.match(text), Node(expr, text, 0, 0))
def test_one_or_more_one(self):
"""Test the 1 case of ``OneOrMore``; it should return a node with a child."""
expr = OneOrMore(Literal('a', name='lit'), name='one')
text = 'a'
- eq_(expr.match(text), Node('one', text, 0, 1, children=[
- Node('lit', text, 0, 1)]))
+ eq_(expr.match(text), Node(expr, text, 0, 1, children=[
+ Node(expr.members[0], text, 0, 1)]))
# Things added since Grammar got implemented are covered in integration
# tests in test_grammar.
@@ -142,9 +142,9 @@ class ParseTests(TestCase):
"""
expr = OneOrMore(Literal('a', name='lit'), name='more')
text = 'aa'
- eq_(expr.parse(text), Node('more', text, 0, 2, children=[
- Node('lit', text, 0, 1),
- Node('lit', text, 1, 2)]))
+ eq_(expr.parse(text), Node(expr, text, 0, 2, children=[
+ Node(expr.members[0], text, 0, 1),
+ Node(expr.members[0], text, 1, 2)]))
class ErrorReportingTests(TestCase):
diff --git a/parsimonious/tests/test_grammar.py b/parsimonious/tests/test_grammar.py
index 6051c3e..f9af0e8 100644
--- a/parsimonious/tests/test_grammar.py
+++ b/parsimonious/tests/test_grammar.py
@@ -9,7 +9,7 @@ from nose.tools import eq_, assert_raises, ok_
from six import text_type
from parsimonious.exceptions import UndefinedLabel, ParseError
-from parsimonious.expressions import Sequence
+from parsimonious.expressions import Literal, Lookahead, Regex, Sequence, TokenMatcher
from parsimonious.grammar import rule_grammar, RuleVisitor, Grammar, TokenGrammar, LazyReference
from parsimonious.nodes import Node
from parsimonious.utils import Token
@@ -21,37 +21,40 @@ class BootstrappingGrammarTests(TestCase):
def test_quantifier(self):
text = '*'
- eq_(rule_grammar['quantifier'].parse(text),
- Node('quantifier', text, 0, 1, children=[
- Node('', text, 0, 1), Node('_', text, 1, 1)]))
+ quantifier = rule_grammar['quantifier']
+ eq_(quantifier.parse(text),
+ Node(quantifier, text, 0, 1, children=[
+ Node(quantifier.members[0], text, 0, 1), Node(rule_grammar['_'], text, 1, 1)]))
text = '?'
- eq_(rule_grammar['quantifier'].parse(text),
- Node('quantifier', text, 0, 1, children=[
- Node('', text, 0, 1), Node('_', text, 1, 1)]))
+ eq_(quantifier.parse(text),
+ Node(quantifier, text, 0, 1, children=[
+ Node(quantifier.members[0], text, 0, 1), Node(rule_grammar['_'], text, 1, 1)]))
text = '+'
- eq_(rule_grammar['quantifier'].parse(text),
- Node('quantifier', text, 0, 1, children=[
- Node('', text, 0, 1), Node('_', text, 1, 1)]))
+ eq_(quantifier.parse(text),
+ Node(quantifier, text, 0, 1, children=[
+ Node(quantifier.members[0], text, 0, 1), Node(rule_grammar['_'], text, 1, 1)]))
def test_spaceless_literal(self):
text = '"anything but quotes#$*&^"'
- eq_(rule_grammar['spaceless_literal'].parse(text),
- Node('spaceless_literal', text, 0, len(text), children=[
- Node('', text, 0, len(text))]))
+ spaceless_literal = rule_grammar['spaceless_literal']
+ eq_(spaceless_literal.parse(text),
+ Node(spaceless_literal, text, 0, len(text), children=[
+ Node(spaceless_literal.members[0], text, 0, len(text))]))
text = r'''r"\""'''
- eq_(rule_grammar['spaceless_literal'].parse(text),
- Node('spaceless_literal', text, 0, 5, children=[
- Node('', text, 0, 5)]))
+ eq_(spaceless_literal.parse(text),
+ Node(spaceless_literal, text, 0, 5, children=[
+ Node(spaceless_literal.members[0], text, 0, 5)]))
def test_regex(self):
text = '~"[a-zA-Z_][a-zA-Z_0-9]*"LI'
+ regex = rule_grammar['regex']
eq_(rule_grammar['regex'].parse(text),
- Node('regex', text, 0, len(text), children=[
- Node('', text, 0, 1),
- Node('spaceless_literal', text, 1, 25, children=[
- Node('', text, 1, 25)]),
- Node('', text, 25, 27),
- Node('_', text, 27, 27)]))
+ Node(regex, text, 0, len(text), children=[
+ Node(Literal('~'), text, 0, 1),
+ Node(rule_grammar['spaceless_literal'], text, 1, 25, children=[
+ Node(rule_grammar['spaceless_literal'].members[0], text, 1, 25)]),
+ Node(regex.members[2], text, 25, 27),
+ Node(rule_grammar['_'], text, 27, 27)]))
def test_successes(self):
"""Make sure the PEG recognition grammar succeeds on various inputs."""
@@ -117,7 +120,7 @@ class RuleVisitorTests(TestCase):
rules, default_rule = RuleVisitor().visit(tree)
text = '98'
- eq_(default_rule.parse(text), Node('number', text, 0, 2))
+ eq_(default_rule.parse(text), Node(default_rule, text, 0, 2))
def test_undefined_rule(self):
"""Make sure we throw the right exception on undefined rules."""
@@ -132,8 +135,8 @@ class RuleVisitorTests(TestCase):
# It should turn into a Node from the Optional and another from the
# Literal within.
- eq_(default_rule.parse(howdy), Node('boy', howdy, 0, 5, children=[
- Node('', howdy, 0, 5)]))
+ eq_(default_rule.parse(howdy), Node(default_rule, howdy, 0, 5, children=[
+ Node(Literal("howdy"), howdy, 0, 5)]))
class GrammarTests(TestCase):
@@ -150,8 +153,8 @@ class GrammarTests(TestCase):
"""
greeting_grammar = Grammar('greeting = "hi" / "howdy"')
tree = greeting_grammar.parse('hi')
- eq_(tree, Node('greeting', 'hi', 0, 2, children=[
- Node('', 'hi', 0, 2)]))
+ eq_(tree, Node(greeting_grammar['greeting'], 'hi', 0, 2, children=[
+ Node(Literal('hi'), 'hi', 0, 2)]))
def test_unicode(self):
"""Assert that a ``Grammar`` can convert into a string-formatted series
@@ -179,10 +182,10 @@ class GrammarTests(TestCase):
bold_close = "))"
""")
s = ' ((boo))yah'
- eq_(grammar.match(s, pos=1), Node('bold_text', s, 1, 8, children=[
- Node('bold_open', s, 1, 3),
- Node('text', s, 3, 6),
- Node('bold_close', s, 6, 8)]))
+ eq_(grammar.match(s, pos=1), Node(grammar['bold_text'], s, 1, 8, children=[
+ Node(grammar['bold_open'], s, 1, 3),
+ Node(grammar['text'], s, 3, 6),
+ Node(grammar['bold_close'], s, 6, 8)]))
def test_bad_grammar(self):
"""Constructing a Grammar with bad rules should raise ParseError."""
@@ -232,9 +235,9 @@ class GrammarTests(TestCase):
assert_raises(ParseError, grammar.parse, 'burp')
s = 'arp'
- eq_(grammar.parse('arp'), Node('starts_with_a', s, 0, 3, children=[
- Node('', s, 0, 0),
- Node('', s, 0, 3)]))
+ eq_(grammar.parse('arp'), Node(grammar['starts_with_a'], s, 0, 3, children=[
+ Node(Lookahead(Literal('a')), s, 0, 0),
+ Node(Regex(r'[a-z]+'), s, 0, 3)]))
def test_parens(self):
grammar = Grammar(r'''sequence = "chitty" (" " "bang")+''')
@@ -313,10 +316,10 @@ class GrammarTests(TestCase):
(pos + 1) if text[pos].isdigit() else None)
s = '[6]'
eq_(grammar.parse(s),
- Node('bracketed_digit', s, 0, 3, children=[
- Node('start', s, 0, 1),
- Node('digit', s, 1, 2),
- Node('end', s, 2, 3)]))
+ Node(grammar['bracketed_digit'], s, 0, 3, children=[
+ Node(grammar['start'], s, 0, 1),
+ Node(grammar['digit'], s, 1, 2),
+ Node(grammar['end'], s, 2, 3)]))
def test_complex_custom_rules(self):
"""Run 5-arg custom rules through their paces.
@@ -337,10 +340,10 @@ class GrammarTests(TestCase):
grammar['real_digit'].match_core(text, pos, cache, error))
s = '[6]'
eq_(grammar.parse(s),
- Node('bracketed_digit', s, 0, 3, children=[
- Node('start', s, 0, 1),
- Node('real_digit', s, 1, 2),
- Node('end', s, 2, 3)]))
+ Node(grammar['bracketed_digit'], s, 0, 3, children=[
+ Node(grammar['start'], s, 0, 1),
+ Node(grammar['real_digit'], s, 1, 2),
+ Node(grammar['end'], s, 2, 3)]))
def test_lazy_custom_rules(self):
"""Make sure LazyReferences manually shoved into custom rules are
@@ -358,9 +361,9 @@ class GrammarTests(TestCase):
name='forty_five')).default('forty_five')
s = '45'
eq_(grammar.parse(s),
- Node('forty_five', s, 0, 2, children=[
- Node('four', s, 0, 1),
- Node('five', s, 1, 2)]))
+ Node(grammar['forty_five'], s, 0, 2, children=[
+ Node(grammar['four'], s, 0, 1),
+ Node(grammar['five'], s, 1, 2)]))
def test_unconnected_custom_rules(self):
"""Make sure custom rules that aren't hooked to any other rules still
@@ -373,7 +376,7 @@ class GrammarTests(TestCase):
grammar = Grammar(one_char=lambda text, pos: pos + 1).default('one_char')
s = '4'
eq_(grammar.parse(s),
- Node('one_char', s, 0, 1))
+ Node(grammar['one_char'], s, 0, 1))
def test_lazy_default_rule(self):
"""Make sure we get an actual rule set as our default rule, even when
@@ -385,7 +388,7 @@ class GrammarTests(TestCase):
styled_text = text
text = "hi"
""")
- eq_(grammar.parse('hi'), Node('text', 'hi', 0, 2))
+ eq_(grammar.parse('hi'), Node(grammar['text'], 'hi', 0, 2))
def test_immutable_grammar(self):
"""Make sure that a Grammar is immutable after being created."""
@@ -431,9 +434,9 @@ class TokenGrammarTests(TestCase):
token1 = "token1"
""")
eq_(grammar.parse(s),
- Node('foo', s, 0, 2, children=[
- Node('token1', s, 0, 1),
- Node('', s, 1, 2)]))
+ Node(grammar['foo'], s, 0, 2, children=[
+ Node(grammar['token1'], s, 0, 1),
+ Node(TokenMatcher('token2'), s, 1, 2)]))
def test_parse_failure(self):
"""Parse failures should work normally with token literals."""
diff --git a/parsimonious/tests/test_nodes.py b/parsimonious/tests/test_nodes.py
index caf9f68..20f1a53 100644
--- a/parsimonious/tests/test_nodes.py
+++ b/parsimonious/tests/test_nodes.py
@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
from nose import SkipTest
-from nose.tools import eq_, ok_, assert_raises
+from nose.tools import eq_, ok_, assert_raises, assert_in
from parsimonious import Grammar, NodeVisitor, VisitationError, rule
+from parsimonious.expressions import Literal
from parsimonious.nodes import Node
@@ -33,25 +34,19 @@ class ExplosiveFormatter(NodeVisitor):
def test_visitor():
- """Assert a tree gets visited correctly.
-
- We start with a tree from applying this grammar... ::
-
+ """Assert a tree gets visited correctly."""
+ grammar = Grammar(r'''
bold_text = bold_open text bold_close
text = ~'[a-zA-Z 0-9]*'
bold_open = '(('
bold_close = '))'
-
- ...to this text::
-
- ((o hai))
-
- """
+ ''')
text = '((o hai))'
- tree = Node('bold_text', text, 0, 9,
- [Node('bold_open', text, 0, 2),
- Node('text', text, 2, 7),
- Node('bold_close', text, 7, 9)])
+ tree = Node(grammar['bold_text'], text, 0, 9,
+ [Node(grammar['bold_open'], text, 0, 2),
+ Node(grammar['text'], text, 2, 7),
+ Node(grammar['bold_close'], text, 7, 9)])
+ eq_(grammar.parse(text), tree)
result = HtmlFormatter().visit(tree)
eq_(result, '<b>o hai</b>')
@@ -59,12 +54,12 @@ def test_visitor():
def test_visitation_exception():
assert_raises(VisitationError,
ExplosiveFormatter().visit,
- Node('boom', '', 0, 0))
+ Node(Literal(''), '', 0, 0))
def test_str():
"""Test str and unicode of ``Node``."""
- n = Node('text', 'o hai', 0, 5)
+ n = Node(Literal('something', name='text'), 'o hai', 0, 5)
good = '<Node called "text" matching "o hai">'
eq_(str(n), good)
@@ -73,9 +68,16 @@ def test_repr():
"""Test repr of ``Node``."""
s = u'hai ö'
boogie = u'böogie'
- n = Node(boogie, s, 0, 3, children=[
- Node('', s, 3, 4), Node('', s, 4, 5)])
- eq_(repr(n), """s = {hai_o}\nNode({boogie}, s, 0, 3, children=[Node('', s, 3, 4), Node('', s, 4, 5)])""".format(hai_o=repr(s), boogie=repr(boogie)))
+ n = Node(Literal(boogie), s, 0, 3, children=[
+ Node(Literal(' '), s, 3, 4), Node(Literal(u'ö'), s, 4, 5)])
+ eq_(repr(n),
+ str("""s = {hai_o}\nNode({boogie}, s, 0, 3, children=[Node({space}, s, 3, 4), Node({o}, s, 4, 5)])""").format(
+ hai_o=repr(s),
+ boogie=repr(Literal(boogie)),
+ space=repr(Literal(" ")),
+ o=repr(Literal(u"ö")),
+ )
+ )
def test_parse_shortcut():
@@ -145,6 +147,43 @@ def test_unwrapped_exceptions():
def test_node_inequality():
- node = Node('text', 'o hai', 0, 5)
+ node = Node(Literal('12345'), 'o hai', 0, 5)
ok_(node != 5)
ok_(node != None)
+ ok_(node != Node(Literal('23456'), 'o hai', 0, 5))
+ ok_(not (node != Node(Literal('12345'), 'o hai', 0, 5)))
+
+
+def test_generic_visit_NotImplementedError_unnamed_node():
+ """
+ Test that generic_visit provides informative error messages
+ when visitors are not defined.
+
+ Regression test for https://github.com/erikrose/parsimonious/issues/110
+ """
+ class MyVisitor(NodeVisitor):
+ grammar = Grammar(r'''
+ bar = "b" "a" "r"
+ ''')
+ unwrapped_exceptions = (NotImplementedError, )
+
+ with assert_raises(NotImplementedError) as e:
+ MyVisitor().parse('bar')
+ assert_in('No visitor method was defined for this expression: "b"', str(e.exception))
+
+
+def test_generic_visit_NotImplementedError_named_node():
+ """
+ Test that generic_visit provides informative error messages
+ when visitors are not defined.
+ """
+ class MyVisitor(NodeVisitor):
+ grammar = Grammar(r'''
+ bar = myrule myrule myrule
+ myrule = ~"[bar]"
+ ''')
+ unwrapped_exceptions = (NotImplementedError, )
+
+ with assert_raises(NotImplementedError) as e:
+ MyVisitor().parse('bar')
+ assert_in('No visitor method was defined for this expression: myrule = ~"[bar]"', str(e.exception))
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 4
}
|
0.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"nose",
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
nose==1.3.7
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
-e git+https://github.com/erikrose/parsimonious.git@30b94f1be71a7be640f3f4285a34cc495e18b87a#egg=parsimonious
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
six==1.17.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: parsimonious
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- nose==1.3.7
- six==1.17.0
prefix: /opt/conda/envs/parsimonious
|
[
"parsimonious/tests/test_expressions.py::TreeTests::test_one_of",
"parsimonious/tests/test_expressions.py::TreeTests::test_one_or_more_one",
"parsimonious/tests/test_expressions.py::TreeTests::test_optional",
"parsimonious/tests/test_expressions.py::TreeTests::test_sequence_nodes",
"parsimonious/tests/test_expressions.py::TreeTests::test_simple_node",
"parsimonious/tests/test_expressions.py::TreeTests::test_zero_or_more_zero",
"parsimonious/tests/test_expressions.py::ParseTests::test_parse_success",
"parsimonious/tests/test_grammar.py::BootstrappingGrammarTests::test_quantifier",
"parsimonious/tests/test_grammar.py::BootstrappingGrammarTests::test_regex",
"parsimonious/tests/test_grammar.py::BootstrappingGrammarTests::test_spaceless_literal",
"parsimonious/tests/test_grammar.py::RuleVisitorTests::test_optional",
"parsimonious/tests/test_grammar.py::RuleVisitorTests::test_round_trip",
"parsimonious/tests/test_grammar.py::GrammarTests::test_complex_custom_rules",
"parsimonious/tests/test_grammar.py::GrammarTests::test_expressions_from_rules",
"parsimonious/tests/test_grammar.py::GrammarTests::test_lazy_custom_rules",
"parsimonious/tests/test_grammar.py::GrammarTests::test_lazy_default_rule",
"parsimonious/tests/test_grammar.py::GrammarTests::test_lookahead",
"parsimonious/tests/test_grammar.py::GrammarTests::test_match",
"parsimonious/tests/test_grammar.py::GrammarTests::test_simple_custom_rules",
"parsimonious/tests/test_grammar.py::GrammarTests::test_unconnected_custom_rules",
"parsimonious/tests/test_grammar.py::TokenGrammarTests::test_parse_success",
"parsimonious/tests/test_nodes.py::test_visitor",
"parsimonious/tests/test_nodes.py::test_visitation_exception",
"parsimonious/tests/test_nodes.py::test_str",
"parsimonious/tests/test_nodes.py::test_repr",
"parsimonious/tests/test_nodes.py::test_node_inequality",
"parsimonious/tests/test_nodes.py::test_generic_visit_NotImplementedError_unnamed_node",
"parsimonious/tests/test_nodes.py::test_generic_visit_NotImplementedError_named_node"
] |
[] |
[
"parsimonious/tests/test_expressions.py::LengthTests::test_not",
"parsimonious/tests/test_expressions.py::LengthTests::test_one_of",
"parsimonious/tests/test_expressions.py::LengthTests::test_one_or_more",
"parsimonious/tests/test_expressions.py::LengthTests::test_optional",
"parsimonious/tests/test_expressions.py::LengthTests::test_regex",
"parsimonious/tests/test_expressions.py::LengthTests::test_sequence",
"parsimonious/tests/test_expressions.py::LengthTests::test_zero_or_more",
"parsimonious/tests/test_expressions.py::ErrorReportingTests::test_favoring_named_rules",
"parsimonious/tests/test_expressions.py::ErrorReportingTests::test_inner_rule_succeeding",
"parsimonious/tests/test_expressions.py::ErrorReportingTests::test_line_and_column",
"parsimonious/tests/test_expressions.py::ErrorReportingTests::test_no_named_rule_succeeding",
"parsimonious/tests/test_expressions.py::ErrorReportingTests::test_parse_with_leftovers",
"parsimonious/tests/test_expressions.py::ErrorReportingTests::test_rewinding",
"parsimonious/tests/test_expressions.py::RepresentationTests::test_unicode",
"parsimonious/tests/test_expressions.py::RepresentationTests::test_unicode_crash",
"parsimonious/tests/test_expressions.py::RepresentationTests::test_unicode_keep_parens",
"parsimonious/tests/test_expressions.py::RepresentationTests::test_unicode_surrounding_parens",
"parsimonious/tests/test_expressions.py::SlotsTests::test_subclassing",
"parsimonious/tests/test_grammar.py::BootstrappingGrammarTests::test_successes",
"parsimonious/tests/test_grammar.py::RuleVisitorTests::test_undefined_rule",
"parsimonious/tests/test_grammar.py::GrammarTests::test_bad_grammar",
"parsimonious/tests/test_grammar.py::GrammarTests::test_comments",
"parsimonious/tests/test_grammar.py::GrammarTests::test_immutable_grammar",
"parsimonious/tests/test_grammar.py::GrammarTests::test_infinite_loop",
"parsimonious/tests/test_grammar.py::GrammarTests::test_multi_line",
"parsimonious/tests/test_grammar.py::GrammarTests::test_not",
"parsimonious/tests/test_grammar.py::GrammarTests::test_parens",
"parsimonious/tests/test_grammar.py::GrammarTests::test_parens_with_leading_whitespace",
"parsimonious/tests/test_grammar.py::GrammarTests::test_repr",
"parsimonious/tests/test_grammar.py::GrammarTests::test_resolve_refs_order",
"parsimonious/tests/test_grammar.py::GrammarTests::test_right_recursive",
"parsimonious/tests/test_grammar.py::GrammarTests::test_rule_ordering_is_preserved",
"parsimonious/tests/test_grammar.py::GrammarTests::test_rule_ordering_is_preserved_on_shallow_copies",
"parsimonious/tests/test_grammar.py::GrammarTests::test_single_quoted_literals",
"parsimonious/tests/test_grammar.py::GrammarTests::test_unicode",
"parsimonious/tests/test_grammar.py::TokenGrammarTests::test_parse_failure",
"parsimonious/tests/test_grammar.py::TokenGrammarTests::test_token_repr",
"parsimonious/tests/test_nodes.py::test_parse_shortcut",
"parsimonious/tests/test_nodes.py::test_match_shortcut",
"parsimonious/tests/test_nodes.py::test_rule_decorator",
"parsimonious/tests/test_nodes.py::test_unwrapped_exceptions"
] |
[] |
MIT License
| 1,239 |
|
jaywink__federation-79
|
273b7ba47a08d4fe8f85db9620c19ce7c79f83be
|
2017-05-12 21:13:44
|
e0dd39d518136eef5d36fa3c2cb36dc4b32d4a63
|
diff --git a/federation/protocols/diaspora/protocol.py b/federation/protocols/diaspora/protocol.py
index 83c7045..8113b90 100644
--- a/federation/protocols/diaspora/protocol.py
+++ b/federation/protocols/diaspora/protocol.py
@@ -1,7 +1,7 @@
+import json
import logging
import warnings
from base64 import b64decode, urlsafe_b64decode, b64encode, urlsafe_b64encode
-from json import loads, dumps
from urllib.parse import unquote_plus
from Crypto.Cipher import AES, PKCS1_v1_5
@@ -20,14 +20,35 @@ logger = logging.getLogger("federation")
PROTOCOL_NAME = "diaspora"
PROTOCOL_NS = "https://joindiaspora.com/protocol"
+MAGIC_ENV_TAG = "{http://salmon-protocol.org/ns/magic-env}env"
def identify_payload(payload):
+ """Try to identify whether this is a Diaspora payload.
+
+ Try first public message. Then private message. The check if this is a legacy payload.
+ """
+ # Private encrypted JSON payload
+ try:
+ data = json.loads(payload)
+ if "encrypted_magic_envelope" in data:
+ return True
+ except Exception:
+ pass
+ # Public XML payload
+ try:
+ xml = etree.fromstring(bytes(payload, encoding="utf-8"))
+ if xml.tag == MAGIC_ENV_TAG:
+ return True
+ except Exception:
+ pass
+ # Legacy XML payload
try:
xml = unquote_plus(payload)
return xml.find('xmlns="%s"' % PROTOCOL_NS) > -1
except Exception:
- return False
+ pass
+ return False
class Protocol(BaseProtocol):
@@ -151,7 +172,7 @@ class Protocol(BaseProtocol):
key and hence the passphrase for the key.
"""
decoded_json = b64decode(b64data.encode("ascii"))
- rep = loads(decoded_json.decode("ascii"))
+ rep = json.loads(decoded_json.decode("ascii"))
outer_key_details = self.decrypt_outer_aes_key_bundle(
rep["aes_key"], key)
header = self.get_decrypted_header(
@@ -173,7 +194,7 @@ class Protocol(BaseProtocol):
b64decode(data.encode("ascii")),
sentinel=None
)
- return loads(decoded_json.decode("ascii"))
+ return json.loads(decoded_json.decode("ascii"))
def get_decrypted_header(self, ciphertext, key, iv):
"""
@@ -273,7 +294,7 @@ class Protocol(BaseProtocol):
"""
Record the information on the key used to encrypt the header.
"""
- d = dumps({
+ d = json.dumps({
"iv": b64encode(self.outer_iv).decode("ascii"),
"key": b64encode(self.outer_key).decode("ascii")
})
@@ -297,7 +318,7 @@ class Protocol(BaseProtocol):
public_key)).decode("ascii")
ciphertext = b64encode(self.create_ciphertext()).decode("ascii")
- d = dumps({
+ d = json.dumps({
"aes_key": aes_key,
"ciphertext": ciphertext
})
|
Don't try to identify Diaspora protocol
Diaspora will drop the whole XML wrapper and just deliver a Magic Envelope (for public posts). Private posts will be delivered wrapped in a JSON structure. Diaspora 0.6 understands this new message, 0.7 will maybe send it out.
For public posts, this:
```
<?xml version="1.0" encoding="UTF-8"?>
<diaspora xmlns="https://joindiaspora.com/protocol" xmlns:me="http://salmon-protocol.org/ns/magic-env">
<header>
<author_id>[email protected]</author_id>
</header>
<me:env>
....
</me:env>
</diaspora>
```
becomes this:
```
<me:env>
....
</me:env>
```
Check for `me:env` tags, then just try and open it - if it doesn't open it's something else. Same for public messages but looking at the JSON.
Old structures should be supported.
|
jaywink/federation
|
diff --git a/federation/tests/fixtures/payloads.py b/federation/tests/fixtures/payloads.py
index 97f88e6..b58c95e 100644
--- a/federation/tests/fixtures/payloads.py
+++ b/federation/tests/fixtures/payloads.py
@@ -1,4 +1,4 @@
-ENCRYPTED_DIASPORA_PAYLOAD = """<?xml version='1.0'?>
+ENCRYPTED_LEGACY_DIASPORA_PAYLOAD = """<?xml version='1.0'?>
<diaspora xmlns="https://joindiaspora.com/protocol" xmlns:me="http://salmon-protocol.org/ns/magic-env">
<encrypted_header>{encrypted_header}</encrypted_header>
<me:env>
@@ -11,7 +11,7 @@ ENCRYPTED_DIASPORA_PAYLOAD = """<?xml version='1.0'?>
"""
-UNENCRYPTED_DIASPORA_PAYLOAD = """<?xml version='1.0'?>
+UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD = """<?xml version='1.0'?>
<diaspora xmlns="https://joindiaspora.com/protocol" xmlns:me="http://salmon-protocol.org/ns/magic-env">
<header>
<author_id>[email protected]</author_id>
@@ -26,6 +26,26 @@ UNENCRYPTED_DIASPORA_PAYLOAD = """<?xml version='1.0'?>
"""
+DIASPORA_PUBLIC_PAYLOAD = """<?xml version='1.0' encoding='UTF-8'?>
+<me:env xmlns:me="http://salmon-protocol.org/ns/magic-env">
+ <me:encoding>base64url</me:encoding>
+ <me:alg>RSA-SHA256</me:alg>
+ <me:data type="application/xml">PHN0YXR1c19tZXNzYWdlPjxmb28-YmFyPC9mb28-PC9zdGF0dXNfbWVzc2FnZT4=</me:data>
+ <me:sig key_id="Zm9vYmFyQGV4YW1wbGUuY29t">Cmk08MR4Tp8r9eVybD1hORcR_8NLRVxAu0biOfJbkI1xLx1c480zJ720cpVyKaF9""" \
+ """CxVjW3lvlvRz5YbswMv0izPzfHpXoWTXH-4UPrXaGYyJnrNvqEB2UWn4iHKJ2Rerto8sJY2b95qbXD6Nq75EoBNub5P7DYc16ENhp3""" \
+ """8YwBRnrBEvNOewddpOpEBVobyNB7no_QR8c_xkXie-hUDFNwI0z7vax9HkaBFbvEmzFPMZAAdWyjxeGiWiqY0t2ZdZRCPTezy66X6Q0""" \
+ """qc4I8kfT-Mt1ctjGmNMoJ4Lgu-PrO5hSRT4QBAVyxaog5w-B0PIPuC-mUW5SZLsnX3_ZuwJww==</me:sig>
+</me:env>
+"""
+
+
+DIASPORA_ENCRYPTED_PAYLOAD = """{
+ "aes_key": "...",
+ "encrypted_magic_envelope": "..."
+}
+"""
+
+
DIASPORA_POST_LEGACY = """<XML>
<post>
<status_message>
diff --git a/federation/tests/protocols/diaspora/test_diaspora.py b/federation/tests/protocols/diaspora/test_protocol.py
similarity index 81%
rename from federation/tests/protocols/diaspora/test_diaspora.py
rename to federation/tests/protocols/diaspora/test_protocol.py
index 3226e19..fa4359e 100644
--- a/federation/tests/protocols/diaspora/test_diaspora.py
+++ b/federation/tests/protocols/diaspora/test_protocol.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
from base64 import urlsafe_b64decode
from unittest.mock import Mock, patch
from xml.etree.ElementTree import ElementTree
@@ -8,10 +7,14 @@ import pytest
from federation.exceptions import EncryptedMessageError, NoSenderKeyFoundError, NoHeaderInMessageError
from federation.protocols.diaspora.protocol import Protocol, identify_payload
-from federation.tests.fixtures.payloads import ENCRYPTED_DIASPORA_PAYLOAD, UNENCRYPTED_DIASPORA_PAYLOAD
+from federation.tests.fixtures.payloads import (
+ ENCRYPTED_LEGACY_DIASPORA_PAYLOAD, UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD,
+ DIASPORA_PUBLIC_PAYLOAD,
+ DIASPORA_ENCRYPTED_PAYLOAD,
+)
-class MockUser(object):
+class MockUser():
private_key = "foobar"
def __init__(self, nokey=False):
@@ -27,15 +30,15 @@ def mock_not_found_get_contact_key(contact):
return None
-class DiasporaTestBase(object):
+class DiasporaTestBase():
def init_protocol(self):
return Protocol()
def get_unencrypted_doc(self):
- return etree.fromstring(UNENCRYPTED_DIASPORA_PAYLOAD)
+ return etree.fromstring(UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD)
def get_encrypted_doc(self):
- return etree.fromstring(ENCRYPTED_DIASPORA_PAYLOAD)
+ return etree.fromstring(ENCRYPTED_LEGACY_DIASPORA_PAYLOAD)
def get_mock_user(self, nokey=False):
return MockUser(nokey)
@@ -68,7 +71,7 @@ class TestDiasporaProtocol(DiasporaTestBase):
protocol = self.init_protocol()
user = self.get_mock_user()
protocol.get_message_content = self.mock_get_message_content
- sender, content = protocol.receive(UNENCRYPTED_DIASPORA_PAYLOAD, user, mock_get_contact_key,
+ sender, content = protocol.receive(UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD, user, mock_get_contact_key,
skip_author_verification=True)
assert sender == "[email protected]"
assert content == "<content />"
@@ -80,7 +83,7 @@ class TestDiasporaProtocol(DiasporaTestBase):
return_value="<content><diaspora_handle>[email protected]</diaspora_handle></content>"
)
protocol.parse_header = Mock(return_value="foobar")
- sender, content = protocol.receive(ENCRYPTED_DIASPORA_PAYLOAD, user, mock_get_contact_key,
+ sender, content = protocol.receive(ENCRYPTED_LEGACY_DIASPORA_PAYLOAD, user, mock_get_contact_key,
skip_author_verification=True)
assert sender == "[email protected]"
assert content == "<content><diaspora_handle>[email protected]</diaspora_handle></content>"
@@ -88,19 +91,19 @@ class TestDiasporaProtocol(DiasporaTestBase):
def test_receive_raises_on_encrypted_message_and_no_user(self):
protocol = self.init_protocol()
with pytest.raises(EncryptedMessageError):
- protocol.receive(ENCRYPTED_DIASPORA_PAYLOAD)
+ protocol.receive(ENCRYPTED_LEGACY_DIASPORA_PAYLOAD)
def test_receive_raises_on_encrypted_message_and_no_user_key(self):
protocol = self.init_protocol()
user = self.get_mock_user(nokey=True)
with pytest.raises(EncryptedMessageError):
- protocol.receive(ENCRYPTED_DIASPORA_PAYLOAD, user)
+ protocol.receive(ENCRYPTED_LEGACY_DIASPORA_PAYLOAD, user)
def test_receive_raises_if_sender_key_cannot_be_found(self):
protocol = self.init_protocol()
user = self.get_mock_user()
with pytest.raises(NoSenderKeyFoundError):
- protocol.receive(UNENCRYPTED_DIASPORA_PAYLOAD, user, mock_not_found_get_contact_key)
+ protocol.receive(UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD, user, mock_not_found_get_contact_key)
def test_find_header_raises_if_header_cannot_be_found(self):
protocol = self.init_protocol()
@@ -115,8 +118,14 @@ class TestDiasporaProtocol(DiasporaTestBase):
body = protocol.get_message_content()
assert body == urlsafe_b64decode("{data}".encode("ascii"))
- def test_identify_payload_with_diaspora_payload(self):
- assert identify_payload(UNENCRYPTED_DIASPORA_PAYLOAD) == True
+ def test_identify_payload_with_legacy_diaspora_payload(self):
+ assert identify_payload(UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD) == True
+
+ def test_identify_payload_with_diaspora_public_payload(self):
+ assert identify_payload(DIASPORA_PUBLIC_PAYLOAD) == True
+
+ def test_identify_payload_with_diaspora_encrypted_payload(self):
+ assert identify_payload(DIASPORA_ENCRYPTED_PAYLOAD) == True
def test_identify_payload_with_other_payload(self):
assert identify_payload("foobar not a diaspora protocol") == False
diff --git a/federation/tests/test_inbound.py b/federation/tests/test_inbound.py
index 879e7d1..0975808 100644
--- a/federation/tests/test_inbound.py
+++ b/federation/tests/test_inbound.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
from unittest.mock import patch
import pytest
@@ -6,12 +5,12 @@ import pytest
from federation.exceptions import NoSuitableProtocolFoundError
from federation.inbound import handle_receive
from federation.protocols.diaspora.protocol import Protocol
-from federation.tests.fixtures.payloads import UNENCRYPTED_DIASPORA_PAYLOAD
+from federation.tests.fixtures.payloads import UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD
-class TestHandleReceiveProtocolIdentification(object):
+class TestHandleReceiveProtocolIdentification():
def test_handle_receive_routes_to_identified_protocol(self):
- payload = UNENCRYPTED_DIASPORA_PAYLOAD
+ payload = UNENCRYPTED_LEGACY_DIASPORA_PAYLOAD
with patch.object(
Protocol,
'receive',
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 1
},
"num_modified_files": 1
}
|
0.11
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc libxml2-dev libxslt1-dev"
],
"python": "3.6",
"reqs_path": [
"dev-requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
arrow==1.2.3
attrs==22.2.0
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
colorama==0.4.5
commonmark==0.9.1
coverage==6.2
cssselect==1.1.0
dirty-validators==0.5.4
docutils==0.18.1
factory-boy==3.2.1
Faker==14.2.1
-e git+https://github.com/jaywink/federation.git@273b7ba47a08d4fe8f85db9620c19ce7c79f83be#egg=federation
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
iniconfig==1.1.1
isodate==0.6.1
Jinja2==3.0.3
jsonschema==3.2.0
livereload==2.6.3
lxml==5.3.1
MarkupSafe==2.0.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pycrypto==2.6.1
Pygments==2.14.0
pyparsing==3.1.4
pyrsistent==0.18.0
pytest==7.0.1
pytest-cov==4.0.0
pytest-warnings==0.3.1
python-dateutil==2.9.0.post0
python-xrd==0.1
pytz==2025.2
recommonmark==0.7.1
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-autobuild==2021.3.14
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tomli==1.2.3
tornado==6.1
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0
|
name: federation
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- arrow==1.2.3
- attrs==22.2.0
- babel==2.11.0
- charset-normalizer==2.0.12
- codecov==2.1.13
- colorama==0.4.5
- commonmark==0.9.1
- coverage==6.2
- cssselect==1.1.0
- dirty-validators==0.5.4
- docutils==0.18.1
- factory-boy==3.2.1
- faker==14.2.1
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- isodate==0.6.1
- jinja2==3.0.3
- jsonschema==3.2.0
- livereload==2.6.3
- lxml==5.3.1
- markupsafe==2.0.1
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pycrypto==2.6.1
- pygments==2.14.0
- pyparsing==3.1.4
- pyrsistent==0.18.0
- pytest==7.0.1
- pytest-cov==4.0.0
- pytest-warnings==0.3.1
- python-dateutil==2.9.0.post0
- python-xrd==0.1
- pytz==2025.2
- recommonmark==0.7.1
- requests==2.27.1
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==5.3.0
- sphinx-autobuild==2021.3.14
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- tomli==1.2.3
- tornado==6.1
- typing-extensions==4.1.1
- urllib3==1.26.20
- zipp==3.6.0
prefix: /opt/conda/envs/federation
|
[
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_identify_payload_with_diaspora_public_payload",
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_identify_payload_with_diaspora_encrypted_payload"
] |
[] |
[
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_find_unencrypted_header",
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_find_encrypted_header",
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_receive_unencrypted_returns_sender_and_content",
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_receive_encrypted_returns_sender_and_content",
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_receive_raises_on_encrypted_message_and_no_user",
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_receive_raises_on_encrypted_message_and_no_user_key",
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_receive_raises_if_sender_key_cannot_be_found",
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_find_header_raises_if_header_cannot_be_found",
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_get_message_content",
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_identify_payload_with_legacy_diaspora_payload",
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_identify_payload_with_other_payload",
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_get_sender_returns_sender_in_header",
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_get_sender_returns_sender_in_content",
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_get_sender_returns_none_if_no_sender_found",
"federation/tests/protocols/diaspora/test_protocol.py::TestDiasporaProtocol::test_build_send",
"federation/tests/test_inbound.py::TestHandleReceiveProtocolIdentification::test_handle_receive_routes_to_identified_protocol",
"federation/tests/test_inbound.py::TestHandleReceiveProtocolIdentification::test_handle_receive_raises_on_unidentified_protocol"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 1,241 |
|
hynek__structlog-117
|
ff7cf4ce1ea725a66e93d7d5d51ed5155fc20c52
|
2017-05-13 05:52:50
|
ff7cf4ce1ea725a66e93d7d5d51ed5155fc20c52
|
codecov[bot]: # [Codecov](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=h1) Report
> Merging [#117](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=desc) into [master](https://codecov.io/gh/hynek/structlog/commit/5636314046792f1cc2510af27a379746bfe9dbf2?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.
[](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #117 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 13 13
Lines 774 775 +1
Branches 96 96
=====================================
+ Hits 774 775 +1
```
| [Impacted Files](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/structlog/stdlib.py](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=tree#diff-c3JjL3N0cnVjdGxvZy9zdGRsaWIucHk=) | `100% <100%> (ø)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=footer). Last update [5636314...161ede8](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
codecov[bot]: # [Codecov](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=h1) Report
> Merging [#117](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=desc) into [master](https://codecov.io/gh/hynek/structlog/commit/5636314046792f1cc2510af27a379746bfe9dbf2?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.
[](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #117 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 13 13
Lines 774 775 +1
Branches 96 96
=====================================
+ Hits 774 775 +1
```
| [Impacted Files](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/structlog/stdlib.py](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=tree#diff-c3JjL3N0cnVjdGxvZy9zdGRsaWIucHk=) | `100% <100%> (ø)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=footer). Last update [5636314...161ede8](https://codecov.io/gh/hynek/structlog/pull/117?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
if-fi: Hi @hynek I just found the same problem on Thursday, and I was looking for a non-hackish solution to send as a pull request.
Yours is pretty smooth. I just tried it locally and it works fine in all scenarios I came up with.
P.S. I also found a problem when using `ProcessorFormatter` with `RotatingFileHandler`. I will send you a pull request that I hope will be included in the same bugfix release as this one
gilbsgilbs: Hi @if-fi, hi @hynek.
As far as I can see, this won't break anything and will fix the issue. Still, I have some remarks:
- You're clearing `record.args` too often. Clearing after calling `record.getMessage()` (which is the one actually consuming the args) should be sufficient I guess (untested),
- Not really fund of mutating `record.msg` and now `record.args`. You really shouldn't ever have to mutate any `record` attribute, appart from `record.message` (≠ from `record.msg`, yeah, ik, logging module is real crap, but `record.msg` should be the unformatted message and `record.message` the formatted one -_-"),
- You're actually formatting the message twice. First time in `record.getMessage()`, and another time calling super function, which puts the formatted message into `record.message` . The second time should be near-free since `record.args` is empty (provided that format operator is a bit smart, haven't checked that out). Yet, it still requires two format when one is most likely possible (calling super function sooner, and getting the formatted message in `record.message`).
Don't have much time to dig into this. I think the fix is ok.
hynek: 1. Good catch, I’ll move it up.
2. I sadly don’t know enough about this part. But I guess I’d be hoping for too much if I thought I could format into `record.message` and it solves #119 too, right? :)
3. The reason is https://github.com/hynek/structlog/pull/105#discussion_r107939889
|
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 0a95646..b9dbfab 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -26,6 +26,10 @@ Changes:
- ``structlog.stdlib.add_logger_name()`` now works in ``structlog.stdlib.ProcessorFormatter``'s ``foreign_pre_chain``.
`#112 <https://github.com/hynek/structlog/issues/112>`_
+- Clear log record args in ``structlog.stdlib.ProcessorFormatter`` after rendering.
+ This fix is for you if you tried to use it and got ``TypeError: not all arguments converted during string formatting`` exceptions.
+ `#116 <https://github.com/hynek/structlog/issues/116>`_
+ `#117 <https://github.com/hynek/structlog/issues/117>`_
----
diff --git a/src/structlog/stdlib.py b/src/structlog/stdlib.py
index 4529e84..fb7ad04 100644
--- a/src/structlog/stdlib.py
+++ b/src/structlog/stdlib.py
@@ -420,6 +420,7 @@ class ProcessorFormatter(logging.Formatter):
logger = None
meth_name = record.levelname.lower()
ed = {"event": record.getMessage(), "_record": record}
+ record.args = ()
# Non-structlog allows to run through a chain to prepare it for the
# final processor (e.g. adding timestamps and log levels).
|
Suggested configurations leads to exceptions for third party libs.
Hi,
Python 2.7.5
CentOS Linux release 7.2.1511 (Core)
I tried the suggestion named:
> Rendering Using structlog-based Formatters Within logging
From:
[http://www.structlog.org/en/stable/standard-library.html#rendering-using-structlog-based-formatters-within-logging](http://www.structlog.org/en/stable/standard-library.html#rendering-using-structlog-based-formatters-within-logging)
The only thing I added was:
```
import boto3
ec2 = boto3.client('ec2')
response = ec2.describe_regions()
print('Regions:', response['Regions'])
response = ec2.describe_availability_zones()
print('Availability Zones:', response['AvailabilityZones'])
```
(This issue is not related to the third party lib used, I got the same thing with other third party libs, just needed one as a minimal repro case.)
This leads to a ton of exception that ends with:
> File "/usr/lib64/python2.7/logging/__init__.py", line 328, in getMessage
msg = msg % self.args
TypeError: not all arguments converted during string formatting
My goal is to use structlog to get all my logs and those from imported third party libs to be formatted in JSON with a basic set of common keys. But I started with using the documentation as is first to understand how it works.
I was expecting boto3 logs to be formatted and it worked, somewhere in the console output (and the log file) there is:
> 2017-05-12 19:57:08 [info ] Starting new HTTP connection (1): 169.254.169.254
What I don't understand are all the Exception thrown from inside the logging library that are in visible in the std err output. Should the suggested config work in this scenario?
Attached are the source code file used, the log file from the WatchedFileHandler and console output file where the exceptions are visible. It was generated with:
`python issue.py &> console_output.txt`
[console_output.txt](https://github.com/hynek/structlog/files/997889/console_output.txt)
[filehandler_output.txt](https://github.com/hynek/structlog/files/997891/filehandler_output.txt)
[source_code.txt](https://github.com/hynek/structlog/files/997890/source_code.txt)
Martin
|
hynek/structlog
|
diff --git a/tests/test_stdlib.py b/tests/test_stdlib.py
index 423760e..548ccfa 100644
--- a/tests/test_stdlib.py
+++ b/tests/test_stdlib.py
@@ -432,6 +432,22 @@ class TestProcessorFormatter(object):
"foo [in test_foreign_delegate]\n",
) == capsys.readouterr()
+ def test_clears_args(self, capsys, configure_for_pf):
+ """
+ We render our log records before sending it back to logging. Therefore
+ we must clear `LogRecord.args` otherwise the user gets an
+ `TypeError: not all arguments converted during string formatting.` if
+ they use positional formatting in stdlib logging.
+ """
+ configure_logging(None)
+
+ logging.getLogger().warning("hello %s.", "world")
+
+ assert (
+ "",
+ "hello world. [in test_clears_args]\n",
+ ) == capsys.readouterr()
+
def test_foreign_pre_chain(self, configure_for_pf, capsys):
"""
If foreign_pre_chain is an iterable, it's used to pre-process
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 3,
"test_score": 0
},
"num_modified_files": 2
}
|
17.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"greenlet",
"colorama",
"coverage",
"freezegun",
"pretend",
"pytest",
"simplejson"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"dev-requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
colorama==0.4.5
coverage==6.2
freezegun==1.2.2
greenlet==2.0.2
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
pretend==1.0.9
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
simplejson==3.20.1
six==1.17.0
-e git+https://github.com/hynek/structlog.git@ff7cf4ce1ea725a66e93d7d5d51ed5155fc20c52#egg=structlog
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: structlog
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- colorama==0.4.5
- coverage==6.2
- freezegun==1.2.2
- greenlet==2.0.2
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- packaging==21.3
- pluggy==1.0.0
- pretend==1.0.9
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- simplejson==3.20.1
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/structlog
|
[
"tests/test_stdlib.py::TestProcessorFormatter::test_clears_args"
] |
[
"tests/test_stdlib.py::TestLoggerFactory::test_ignores_frames"
] |
[
"tests/test_stdlib.py::TestLoggerFactory::test_deduces_correct_name",
"tests/test_stdlib.py::TestLoggerFactory::test_deduces_correct_caller",
"tests/test_stdlib.py::TestLoggerFactory::test_stack_info",
"tests/test_stdlib.py::TestLoggerFactory::test_no_stack_info_by_default",
"tests/test_stdlib.py::TestLoggerFactory::test_find_caller",
"tests/test_stdlib.py::TestLoggerFactory::test_sets_correct_logger",
"tests/test_stdlib.py::TestLoggerFactory::test_positional_argument_avoids_guessing",
"tests/test_stdlib.py::TestFilterByLevel::test_filters_lower_levels",
"tests/test_stdlib.py::TestFilterByLevel::test_passes_higher_levels",
"tests/test_stdlib.py::TestBoundLogger::test_proxies_to_correct_method[debug]",
"tests/test_stdlib.py::TestBoundLogger::test_proxies_to_correct_method[info]",
"tests/test_stdlib.py::TestBoundLogger::test_proxies_to_correct_method[warning]",
"tests/test_stdlib.py::TestBoundLogger::test_proxies_to_correct_method[error]",
"tests/test_stdlib.py::TestBoundLogger::test_proxies_to_correct_method[critical]",
"tests/test_stdlib.py::TestBoundLogger::test_proxies_exception",
"tests/test_stdlib.py::TestBoundLogger::test_proxies_log",
"tests/test_stdlib.py::TestBoundLogger::test_positional_args_proxied",
"tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[addHandler-method_args0]",
"tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[removeHandler-method_args1]",
"tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[hasHandlers-None]",
"tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[callHandlers-method_args3]",
"tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[handle-method_args4]",
"tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[setLevel-method_args5]",
"tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[getEffectiveLevel-None]",
"tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[isEnabledFor-method_args7]",
"tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[findCaller-None]",
"tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[makeRecord-method_args9]",
"tests/test_stdlib.py::TestBoundLogger::test_stdlib_passthrough_methods[getChild-method_args10]",
"tests/test_stdlib.py::TestBoundLogger::test_exception_exc_info",
"tests/test_stdlib.py::TestBoundLogger::test_exception_maps_to_error",
"tests/test_stdlib.py::TestPositionalArgumentsFormatter::test_formats_tuple",
"tests/test_stdlib.py::TestPositionalArgumentsFormatter::test_formats_dict",
"tests/test_stdlib.py::TestPositionalArgumentsFormatter::test_positional_args_retained",
"tests/test_stdlib.py::TestPositionalArgumentsFormatter::test_nop_no_args",
"tests/test_stdlib.py::TestPositionalArgumentsFormatter::test_args_removed_if_empty",
"tests/test_stdlib.py::TestAddLogLevel::test_log_level_added",
"tests/test_stdlib.py::TestAddLogLevel::test_log_level_alias_normalized",
"tests/test_stdlib.py::TestAddLoggerName::test_logger_name_added",
"tests/test_stdlib.py::TestAddLoggerName::test_logger_name_added_with_record",
"tests/test_stdlib.py::TestRenderToLogKW::test_default",
"tests/test_stdlib.py::TestRenderToLogKW::test_add_extra_event_dict",
"tests/test_stdlib.py::TestProcessorFormatter::test_foreign_delegate",
"tests/test_stdlib.py::TestProcessorFormatter::test_foreign_pre_chain",
"tests/test_stdlib.py::TestProcessorFormatter::test_foreign_pre_chain_add_logger_name",
"tests/test_stdlib.py::TestProcessorFormatter::test_native"
] |
[] |
Apache License 2.0 or MIT License
| 1,242 |
oasis-open__cti-python-stix2-10
|
85b5a1971b0f36c3acaa0d3da734329bdd8ebe0b
|
2017-05-15 15:03:14
|
f937e2bb3f104e3cdf0578ed8323b2f7e39119a4
|
diff --git a/stix2/common.py b/stix2/common.py
index 29cbf62..c8c243d 100644
--- a/stix2/common.py
+++ b/stix2/common.py
@@ -2,7 +2,7 @@
from .other import ExternalReference, GranularMarking
from .properties import (BooleanProperty, ListProperty, ReferenceProperty,
- TimestampProperty)
+ StringProperty, TimestampProperty)
from .utils import NOW
COMMON_PROPERTIES = {
@@ -11,6 +11,7 @@ COMMON_PROPERTIES = {
'modified': TimestampProperty(default=lambda: NOW),
'external_references': ListProperty(ExternalReference),
'revoked': BooleanProperty(),
+ 'labels': ListProperty(StringProperty),
'created_by_ref': ReferenceProperty(type="identity"),
'object_marking_refs': ListProperty(ReferenceProperty(type="marking-definition")),
'granular_markings': ListProperty(GranularMarking),
diff --git a/stix2/sdo.py b/stix2/sdo.py
index 693b750..a2f0062 100644
--- a/stix2/sdo.py
+++ b/stix2/sdo.py
@@ -57,7 +57,6 @@ class Identity(_STIXBase):
_properties.update({
'type': TypeProperty(_type),
'id': IDProperty(_type),
- 'labels': ListProperty(StringProperty),
'name': StringProperty(required=True),
'description': StringProperty(),
'identity_class': StringProperty(required=True),
|
is labels optional
Hi,
As an exercise I'm starting a similar Scala library for STIX 2.1, at:
[scalastix]( https://github.com/workingDog/scalastix)
According to the specs and as part of the common properties, labels is optional.
However, there are SDOs (e.g. Indicator) where it is required. Is this correct?
labels are optional but not when required!
I see that labels are not part of the python COMMON_PROPERTIES.
Should I do the same?
|
oasis-open/cti-python-stix2
|
diff --git a/stix2/test/test_attack_pattern.py b/stix2/test/test_attack_pattern.py
index c0891a5..618875e 100644
--- a/stix2/test/test_attack_pattern.py
+++ b/stix2/test/test_attack_pattern.py
@@ -67,4 +67,15 @@ def test_parse_attack_pattern(data):
assert ap.external_references[0].source_name == 'capec'
assert ap.name == "Spear Phishing"
+
+def test_attack_pattern_invalid_labels():
+ with pytest.raises(stix2.exceptions.InvalidValueError):
+ stix2.AttackPattern(
+ id="attack-pattern--0c7b5b88-8ff7-4a4d-aa9d-feb398cd0061",
+ created="2016-05-12T08:17:27Z",
+ modified="2016-05-12T08:17:27Z",
+ name="Spear Phishing",
+ labels=1
+ )
+
# TODO: Add other examples
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 2
}
|
0.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.16
babel==2.17.0
bump2version==1.0.1
bumpversion==0.6.0
cachetools==5.5.2
certifi==2025.1.31
cfgv==3.4.0
chardet==5.2.0
charset-normalizer==3.4.1
colorama==0.4.6
coverage==7.8.0
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
filelock==3.18.0
identify==2.6.9
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
iniconfig==2.1.0
Jinja2==3.1.6
MarkupSafe==3.0.2
nodeenv==1.9.1
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
pre_commit==4.2.0
Pygments==2.19.1
pyproject-api==1.9.0
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.2
requests==2.32.3
six==1.17.0
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinx-prompt==1.8.0
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
-e git+https://github.com/oasis-open/cti-python-stix2.git@85b5a1971b0f36c3acaa0d3da734329bdd8ebe0b#egg=stix2
tomli==2.2.1
tox==4.25.0
typing_extensions==4.13.0
urllib3==2.3.0
virtualenv==20.29.3
zipp==3.21.0
|
name: cti-python-stix2
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.16
- babel==2.17.0
- bump2version==1.0.1
- bumpversion==0.6.0
- cachetools==5.5.2
- certifi==2025.1.31
- cfgv==3.4.0
- chardet==5.2.0
- charset-normalizer==3.4.1
- colorama==0.4.6
- coverage==7.8.0
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- filelock==3.18.0
- identify==2.6.9
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- jinja2==3.1.6
- markupsafe==3.0.2
- nodeenv==1.9.1
- packaging==24.2
- platformdirs==4.3.7
- pluggy==1.5.0
- pre-commit==4.2.0
- pygments==2.19.1
- pyproject-api==1.9.0
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==6.0.2
- requests==2.32.3
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==7.4.7
- sphinx-prompt==1.8.0
- sphinxcontrib-applehelp==2.0.0
- sphinxcontrib-devhelp==2.0.0
- sphinxcontrib-htmlhelp==2.1.0
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==2.0.0
- sphinxcontrib-serializinghtml==2.0.0
- tomli==2.2.1
- tox==4.25.0
- typing-extensions==4.13.0
- urllib3==2.3.0
- virtualenv==20.29.3
- zipp==3.21.0
prefix: /opt/conda/envs/cti-python-stix2
|
[
"stix2/test/test_attack_pattern.py::test_attack_pattern_invalid_labels"
] |
[] |
[
"stix2/test/test_attack_pattern.py::test_attack_pattern_example",
"stix2/test/test_attack_pattern.py::test_parse_attack_pattern[{\\n",
"stix2/test/test_attack_pattern.py::test_parse_attack_pattern[data1]"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 1,251 |
|
Azure__azure-cli-3354
|
4417fb03c91b0caa5f88a72ca0372d5931c072d9
|
2017-05-15 16:03:53
|
eb12ac454cbe1ddb59c86cdf2045e1912660e750
|
tjprescott: @yugangw-msft I agree.
codecov-io: # [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=h1) Report
> Merging [#3354](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=desc) into [master](https://codecov.io/gh/Azure/azure-cli/commit/4417fb03c91b0caa5f88a72ca0372d5931c072d9?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `71.42%`.
[](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #3354 +/- ##
==========================================
- Coverage 70.66% 70.65% -0.01%
==========================================
Files 391 391
Lines 25255 25259 +4
Branches 3835 3836 +1
==========================================
+ Hits 17847 17848 +1
- Misses 6272 6274 +2
- Partials 1136 1137 +1
```
| [Impacted Files](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...zure-cli-vm/azure/cli/command\_modules/vm/custom.py](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktdm0vYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy92bS9jdXN0b20ucHk=) | `72.93% <71.42%> (-0.21%)` | :arrow_down: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=footer). Last update [4417fb0...ef65f19](https://codecov.io/gh/Azure/azure-cli/pull/3354?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
tjprescott: @yugangw-msft I made the change you suggested.
|
diff --git a/appveyor.yml b/appveyor.yml
index a3b8e2a82..23c0de8d3 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -13,7 +13,7 @@ environment:
install:
- SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%
- python scripts/dev_setup.py
- - python -m pip install sphinx
+ - python -m pip install sphinx==1.5.6
build_script:
- ps: |
diff --git a/azure-cli.pyproj b/azure-cli.pyproj
index a4caa6f17..5316ef474 100644
--- a/azure-cli.pyproj
+++ b/azure-cli.pyproj
@@ -946,7 +946,6 @@
<Folder Include="command_modules\azure-cli-vm\azure\cli\" />
<Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\" />
<Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\" />
- <Folder Include="command_modules\azure-cli-vm\azure\cli\command_modules\vm\tests\" />
<Folder Include="command_modules\azure-cli-vm\tests\" />
<Folder Include="command_modules\azure-cli-vm\tests\keyvault\" />
<Folder Include="command_modules\azure-cli-dls\" />
diff --git a/src/command_modules/azure-cli-vm/HISTORY.rst b/src/command_modules/azure-cli-vm/HISTORY.rst
index 50d71c09c..d9a31bfac 100644
--- a/src/command_modules/azure-cli-vm/HISTORY.rst
+++ b/src/command_modules/azure-cli-vm/HISTORY.rst
@@ -6,6 +6,7 @@ unreleased
* diagnostics: Fix incorrect Linux diagnostics default config with update for LAD v.3.0 extension
* disk: support cross subscription blob import
* vm: support license type on create
+* BC: vm open-port: command always returns the NSG. Previously it returned the NIC or Subnet.
2.0.6 (2017-05-09)
++++++++++++++++++
diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py
index 5c48d6656..3e07efc92 100644
--- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py
+++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py
@@ -1177,6 +1177,7 @@ def vm_open_port(resource_group_name, vm_name, port, priority=900, network_secur
raise CLIError("No NIC associated with VM '{}'".format(vm_name))
# get existing NSG or create a new one
+ created_nsg = False
nic = network.network_interfaces.get(resource_group_name, os.path.split(nic_ids[0].id)[1])
if not apply_to_subnet:
nsg = nic.network_security_group
@@ -1197,6 +1198,7 @@ def vm_open_port(resource_group_name, vm_name, port, priority=900, network_secur
parameters=NetworkSecurityGroup(location=location)
)
)
+ created_nsg = True
# update the NSG with the new rule to allow inbound traffic
SecurityRule = get_sdk(ResourceType.MGMT_NETWORK, 'SecurityRule', mod='models')
@@ -1210,23 +1212,21 @@ def vm_open_port(resource_group_name, vm_name, port, priority=900, network_secur
resource_group_name, nsg_name, rule_name, rule)
)
- # update the NIC or subnet
- if not apply_to_subnet:
+ # update the NIC or subnet if a new NSG was created
+ if created_nsg and not apply_to_subnet:
nic.network_security_group = nsg
- return LongRunningOperation('Updating NIC')(
- network.network_interfaces.create_or_update(
- resource_group_name, nic.name, nic)
- )
- else:
+ LongRunningOperation('Updating NIC')(network.network_interfaces.create_or_update(
+ resource_group_name, nic.name, nic))
+ elif created_nsg and apply_to_subnet:
subnet.network_security_group = nsg
- return LongRunningOperation('Updating subnet')(
- network.subnets.create_or_update(
- resource_group_name=resource_group_name,
- virtual_network_name=subnet_id['name'],
- subnet_name=subnet_id['child_name'],
- subnet_parameters=subnet
- )
- )
+ LongRunningOperation('Updating subnet')(network.subnets.create_or_update(
+ resource_group_name=resource_group_name,
+ virtual_network_name=subnet_id['name'],
+ subnet_name=subnet_id['child_name'],
+ subnet_parameters=subnet
+ ))
+
+ return network.network_security_groups.get(resource_group_name, nsg_name)
def _build_nic_list(nic_ids):
|
az vm open-port returns error but executes successfully
### Description
az vm open-port returns an error but executes successfully
Example:
PS C:\Users\larry> az vm open-port -g JUMPBOXRG -n jumpbox --port 80 --priority 500
Operation failed with status: 'Not Found'. Details: 404 Client Error: Not Found for url: https://management.azure.com/subscriptions/5ba80c27-8c76-[***]/providers/Microsoft.Network/locations/eastus/operations/5c5fa1c7-3e4a-4dd3-[***]?api-version=2017-03-01
Error occurs on Windows & Linux
---
### Environment summary
**Install Method:** How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly)
Windows: pip. Linux: apt-get
**CLI Version:** What version of the CLI and modules are installed? (Use `az --version`)
2.0.6
**OS Version:** What OS and version are you using?
Windows 10, Ubuntu 17.04
**Shell Type:** What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
Powershell, Bash
|
Azure/azure-cli
|
diff --git a/src/command_modules/azure-cli-vm/tests/recordings/test_vm_open_port.yaml b/src/command_modules/azure-cli-vm/tests/recordings/test_vm_open_port.yaml
index 0aa74e003..df0308bf4 100644
--- a/src/command_modules/azure-cli-vm/tests/recordings/test_vm_open_port.yaml
+++ b/src/command_modules/azure-cli-vm/tests/recordings/test_vm_open_port.yaml
@@ -6,23 +6,24 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- computemanagementclient/0.33.1rc1 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [8b0d4f74-1697-11e7-9a38-f4b7e2e85440]
+ x-ms-client-request-id: [0fb8f1a8-3a91-11e7-b05a-a0b3ccf7272a]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2016-04-30-preview
response:
- body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"5075a256-2327-4846-b023-231e045604b5\"\
+ body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"b8d1de5a-64b6-4f37-bdd3-0fd302008576\"\
,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\
\n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \
\ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\
,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\
\n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \
- \ \"name\": \"osdisk_3bihPHQTJ0\",\r\n \"createOption\": \"FromImage\"\
+ \ \"name\": \"osdisk_YXbKt2a4DE\",\r\n \"createOption\": \"FromImage\"\
,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\
\ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\
- /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/disks/osdisk_3bihPHQTJ0\"\
+ /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/disks/osdisk_YXbKt2a4DE\"\
\r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\
: []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\
,\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\
@@ -36,7 +37,7 @@ interactions:
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:56:18 GMT']
+ Date: ['Tue, 16 May 2017 23:40:36 GMT']
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
@@ -52,20 +53,21 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [8b345bb4-1697-11e7-9c1d-f4b7e2e85440]
+ x-ms-client-request-id: [0fdcf78a-3a91-11e7-b103-a0b3ccf7272a]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic?api-version=2017-03-01
response:
body: {string: "{\r\n \"name\": \"vm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\
- ,\r\n \"etag\": \"W/\\\"3698e0ce-cf23-48dd-97c5-bb6f7aa1659b\\\"\",\r\n \
+ ,\r\n \"etag\": \"W/\\\"467e1f68-631a-4a50-9a85-7f0893f75459\\\"\",\r\n \
\ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\
- \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"a841d97c-9eed-4000-bef6-05ba81198e68\"\
+ \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"acf9de26-2136-403a-8429-12c3eaa63554\"\
,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvm1\"\
,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\
- ,\r\n \"etag\": \"W/\\\"3698e0ce-cf23-48dd-97c5-bb6f7aa1659b\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"467e1f68-631a-4a50-9a85-7f0893f75459\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\
: \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\
@@ -74,8 +76,8 @@ interactions:
\r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\
: \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\
\ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\
- internalDomainNameSuffix\": \"yqoxwrdrqerepkqkjgsgl2amrc.dx.internal.cloudapp.net\"\
- \r\n },\r\n \"macAddress\": \"00-0D-3A-36-F9-C9\",\r\n \"enableAcceleratedNetworking\"\
+ internalDomainNameSuffix\": \"dpfibvfzyeaejlgmx3vt4p22cc.dx.internal.cloudapp.net\"\
+ \r\n },\r\n \"macAddress\": \"00-0D-3A-30-5C-3C\",\r\n \"enableAcceleratedNetworking\"\
: false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\
: {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\
\r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \
@@ -85,8 +87,8 @@ interactions:
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:56:18 GMT']
- ETag: [W/"3698e0ce-cf23-48dd-97c5-bb6f7aa1659b"]
+ Date: ['Tue, 16 May 2017 23:40:36 GMT']
+ ETag: [W/"467e1f68-631a-4a50-9a85-7f0893f75459"]
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
@@ -96,41 +98,42 @@ interactions:
content-length: ['2189']
status: {code: 200, message: OK}
- request:
- body: '{"properties": {"destinationPortRange": "*", "sourcePortRange": "*", "protocol":
- "*", "access": "allow", "destinationAddressPrefix": "*", "priority": 900, "sourceAddressPrefix":
- "*", "direction": "inbound"}, "name": "open-port-all"}'
+ body: '{"name": "open-port-all", "properties": {"sourceAddressPrefix": "*", "direction":
+ "inbound", "priority": 900, "destinationPortRange": "*", "protocol": "*", "destinationAddressPrefix":
+ "*", "access": "allow", "sourcePortRange": "*"}}'
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['232']
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [8b5bde98-1697-11e7-9144-f4b7e2e85440]
+ x-ms-client-request-id: [101557dc-3a91-11e7-af60-a0b3ccf7272a]
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/open-port-all?api-version=2017-03-01
response:
body: {string: "{\r\n \"name\": \"open-port-all\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/open-port-all\"\
- ,\r\n \"etag\": \"W/\\\"78ec4e59-badc-48a2-a4e8-9645691d75bb\\\"\",\r\n \
+ ,\r\n \"etag\": \"W/\\\"4432927e-5f08-4b52-ab69-d46c6dfebee0\\\"\",\r\n \
\ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"\
protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\
: \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\
: \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 900,\r\n \"\
direction\": \"Inbound\"\r\n }\r\n}"}
headers:
- Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/a223ce3a-20ce-4309-9092-7cd0c0a84eaf?api-version=2017-03-01']
+ Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/49f2734e-6fc7-4471-84c1-3f0de0678807?api-version=2017-03-01']
Cache-Control: [no-cache]
Content-Length: ['570']
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:56:18 GMT']
+ Date: ['Tue, 16 May 2017 23:40:37 GMT']
Expires: ['-1']
Pragma: [no-cache]
Retry-After: ['10']
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- x-ms-ratelimit-remaining-subscription-writes: ['1199']
+ x-ms-ratelimit-remaining-subscription-writes: ['1197']
status: {code: 201, message: Created}
- request:
body: null
@@ -139,18 +142,19 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [8b5bde98-1697-11e7-9144-f4b7e2e85440]
+ x-ms-client-request-id: [101557dc-3a91-11e7-af60-a0b3ccf7272a]
method: GET
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/a223ce3a-20ce-4309-9092-7cd0c0a84eaf?api-version=2017-03-01
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/49f2734e-6fc7-4471-84c1-3f0de0678807?api-version=2017-03-01
response:
body: {string: "{\r\n \"status\": \"Succeeded\"\r\n}"}
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:56:29 GMT']
+ Date: ['Tue, 16 May 2017 23:40:47 GMT']
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
@@ -166,15 +170,16 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [8b5bde98-1697-11e7-9144-f4b7e2e85440]
+ x-ms-client-request-id: [101557dc-3a91-11e7-af60-a0b3ccf7272a]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/open-port-all?api-version=2017-03-01
response:
body: {string: "{\r\n \"name\": \"open-port-all\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/open-port-all\"\
- ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\",\r\n \
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\",\r\n \
\ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"\
protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\
: \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\
@@ -183,8 +188,8 @@ interactions:
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:56:29 GMT']
- ETag: [W/"35b90cac-1fef-48fd-901c-d0f80a58ba43"]
+ Date: ['Tue, 16 May 2017 23:40:48 GMT']
+ ETag: [W/"b5a3dd59-d43b-4102-9161-9cf9edf79734"]
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
@@ -193,71 +198,6 @@ interactions:
Vary: [Accept-Encoding]
content-length: ['571']
status: {code: 200, message: OK}
-- request:
- body: '{"etag": "W/\"3698e0ce-cf23-48dd-97c5-bb6f7aa1659b\"", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic",
- "properties": {"macAddress": "00-0D-3A-36-F9-C9", "enableIPForwarding": false,
- "virtualMachine": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/virtualMachines/vm1"},
- "ipConfigurations": [{"etag": "W/\"3698e0ce-cf23-48dd-97c5-bb6f7aa1659b\"",
- "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1",
- "properties": {"subnet": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet"},
- "publicIPAddress": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP"},
- "privateIPAddress": "10.0.0.4", "privateIPAllocationMethod": "Dynamic", "primary":
- true, "provisioningState": "Succeeded", "privateIPAddressVersion": "IPv4"},
- "name": "ipconfigvm1"}], "provisioningState": "Succeeded", "resourceGuid": "a841d97c-9eed-4000-bef6-05ba81198e68",
- "primary": true, "networkSecurityGroup": {"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG"},
- "enableAcceleratedNetworking": false, "dnsSettings": {"internalDomainNameSuffix":
- "yqoxwrdrqerepkqkjgsgl2amrc.dx.internal.cloudapp.net", "dnsServers": [], "appliedDnsServers":
- []}}, "tags": {}, "location": "westus"}'
- headers:
- Accept: [application/json]
- Accept-Encoding: ['gzip, deflate']
- Connection: [keep-alive]
- Content-Length: ['1788']
- Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
- accept-language: [en-US]
- x-ms-client-request-id: [9283a5fa-1697-11e7-8767-f4b7e2e85440]
- method: PUT
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic?api-version=2017-03-01
- response:
- body: {string: "{\r\n \"name\": \"vm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\
- ,\r\n \"etag\": \"W/\\\"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d\\\"\",\r\n \
- \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\
- \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"a841d97c-9eed-4000-bef6-05ba81198e68\"\
- ,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvm1\"\
- ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\
- ,\r\n \"etag\": \"W/\\\"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d\\\"\"\
- ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
- ,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\
- : \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\
- \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\"\
- \r\n },\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\
- \r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\
- : \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\
- \ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\
- internalDomainNameSuffix\": \"yqoxwrdrqerepkqkjgsgl2amrc.dx.internal.cloudapp.net\"\
- \r\n },\r\n \"macAddress\": \"00-0D-3A-36-F9-C9\",\r\n \"enableAcceleratedNetworking\"\
- : false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\
- : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\
- \r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \
- \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/virtualMachines/vm1\"\
- \r\n }\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\
- \n}"}
- headers:
- Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/bfe5fff4-9760-4e4d-876f-4281ec837b72?api-version=2017-03-01']
- Cache-Control: [no-cache]
- Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:56:31 GMT']
- Expires: ['-1']
- Pragma: [no-cache]
- Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
- Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- Transfer-Encoding: [chunked]
- Vary: [Accept-Encoding]
- content-length: ['2189']
- x-ms-ratelimit-remaining-subscription-writes: ['1198']
- status: {code: 200, message: OK}
- request:
body: null
headers:
@@ -265,75 +205,106 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [9283a5fa-1697-11e7-8767-f4b7e2e85440]
+ x-ms-client-request-id: [173d4736-3a91-11e7-8990-a0b3ccf7272a]
method: GET
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/bfe5fff4-9760-4e4d-876f-4281ec837b72?api-version=2017-03-01
- response:
- body: {string: "{\r\n \"status\": \"Succeeded\"\r\n}"}
- headers:
- Cache-Control: [no-cache]
- Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:01 GMT']
- Expires: ['-1']
- Pragma: [no-cache]
- Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
- Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- Transfer-Encoding: [chunked]
- Vary: [Accept-Encoding]
- content-length: ['29']
- status: {code: 200, message: OK}
-- request:
- body: null
- headers:
- Accept: [application/json]
- Accept-Encoding: ['gzip, deflate']
- Connection: [keep-alive]
- Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
- accept-language: [en-US]
- x-ms-client-request-id: [9283a5fa-1697-11e7-8767-f4b7e2e85440]
- method: GET
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic?api-version=2017-03-01
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG?api-version=2017-03-01
response:
- body: {string: "{\r\n \"name\": \"vm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\
- ,\r\n \"etag\": \"W/\\\"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d\\\"\",\r\n \
- \ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\
- \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"a841d97c-9eed-4000-bef6-05ba81198e68\"\
- ,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvm1\"\
- ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\
- ,\r\n \"etag\": \"W/\\\"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d\\\"\"\
+ body: {string: "{\r\n \"name\": \"vm1NSG\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\",\r\n \
+ \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\
+ : \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\"\
+ : \"Succeeded\",\r\n \"resourceGuid\": \"06d0b2ae-cf07-4f71-9961-a6d1f2d0560d\"\
+ ,\r\n \"securityRules\": [\r\n {\r\n \"name\": \"default-allow-ssh\"\
+ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/default-allow-ssh\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
- ,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\
- : \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\
- \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/publicIPAddresses/vm1PublicIP\"\
- \r\n },\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\
- \r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\
- : \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\
- \ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\
- internalDomainNameSuffix\": \"yqoxwrdrqerepkqkjgsgl2amrc.dx.internal.cloudapp.net\"\
- \r\n },\r\n \"macAddress\": \"00-0D-3A-36-F9-C9\",\r\n \"enableAcceleratedNetworking\"\
- : false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\
- : {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\
- \r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \
- \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/virtualMachines/vm1\"\
- \r\n }\r\n },\r\n \"type\": \"Microsoft.Network/networkInterfaces\"\r\
- \n}"}
+ ,\r\n \"protocol\": \"Tcp\",\r\n \"sourcePortRange\": \"\
+ *\",\r\n \"destinationPortRange\": \"22\",\r\n \"sourceAddressPrefix\"\
+ : \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"\
+ access\": \"Allow\",\r\n \"priority\": 1000,\r\n \"direction\"\
+ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\
+ open-port-all\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/open-port-all\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
+ ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
+ : \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"\
+ access\": \"Allow\",\r\n \"priority\": 900,\r\n \"direction\"\
+ : \"Inbound\"\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\"\
+ : [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\"\
+ : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowVnetInBound\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\
+ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
+ ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
+ : \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\
+ ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\
+ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\
+ \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\
+ \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\
+ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
+ ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
+ : \"AzureLoadBalancer\",\r\n \"destinationAddressPrefix\": \"*\"\
+ ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\
+ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\
+ \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/DenyAllInBound\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \
+ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \
+ \ \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
+ : \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"\
+ access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\
+ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\
+ AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowVnetOutBound\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\
+ \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\
+ : \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
+ : \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\
+ ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\
+ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\
+ \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowInternetOutBound\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\
+ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
+ ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
+ : \"*\",\r\n \"destinationAddressPrefix\": \"Internet\",\r\n \
+ \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \
+ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \
+ \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/DenyAllOutBound\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \
+ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \
+ \ \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
+ : \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"\
+ access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\
+ : \"Outbound\"\r\n }\r\n }\r\n ],\r\n \"networkInterfaces\"\
+ : [\r\n {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\
+ \r\n }\r\n ]\r\n }\r\n}"}
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:01 GMT']
- ETag: [W/"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d"]
+ Date: ['Tue, 16 May 2017 23:40:48 GMT']
+ ETag: [W/"b5a3dd59-d43b-4102-9161-9cf9edf79734"]
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
Transfer-Encoding: [chunked]
Vary: [Accept-Encoding]
- content-length: ['2189']
+ content-length: ['6735']
status: {code: 200, message: OK}
- request:
body: null
@@ -342,21 +313,22 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [a61e706e-1697-11e7-b60e-f4b7e2e85440]
+ x-ms-client-request-id: [177a9bbe-3a91-11e7-a894-a0b3ccf7272a]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG?api-version=2017-03-01
response:
body: {string: "{\r\n \"name\": \"vm1NSG\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\
- ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\",\r\n \
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\",\r\n \
\ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\
: \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\"\
- : \"Succeeded\",\r\n \"resourceGuid\": \"e1a9a417-53a8-4b13-af8d-d5f60e85669a\"\
+ : \"Succeeded\",\r\n \"resourceGuid\": \"06d0b2ae-cf07-4f71-9961-a6d1f2d0560d\"\
,\r\n \"securityRules\": [\r\n {\r\n \"name\": \"default-allow-ssh\"\
,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/default-allow-ssh\"\
- ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"protocol\": \"Tcp\",\r\n \"sourcePortRange\": \"\
*\",\r\n \"destinationPortRange\": \"22\",\r\n \"sourceAddressPrefix\"\
@@ -364,7 +336,7 @@ interactions:
access\": \"Allow\",\r\n \"priority\": 1000,\r\n \"direction\"\
: \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\
open-port-all\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/securityRules/open-port-all\"\
- ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
@@ -373,7 +345,7 @@ interactions:
: \"Inbound\"\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\"\
: [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\"\
: \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowVnetInBound\"\
- ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\
,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
@@ -383,7 +355,7 @@ interactions:
\ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\
\n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\
\ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\
- ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\
,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
@@ -392,7 +364,7 @@ interactions:
,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\
\ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\
\n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/DenyAllInBound\"\
- ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Deny all inbound traffic\",\r\n \
\ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \
@@ -401,7 +373,7 @@ interactions:
access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\
: \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\
AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowVnetOutBound\"\
- ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Allow outbound traffic from all VMs to all\
\ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\
@@ -410,7 +382,7 @@ interactions:
,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\
\ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\
\n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/AllowInternetOutBound\"\
- ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\
,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
@@ -419,7 +391,7 @@ interactions:
\ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \
\ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \
\ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG/defaultSecurityRules/DenyAllOutBound\"\
- ,\r\n \"etag\": \"W/\\\"35b90cac-1fef-48fd-901c-d0f80a58ba43\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"b5a3dd59-d43b-4102-9161-9cf9edf79734\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Deny all outbound traffic\",\r\n \
\ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \
@@ -432,8 +404,8 @@ interactions:
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:03 GMT']
- ETag: [W/"35b90cac-1fef-48fd-901c-d0f80a58ba43"]
+ Date: ['Tue, 16 May 2017 23:40:49 GMT']
+ ETag: [W/"b5a3dd59-d43b-4102-9161-9cf9edf79734"]
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
@@ -449,23 +421,24 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- computemanagementclient/0.33.1rc1 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 computemanagementclient/1.0.0rc1 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [a6dc6c08-1697-11e7-8dd1-f4b7e2e85440]
+ x-ms-client-request-id: [17a1289a-3a91-11e7-9813-a0b3ccf7272a]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/virtualMachines/vm1?api-version=2016-04-30-preview
response:
- body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"5075a256-2327-4846-b023-231e045604b5\"\
+ body: {string: "{\r\n \"properties\": {\r\n \"vmId\": \"b8d1de5a-64b6-4f37-bdd3-0fd302008576\"\
,\r\n \"hardwareProfile\": {\r\n \"vmSize\": \"Standard_DS1_v2\"\r\
\n },\r\n \"storageProfile\": {\r\n \"imageReference\": {\r\n \
\ \"publisher\": \"Canonical\",\r\n \"offer\": \"UbuntuServer\"\
,\r\n \"sku\": \"14.04.4-LTS\",\r\n \"version\": \"latest\"\r\
\n },\r\n \"osDisk\": {\r\n \"osType\": \"Linux\",\r\n \
- \ \"name\": \"osdisk_3bihPHQTJ0\",\r\n \"createOption\": \"FromImage\"\
+ \ \"name\": \"osdisk_YXbKt2a4DE\",\r\n \"createOption\": \"FromImage\"\
,\r\n \"caching\": \"ReadWrite\",\r\n \"managedDisk\": {\r\n\
\ \"storageAccountType\": \"Premium_LRS\",\r\n \"id\": \"\
- /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/disks/osdisk_3bihPHQTJ0\"\
+ /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Compute/disks/osdisk_YXbKt2a4DE\"\
\r\n },\r\n \"diskSizeGB\": 30\r\n },\r\n \"dataDisks\"\
: []\r\n },\r\n \"osProfile\": {\r\n \"computerName\": \"vm1\"\
,\r\n \"adminUsername\": \"ubuntu\",\r\n \"linuxConfiguration\"\
@@ -479,7 +452,7 @@ interactions:
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:05 GMT']
+ Date: ['Tue, 16 May 2017 23:40:49 GMT']
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
@@ -495,20 +468,21 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [a709bdd2-1697-11e7-b314-f4b7e2e85440]
+ x-ms-client-request-id: [17c33206-3a91-11e7-a030-a0b3ccf7272a]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic?api-version=2017-03-01
response:
body: {string: "{\r\n \"name\": \"vm1VMNic\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic\"\
- ,\r\n \"etag\": \"W/\\\"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d\\\"\",\r\n \
+ ,\r\n \"etag\": \"W/\\\"467e1f68-631a-4a50-9a85-7f0893f75459\\\"\",\r\n \
\ \"location\": \"westus\",\r\n \"tags\": {},\r\n \"properties\": {\r\n\
- \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"a841d97c-9eed-4000-bef6-05ba81198e68\"\
+ \ \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\": \"acf9de26-2136-403a-8429-12c3eaa63554\"\
,\r\n \"ipConfigurations\": [\r\n {\r\n \"name\": \"ipconfigvm1\"\
,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\
- ,\r\n \"etag\": \"W/\\\"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"467e1f68-631a-4a50-9a85-7f0893f75459\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\
: \"Dynamic\",\r\n \"publicIPAddress\": {\r\n \"id\":\
@@ -517,8 +491,8 @@ interactions:
\r\n },\r\n \"primary\": true,\r\n \"privateIPAddressVersion\"\
: \"IPv4\"\r\n }\r\n }\r\n ],\r\n \"dnsSettings\": {\r\n\
\ \"dnsServers\": [],\r\n \"appliedDnsServers\": [],\r\n \"\
- internalDomainNameSuffix\": \"yqoxwrdrqerepkqkjgsgl2amrc.dx.internal.cloudapp.net\"\
- \r\n },\r\n \"macAddress\": \"00-0D-3A-36-F9-C9\",\r\n \"enableAcceleratedNetworking\"\
+ internalDomainNameSuffix\": \"dpfibvfzyeaejlgmx3vt4p22cc.dx.internal.cloudapp.net\"\
+ \r\n },\r\n \"macAddress\": \"00-0D-3A-30-5C-3C\",\r\n \"enableAcceleratedNetworking\"\
: false,\r\n \"enableIPForwarding\": false,\r\n \"networkSecurityGroup\"\
: {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/vm1NSG\"\
\r\n },\r\n \"primary\": true,\r\n \"virtualMachine\": {\r\n \
@@ -528,8 +502,8 @@ interactions:
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:05 GMT']
- ETag: [W/"9b75fd4e-85cc-4c69-94c4-46b63b7e7c6d"]
+ Date: ['Tue, 16 May 2017 23:40:49 GMT']
+ ETag: [W/"467e1f68-631a-4a50-9a85-7f0893f75459"]
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
@@ -545,15 +519,16 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [a72f21a8-1697-11e7-97c5-f4b7e2e85440]
+ x-ms-client-request-id: [17efc81a-3a91-11e7-87e9-a0b3ccf7272a]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet?api-version=2017-03-01
response:
body: {string: "{\r\n \"name\": \"vm1Subnet\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\
- ,\r\n \"etag\": \"W/\\\"3d59c338-7994-44e4-8d70-2fa4e0ecfdeb\\\"\",\r\n \
+ ,\r\n \"etag\": \"W/\\\"f459dd81-724d-4c66-b439-6cfe004dd253\\\"\",\r\n \
\ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"\
addressPrefix\": \"10.0.0.0/24\",\r\n \"ipConfigurations\": [\r\n \
\ {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\
@@ -561,8 +536,8 @@ interactions:
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:05 GMT']
- ETag: [W/"3d59c338-7994-44e4-8d70-2fa4e0ecfdeb"]
+ Date: ['Tue, 16 May 2017 23:40:49 GMT']
+ ETag: [W/"f459dd81-724d-4c66-b439-6cfe004dd253"]
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
@@ -579,21 +554,22 @@ interactions:
Connection: [keep-alive]
Content-Length: ['22']
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [a7573208-1697-11e7-bb17-f4b7e2e85440]
+ x-ms-client-request-id: [18173da4-3a91-11e7-bfea-a0b3ccf7272a]
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg?api-version=2017-03-01
response:
body: {string: "{\r\n \"name\": \"newNsg\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg\"\
- ,\r\n \"etag\": \"W/\\\"fda9a35f-5618-4aa5-9eb8-ddbd6616c68a\\\"\",\r\n \
+ ,\r\n \"etag\": \"W/\\\"f0b25726-7cfc-4939-a5da-c5aefd86a8c7\\\"\",\r\n \
\ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\
: \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\
- ,\r\n \"resourceGuid\": \"2b91219b-09b1-428a-b93c-49083df6ba8f\",\r\n \
+ ,\r\n \"resourceGuid\": \"83ba7695-815c-4917-815e-234b1c1ea744\",\r\n \
\ \"securityRules\": [],\r\n \"defaultSecurityRules\": [\r\n {\r\
\n \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetInBound\"\
- ,\r\n \"etag\": \"W/\\\"fda9a35f-5618-4aa5-9eb8-ddbd6616c68a\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"f0b25726-7cfc-4939-a5da-c5aefd86a8c7\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\
,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\
,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
@@ -603,7 +579,7 @@ interactions:
\ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\
\n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\
\ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\
- ,\r\n \"etag\": \"W/\\\"fda9a35f-5618-4aa5-9eb8-ddbd6616c68a\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"f0b25726-7cfc-4939-a5da-c5aefd86a8c7\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\
,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\
,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
@@ -612,7 +588,7 @@ interactions:
,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\
\ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\
\n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllInBound\"\
- ,\r\n \"etag\": \"W/\\\"fda9a35f-5618-4aa5-9eb8-ddbd6616c68a\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"f0b25726-7cfc-4939-a5da-c5aefd86a8c7\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\
,\r\n \"description\": \"Deny all inbound traffic\",\r\n \
\ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \
@@ -621,7 +597,7 @@ interactions:
access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\
: \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\
AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetOutBound\"\
- ,\r\n \"etag\": \"W/\\\"fda9a35f-5618-4aa5-9eb8-ddbd6616c68a\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"f0b25726-7cfc-4939-a5da-c5aefd86a8c7\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\
,\r\n \"description\": \"Allow outbound traffic from all VMs to all\
\ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\
@@ -630,7 +606,7 @@ interactions:
,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\
\ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\
\n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowInternetOutBound\"\
- ,\r\n \"etag\": \"W/\\\"fda9a35f-5618-4aa5-9eb8-ddbd6616c68a\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"f0b25726-7cfc-4939-a5da-c5aefd86a8c7\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\
,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\
,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
@@ -639,7 +615,7 @@ interactions:
\ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \
\ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \
\ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllOutBound\"\
- ,\r\n \"etag\": \"W/\\\"fda9a35f-5618-4aa5-9eb8-ddbd6616c68a\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"f0b25726-7cfc-4939-a5da-c5aefd86a8c7\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\
,\r\n \"description\": \"Deny all outbound traffic\",\r\n \
\ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \
@@ -648,17 +624,17 @@ interactions:
access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\
: \"Outbound\"\r\n }\r\n }\r\n ]\r\n }\r\n}"}
headers:
- Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/360caa80-6fa6-42e9-9c90-8cba9d9e18e5?api-version=2017-03-01']
+ Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/fe380d2b-71a6-4500-9f37-fb8df9299b7b?api-version=2017-03-01']
Cache-Control: [no-cache]
Content-Length: ['5138']
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:06 GMT']
+ Date: ['Tue, 16 May 2017 23:40:50 GMT']
Expires: ['-1']
Pragma: [no-cache]
Retry-After: ['10']
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- x-ms-ratelimit-remaining-subscription-writes: ['1197']
+ x-ms-ratelimit-remaining-subscription-writes: ['1198']
status: {code: 201, message: Created}
- request:
body: null
@@ -667,18 +643,19 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [a7573208-1697-11e7-bb17-f4b7e2e85440]
+ x-ms-client-request-id: [18173da4-3a91-11e7-bfea-a0b3ccf7272a]
method: GET
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/360caa80-6fa6-42e9-9c90-8cba9d9e18e5?api-version=2017-03-01
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/fe380d2b-71a6-4500-9f37-fb8df9299b7b?api-version=2017-03-01
response:
body: {string: "{\r\n \"status\": \"Succeeded\"\r\n}"}
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:17 GMT']
+ Date: ['Tue, 16 May 2017 23:41:00 GMT']
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
@@ -694,21 +671,22 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [a7573208-1697-11e7-bb17-f4b7e2e85440]
+ x-ms-client-request-id: [18173da4-3a91-11e7-bfea-a0b3ccf7272a]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg?api-version=2017-03-01
response:
body: {string: "{\r\n \"name\": \"newNsg\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg\"\
- ,\r\n \"etag\": \"W/\\\"a89b28c2-a57e-49e9-845d-3cdf498d5777\\\"\",\r\n \
+ ,\r\n \"etag\": \"W/\\\"d8504aba-c21f-422d-ab19-c595af79b03e\\\"\",\r\n \
\ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\
: \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
- ,\r\n \"resourceGuid\": \"2b91219b-09b1-428a-b93c-49083df6ba8f\",\r\n \
+ ,\r\n \"resourceGuid\": \"83ba7695-815c-4917-815e-234b1c1ea744\",\r\n \
\ \"securityRules\": [],\r\n \"defaultSecurityRules\": [\r\n {\r\
\n \"name\": \"AllowVnetInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetInBound\"\
- ,\r\n \"etag\": \"W/\\\"a89b28c2-a57e-49e9-845d-3cdf498d5777\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"d8504aba-c21f-422d-ab19-c595af79b03e\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\
,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
@@ -718,7 +696,7 @@ interactions:
\ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\
\n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\
\ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\
- ,\r\n \"etag\": \"W/\\\"a89b28c2-a57e-49e9-845d-3cdf498d5777\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"d8504aba-c21f-422d-ab19-c595af79b03e\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\
,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
@@ -727,7 +705,7 @@ interactions:
,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\
\ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\
\n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllInBound\"\
- ,\r\n \"etag\": \"W/\\\"a89b28c2-a57e-49e9-845d-3cdf498d5777\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"d8504aba-c21f-422d-ab19-c595af79b03e\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Deny all inbound traffic\",\r\n \
\ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \
@@ -736,7 +714,7 @@ interactions:
access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\
: \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\
AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetOutBound\"\
- ,\r\n \"etag\": \"W/\\\"a89b28c2-a57e-49e9-845d-3cdf498d5777\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"d8504aba-c21f-422d-ab19-c595af79b03e\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Allow outbound traffic from all VMs to all\
\ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\
@@ -745,7 +723,7 @@ interactions:
,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\
\ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\
\n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowInternetOutBound\"\
- ,\r\n \"etag\": \"W/\\\"a89b28c2-a57e-49e9-845d-3cdf498d5777\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"d8504aba-c21f-422d-ab19-c595af79b03e\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\
,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
@@ -754,7 +732,7 @@ interactions:
\ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \
\ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \
\ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllOutBound\"\
- ,\r\n \"etag\": \"W/\\\"a89b28c2-a57e-49e9-845d-3cdf498d5777\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"d8504aba-c21f-422d-ab19-c595af79b03e\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Deny all outbound traffic\",\r\n \
\ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \
@@ -765,8 +743,8 @@ interactions:
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:17 GMT']
- ETag: [W/"a89b28c2-a57e-49e9-845d-3cdf498d5777"]
+ Date: ['Tue, 16 May 2017 23:41:01 GMT']
+ ETag: [W/"d8504aba-c21f-422d-ab19-c595af79b03e"]
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
@@ -776,41 +754,42 @@ interactions:
content-length: ['5145']
status: {code: 200, message: OK}
- request:
- body: '{"properties": {"destinationPortRange": "*", "sourcePortRange": "*", "protocol":
- "*", "access": "allow", "destinationAddressPrefix": "*", "priority": 900, "sourceAddressPrefix":
- "*", "direction": "inbound"}, "name": "open-port-all"}'
+ body: '{"name": "open-port-all", "properties": {"sourceAddressPrefix": "*", "direction":
+ "inbound", "priority": 900, "destinationPortRange": "*", "protocol": "*", "destinationAddressPrefix":
+ "*", "access": "allow", "sourcePortRange": "*"}}'
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['232']
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [af17e3ba-1697-11e7-abf2-f4b7e2e85440]
+ x-ms-client-request-id: [1f3f0f50-3a91-11e7-8863-a0b3ccf7272a]
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/securityRules/open-port-all?api-version=2017-03-01
response:
body: {string: "{\r\n \"name\": \"open-port-all\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/securityRules/open-port-all\"\
- ,\r\n \"etag\": \"W/\\\"9b8c6e07-b5d1-4234-8c5e-d5c4f03a734b\\\"\",\r\n \
+ ,\r\n \"etag\": \"W/\\\"0be30305-b192-4910-9c71-632a08861433\\\"\",\r\n \
\ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"\
protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\
: \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\
: \"*\",\r\n \"access\": \"Allow\",\r\n \"priority\": 900,\r\n \"\
direction\": \"Inbound\"\r\n }\r\n}"}
headers:
- Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/364634b9-909f-4cd2-816a-dd5bec8bb6ae?api-version=2017-03-01']
+ Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/f00ef70d-073b-448c-86c2-4422acef345e?api-version=2017-03-01']
Cache-Control: [no-cache]
Content-Length: ['570']
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:18 GMT']
+ Date: ['Tue, 16 May 2017 23:41:02 GMT']
Expires: ['-1']
Pragma: [no-cache]
Retry-After: ['10']
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- x-ms-ratelimit-remaining-subscription-writes: ['1199']
+ x-ms-ratelimit-remaining-subscription-writes: ['1198']
status: {code: 201, message: Created}
- request:
body: null
@@ -819,18 +798,19 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [af17e3ba-1697-11e7-abf2-f4b7e2e85440]
+ x-ms-client-request-id: [1f3f0f50-3a91-11e7-8863-a0b3ccf7272a]
method: GET
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/364634b9-909f-4cd2-816a-dd5bec8bb6ae?api-version=2017-03-01
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/f00ef70d-073b-448c-86c2-4422acef345e?api-version=2017-03-01
response:
body: {string: "{\r\n \"status\": \"Succeeded\"\r\n}"}
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:29 GMT']
+ Date: ['Tue, 16 May 2017 23:41:13 GMT']
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
@@ -846,15 +826,16 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [af17e3ba-1697-11e7-abf2-f4b7e2e85440]
+ x-ms-client-request-id: [1f3f0f50-3a91-11e7-8863-a0b3ccf7272a]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/securityRules/open-port-all?api-version=2017-03-01
response:
body: {string: "{\r\n \"name\": \"open-port-all\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/securityRules/open-port-all\"\
- ,\r\n \"etag\": \"W/\\\"3180cf40-8b1d-454c-becc-3ae196aecae0\\\"\",\r\n \
+ ,\r\n \"etag\": \"W/\\\"f26b729e-2bbc-4236-9d9c-dc34973b52e7\\\"\",\r\n \
\ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"\
protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \"destinationPortRange\"\
: \"*\",\r\n \"sourceAddressPrefix\": \"*\",\r\n \"destinationAddressPrefix\"\
@@ -863,8 +844,8 @@ interactions:
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:29 GMT']
- ETag: [W/"3180cf40-8b1d-454c-becc-3ae196aecae0"]
+ Date: ['Tue, 16 May 2017 23:41:13 GMT']
+ ETag: [W/"f26b729e-2bbc-4236-9d9c-dc34973b52e7"]
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
@@ -874,60 +855,63 @@ interactions:
content-length: ['571']
status: {code: 200, message: OK}
- request:
- body: '{"etag": "W/\"3d59c338-7994-44e4-8d70-2fa4e0ecfdeb\"", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet",
- "properties": {"addressPrefix": "10.0.0.0/24", "networkSecurityGroup": {"etag":
- "W/\"a89b28c2-a57e-49e9-845d-3cdf498d5777\"", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg",
- "properties": {"resourceGuid": "2b91219b-09b1-428a-b93c-49083df6ba8f", "securityRules":
- [], "defaultSecurityRules": [{"etag": "W/\"a89b28c2-a57e-49e9-845d-3cdf498d5777\"",
+ body: '{"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet",
+ "etag": "W/\"f459dd81-724d-4c66-b439-6cfe004dd253\"", "properties": {"provisioningState":
+ "Succeeded", "addressPrefix": "10.0.0.0/24", "networkSecurityGroup": {"id":
+ "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg",
+ "etag": "W/\"d8504aba-c21f-422d-ab19-c595af79b03e\"", "properties": {"securityRules":
+ [], "provisioningState": "Succeeded", "defaultSecurityRules": [{"etag": "W/\"d8504aba-c21f-422d-ab19-c595af79b03e\"",
"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetInBound",
- "properties": {"destinationPortRange": "*", "description": "Allow inbound traffic
- from all VMs in VNET", "direction": "Inbound", "protocol": "*", "access": "Allow",
- "destinationAddressPrefix": "VirtualNetwork", "priority": 65000, "sourceAddressPrefix":
- "VirtualNetwork", "provisioningState": "Succeeded", "sourcePortRange": "*"},
- "name": "AllowVnetInBound"}, {"etag": "W/\"a89b28c2-a57e-49e9-845d-3cdf498d5777\"",
+ "name": "AllowVnetInBound", "properties": {"sourceAddressPrefix": "VirtualNetwork",
+ "direction": "Inbound", "priority": 65000, "provisioningState": "Succeeded",
+ "destinationPortRange": "*", "protocol": "*", "destinationAddressPrefix": "VirtualNetwork",
+ "access": "Allow", "sourcePortRange": "*", "description": "Allow inbound traffic
+ from all VMs in VNET"}}, {"etag": "W/\"d8504aba-c21f-422d-ab19-c595af79b03e\"",
"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowAzureLoadBalancerInBound",
- "properties": {"destinationPortRange": "*", "description": "Allow inbound traffic
- from azure load balancer", "direction": "Inbound", "protocol": "*", "access":
- "Allow", "destinationAddressPrefix": "*", "priority": 65001, "sourceAddressPrefix":
- "AzureLoadBalancer", "provisioningState": "Succeeded", "sourcePortRange": "*"},
- "name": "AllowAzureLoadBalancerInBound"}, {"etag": "W/\"a89b28c2-a57e-49e9-845d-3cdf498d5777\"",
+ "name": "AllowAzureLoadBalancerInBound", "properties": {"sourceAddressPrefix":
+ "AzureLoadBalancer", "direction": "Inbound", "priority": 65001, "provisioningState":
+ "Succeeded", "destinationPortRange": "*", "protocol": "*", "destinationAddressPrefix":
+ "*", "access": "Allow", "sourcePortRange": "*", "description": "Allow inbound
+ traffic from azure load balancer"}}, {"etag": "W/\"d8504aba-c21f-422d-ab19-c595af79b03e\"",
"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllInBound",
- "properties": {"destinationPortRange": "*", "description": "Deny all inbound
- traffic", "direction": "Inbound", "protocol": "*", "access": "Deny", "destinationAddressPrefix":
- "*", "priority": 65500, "sourceAddressPrefix": "*", "provisioningState": "Succeeded",
- "sourcePortRange": "*"}, "name": "DenyAllInBound"}, {"etag": "W/\"a89b28c2-a57e-49e9-845d-3cdf498d5777\"",
+ "name": "DenyAllInBound", "properties": {"sourceAddressPrefix": "*", "direction":
+ "Inbound", "priority": 65500, "provisioningState": "Succeeded", "destinationPortRange":
+ "*", "protocol": "*", "destinationAddressPrefix": "*", "access": "Deny", "sourcePortRange":
+ "*", "description": "Deny all inbound traffic"}}, {"etag": "W/\"d8504aba-c21f-422d-ab19-c595af79b03e\"",
"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetOutBound",
- "properties": {"destinationPortRange": "*", "description": "Allow outbound traffic
- from all VMs to all VMs in VNET", "direction": "Outbound", "protocol": "*",
- "access": "Allow", "destinationAddressPrefix": "VirtualNetwork", "priority":
- 65000, "sourceAddressPrefix": "VirtualNetwork", "provisioningState": "Succeeded",
- "sourcePortRange": "*"}, "name": "AllowVnetOutBound"}, {"etag": "W/\"a89b28c2-a57e-49e9-845d-3cdf498d5777\"",
+ "name": "AllowVnetOutBound", "properties": {"sourceAddressPrefix": "VirtualNetwork",
+ "direction": "Outbound", "priority": 65000, "provisioningState": "Succeeded",
+ "destinationPortRange": "*", "protocol": "*", "destinationAddressPrefix": "VirtualNetwork",
+ "access": "Allow", "sourcePortRange": "*", "description": "Allow outbound traffic
+ from all VMs to all VMs in VNET"}}, {"etag": "W/\"d8504aba-c21f-422d-ab19-c595af79b03e\"",
"id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowInternetOutBound",
- "properties": {"destinationPortRange": "*", "description": "Allow outbound traffic
- from all VMs to Internet", "direction": "Outbound", "protocol": "*", "access":
- "Allow", "destinationAddressPrefix": "Internet", "priority": 65001, "sourceAddressPrefix":
- "*", "provisioningState": "Succeeded", "sourcePortRange": "*"}, "name": "AllowInternetOutBound"},
- {"etag": "W/\"a89b28c2-a57e-49e9-845d-3cdf498d5777\"", "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllOutBound",
- "properties": {"destinationPortRange": "*", "description": "Deny all outbound
- traffic", "direction": "Outbound", "protocol": "*", "access": "Deny", "destinationAddressPrefix":
- "*", "priority": 65500, "sourceAddressPrefix": "*", "provisioningState": "Succeeded",
- "sourcePortRange": "*"}, "name": "DenyAllOutBound"}], "provisioningState": "Succeeded"},
- "location": "westus"}, "provisioningState": "Succeeded"}, "name": "vm1Subnet"}'
+ "name": "AllowInternetOutBound", "properties": {"sourceAddressPrefix": "*",
+ "direction": "Outbound", "priority": 65001, "provisioningState": "Succeeded",
+ "destinationPortRange": "*", "protocol": "*", "destinationAddressPrefix": "Internet",
+ "access": "Allow", "sourcePortRange": "*", "description": "Allow outbound traffic
+ from all VMs to Internet"}}, {"etag": "W/\"d8504aba-c21f-422d-ab19-c595af79b03e\"",
+ "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllOutBound",
+ "name": "DenyAllOutBound", "properties": {"sourceAddressPrefix": "*", "direction":
+ "Outbound", "priority": 65500, "provisioningState": "Succeeded", "destinationPortRange":
+ "*", "protocol": "*", "destinationAddressPrefix": "*", "access": "Deny", "sourcePortRange":
+ "*", "description": "Deny all outbound traffic"}}], "resourceGuid": "83ba7695-815c-4917-815e-234b1c1ea744"},
+ "location": "westus"}}, "name": "vm1Subnet"}'
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['4339']
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [b63ffeec-1697-11e7-8f60-f4b7e2e85440]
+ x-ms-client-request-id: [26673678-3a91-11e7-afe4-a0b3ccf7272a]
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet?api-version=2017-03-01
response:
body: {string: "{\r\n \"name\": \"vm1Subnet\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\
- ,\r\n \"etag\": \"W/\\\"32c1cb2b-991e-4536-8e5b-53c411b9c1e3\\\"\",\r\n \
+ ,\r\n \"etag\": \"W/\\\"4b1faf1a-281a-4eb0-8225-5c85f49f8ed9\\\"\",\r\n \
\ \"properties\": {\r\n \"provisioningState\": \"Updating\",\r\n \"\
addressPrefix\": \"10.0.0.0/24\",\r\n \"networkSecurityGroup\": {\r\n \
\ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg\"\
@@ -935,10 +919,10 @@ interactions:
/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkInterfaces/vm1VMNic/ipConfigurations/ipconfigvm1\"\
\r\n }\r\n ]\r\n }\r\n}"}
headers:
- Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/c401ae58-d935-4c57-88fb-9d74e801f0d4?api-version=2017-03-01']
+ Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/7780cb3c-66c8-45b8-9076-1b7ec01060c7?api-version=2017-03-01']
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:31 GMT']
+ Date: ['Tue, 16 May 2017 23:41:14 GMT']
Expires: ['-1']
Pragma: [no-cache]
Retry-After: ['3']
@@ -947,7 +931,7 @@ interactions:
Transfer-Encoding: [chunked]
Vary: [Accept-Encoding]
content-length: ['806']
- x-ms-ratelimit-remaining-subscription-writes: ['1199']
+ x-ms-ratelimit-remaining-subscription-writes: ['1198']
status: {code: 200, message: OK}
- request:
body: null
@@ -956,18 +940,19 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [b63ffeec-1697-11e7-8f60-f4b7e2e85440]
+ x-ms-client-request-id: [26673678-3a91-11e7-afe4-a0b3ccf7272a]
method: GET
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/c401ae58-d935-4c57-88fb-9d74e801f0d4?api-version=2017-03-01
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/7780cb3c-66c8-45b8-9076-1b7ec01060c7?api-version=2017-03-01
response:
body: {string: "{\r\n \"status\": \"Succeeded\"\r\n}"}
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:34 GMT']
+ Date: ['Tue, 16 May 2017 23:41:18 GMT']
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
@@ -983,15 +968,16 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [b63ffeec-1697-11e7-8f60-f4b7e2e85440]
+ x-ms-client-request-id: [26673678-3a91-11e7-afe4-a0b3ccf7272a]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet?api-version=2017-03-01
response:
body: {string: "{\r\n \"name\": \"vm1Subnet\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\
- ,\r\n \"etag\": \"W/\\\"63ff1aae-705e-4b66-a59d-6360a593c7ef\\\"\",\r\n \
+ ,\r\n \"etag\": \"W/\\\"fd8c47c9-4595-4936-876b-68369f62ed80\\\"\",\r\n \
\ \"properties\": {\r\n \"provisioningState\": \"Succeeded\",\r\n \"\
addressPrefix\": \"10.0.0.0/24\",\r\n \"networkSecurityGroup\": {\r\n \
\ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg\"\
@@ -1001,8 +987,8 @@ interactions:
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:35 GMT']
- ETag: [W/"63ff1aae-705e-4b66-a59d-6360a593c7ef"]
+ Date: ['Tue, 16 May 2017 23:41:18 GMT']
+ ETag: [W/"fd8c47c9-4595-4936-876b-68369f62ed80"]
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
@@ -1018,21 +1004,122 @@ interactions:
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- User-Agent: [python/3.5.0 (Windows-10.0.10586) requests/2.9.1 msrest/0.4.6 msrest_azure/0.4.7
- networkmanagementclient/0.30.0 Azure-SDK-For-Python AZURECLI/TEST/2.0.1+dev]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
+ accept-language: [en-US]
+ x-ms-client-request-id: [29636d2e-3a91-11e7-b928-a0b3ccf7272a]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg?api-version=2017-03-01
+ response:
+ body: {string: "{\r\n \"name\": \"newNsg\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg\"\
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\",\r\n \
+ \ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\
+ : \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"resourceGuid\": \"83ba7695-815c-4917-815e-234b1c1ea744\",\r\n \
+ \ \"securityRules\": [\r\n {\r\n \"name\": \"open-port-all\"\
+ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/securityRules/open-port-all\"\
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
+ ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
+ : \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"\
+ access\": \"Allow\",\r\n \"priority\": 900,\r\n \"direction\"\
+ : \"Inbound\"\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\"\
+ : [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\"\
+ : \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetInBound\"\
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\
+ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
+ ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
+ : \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\
+ ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\
+ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\
+ \n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\
+ \ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\
+ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
+ ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
+ : \"AzureLoadBalancer\",\r\n \"destinationAddressPrefix\": \"*\"\
+ ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\
+ \ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\
+ \n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllInBound\"\
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"description\": \"Deny all inbound traffic\",\r\n \
+ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \
+ \ \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
+ : \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"\
+ access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\
+ : \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\
+ AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetOutBound\"\
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"description\": \"Allow outbound traffic from all VMs to all\
+ \ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\
+ : \"*\",\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
+ : \"VirtualNetwork\",\r\n \"destinationAddressPrefix\": \"VirtualNetwork\"\
+ ,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\
+ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\
+ \n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowInternetOutBound\"\
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\
+ ,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
+ ,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
+ : \"*\",\r\n \"destinationAddressPrefix\": \"Internet\",\r\n \
+ \ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \
+ \ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \
+ \ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllOutBound\"\
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"description\": \"Deny all outbound traffic\",\r\n \
+ \ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \
+ \ \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
+ : \"*\",\r\n \"destinationAddressPrefix\": \"*\",\r\n \"\
+ access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\
+ : \"Outbound\"\r\n }\r\n }\r\n ],\r\n \"subnets\": [\r\n\
+ \ {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/virtualNetworks/vm1VNET/subnets/vm1Subnet\"\
+ \r\n }\r\n ]\r\n }\r\n}"}
+ headers:
+ Cache-Control: [no-cache]
+ Content-Type: [application/json; charset=utf-8]
+ Date: ['Tue, 16 May 2017 23:41:18 GMT']
+ ETag: [W/"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68"]
+ Expires: ['-1']
+ Pragma: [no-cache]
+ Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
+ Strict-Transport-Security: [max-age=31536000; includeSubDomains]
+ Transfer-Encoding: [chunked]
+ Vary: [Accept-Encoding]
+ content-length: ['6043']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/TEST/2.0.6+dev]
accept-language: [en-US]
- x-ms-client-request-id: [b9ddd81e-1697-11e7-a9bc-f4b7e2e85440]
+ x-ms-client-request-id: [298021f4-3a91-11e7-9cf2-a0b3ccf7272a]
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg?api-version=2017-03-01
response:
body: {string: "{\r\n \"name\": \"newNsg\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg\"\
- ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\",\r\n \
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\",\r\n \
\ \"type\": \"Microsoft.Network/networkSecurityGroups\",\r\n \"location\"\
: \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
- ,\r\n \"resourceGuid\": \"2b91219b-09b1-428a-b93c-49083df6ba8f\",\r\n \
+ ,\r\n \"resourceGuid\": \"83ba7695-815c-4917-815e-234b1c1ea744\",\r\n \
\ \"securityRules\": [\r\n {\r\n \"name\": \"open-port-all\"\
,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/securityRules/open-port-all\"\
- ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
,\r\n \"destinationPortRange\": \"*\",\r\n \"sourceAddressPrefix\"\
@@ -1041,7 +1128,7 @@ interactions:
: \"Inbound\"\r\n }\r\n }\r\n ],\r\n \"defaultSecurityRules\"\
: [\r\n {\r\n \"name\": \"AllowVnetInBound\",\r\n \"id\"\
: \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetInBound\"\
- ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Allow inbound traffic from all VMs in VNET\"\
,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
@@ -1051,7 +1138,7 @@ interactions:
\ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\
\n \"name\": \"AllowAzureLoadBalancerInBound\",\r\n \"id\":\
\ \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowAzureLoadBalancerInBound\"\
- ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Allow inbound traffic from azure load balancer\"\
,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
@@ -1060,7 +1147,7 @@ interactions:
,\r\n \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n\
\ \"direction\": \"Inbound\"\r\n }\r\n },\r\n {\r\
\n \"name\": \"DenyAllInBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllInBound\"\
- ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Deny all inbound traffic\",\r\n \
\ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \
@@ -1069,7 +1156,7 @@ interactions:
access\": \"Deny\",\r\n \"priority\": 65500,\r\n \"direction\"\
: \"Inbound\"\r\n }\r\n },\r\n {\r\n \"name\": \"\
AllowVnetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowVnetOutBound\"\
- ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Allow outbound traffic from all VMs to all\
\ VMs in VNET\",\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\"\
@@ -1078,7 +1165,7 @@ interactions:
,\r\n \"access\": \"Allow\",\r\n \"priority\": 65000,\r\n\
\ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\
\n \"name\": \"AllowInternetOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/AllowInternetOutBound\"\
- ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Allow outbound traffic from all VMs to Internet\"\
,\r\n \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\"\
@@ -1087,7 +1174,7 @@ interactions:
\ \"access\": \"Allow\",\r\n \"priority\": 65001,\r\n \
\ \"direction\": \"Outbound\"\r\n }\r\n },\r\n {\r\n \
\ \"name\": \"DenyAllOutBound\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_open_port/providers/Microsoft.Network/networkSecurityGroups/newNsg/defaultSecurityRules/DenyAllOutBound\"\
- ,\r\n \"etag\": \"W/\\\"caf86478-953e-48b0-a2db-a0548c82b687\\\"\"\
+ ,\r\n \"etag\": \"W/\\\"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"description\": \"Deny all outbound traffic\",\r\n \
\ \"protocol\": \"*\",\r\n \"sourcePortRange\": \"*\",\r\n \
@@ -1100,8 +1187,8 @@ interactions:
headers:
Cache-Control: [no-cache]
Content-Type: [application/json; charset=utf-8]
- Date: ['Sat, 01 Apr 2017 04:57:37 GMT']
- ETag: [W/"caf86478-953e-48b0-a2db-a0548c82b687"]
+ Date: ['Tue, 16 May 2017 23:41:19 GMT']
+ ETag: [W/"1849fbb6-9d1b-4064-a0ce-ac84b5cebf68"]
Expires: ['-1']
Pragma: [no-cache]
Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
diff --git a/src/command_modules/azure-cli-vm/tests/test_vm_commands.py b/src/command_modules/azure-cli-vm/tests/test_vm_commands.py
index 04b61dfbe..0040ba3f0 100644
--- a/src/command_modules/azure-cli-vm/tests/test_vm_commands.py
+++ b/src/command_modules/azure-cli-vm/tests/test_vm_commands.py
@@ -95,7 +95,7 @@ class VMOpenPortTest(ResourceGroupVCRTestBase):
vm = self.vm_name
# min params - apply to existing NIC (updates existing NSG)
- nsg_id = self.cmd('vm open-port -g {} -n {} --port * --priority 900'.format(rg, vm))['networkSecurityGroup']['id']
+ nsg_id = self.cmd('vm open-port -g {} -n {} --port * --priority 900'.format(rg, vm))['id']
nsg_name = os.path.split(nsg_id)[1]
self.cmd('network nsg show -g {} -n {}'.format(rg, nsg_name),
checks=JMESPathCheck("length(securityRules[?name == 'open-port-all'])", 1))
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 4
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "python scripts/dev_setup.py",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.5",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
adal==0.4.3
applicationinsights==0.10.0
argcomplete==1.8.0
astroid==1.4.9
attrs==22.2.0
autopep8==1.2.4
azure-batch==2.0.1
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli&subdirectory=src/azure-cli
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_cdn&subdirectory=src/command_modules/azure-cli-cdn
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_cognitiveservices&subdirectory=src/command_modules/azure-cli-cognitiveservices
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_core&subdirectory=src/azure-cli-core
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_cosmosdb&subdirectory=src/command_modules/azure-cli-cosmosdb
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_dla&subdirectory=src/command_modules/azure-cli-dla
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_dls&subdirectory=src/command_modules/azure-cli-dls
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_find&subdirectory=src/command_modules/azure-cli-find
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_interactive&subdirectory=src/command_modules/azure-cli-interactive
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_lab&subdirectory=src/command_modules/azure-cli-lab
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_monitor&subdirectory=src/command_modules/azure-cli-monitor
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_rdbms&subdirectory=src/command_modules/azure-cli-rdbms
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_sf&subdirectory=src/command_modules/azure-cli-sf
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_testsdk&subdirectory=src/azure-cli-testsdk
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_utility_automation&subdirectory=scripts
-e git+https://github.com/Azure/azure-cli.git@4417fb03c91b0caa5f88a72ca0372d5931c072d9#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm
azure-common==1.1.28
azure-core==1.24.2
azure-datalake-store==0.0.9
azure-graphrbac==0.30.0rc6
azure-keyvault==0.3.0
azure-mgmt-authorization==0.30.0rc6
azure-mgmt-batch==3.0.1
azure-mgmt-cdn==0.30.2
azure-mgmt-cognitiveservices==1.0.0
azure-mgmt-compute==1.0.0rc1
azure-mgmt-containerregistry==0.2.1
azure-mgmt-datalake-analytics==0.1.4
azure-mgmt-datalake-nspkg==3.0.1
azure-mgmt-datalake-store==0.1.4
azure-mgmt-devtestlabs==2.0.0
azure-mgmt-dns==1.0.1
azure-mgmt-documentdb==0.1.3
azure-mgmt-iothub==0.2.2
azure-mgmt-keyvault==0.31.0
azure-mgmt-monitor==0.2.1
azure-mgmt-network==1.0.0rc3
azure-mgmt-nspkg==1.0.0
azure-mgmt-rdbms==0.1.0
azure-mgmt-redis==1.0.0
azure-mgmt-resource==1.1.0rc1
azure-mgmt-sql==0.4.0
azure-mgmt-storage==1.0.0rc1
azure-mgmt-trafficmanager==0.30.0
azure-mgmt-web==0.32.0
azure-monitor==0.3.0
azure-multiapi-storage==0.1.0
azure-nspkg==1.0.0
azure-servicefabric==5.6.130
certifi==2021.5.30
cffi==1.15.1
colorama==0.3.7
coverage==4.2
cryptography==40.0.2
flake8==3.2.1
futures==3.1.1
importlib-metadata==4.8.3
iniconfig==1.1.1
isodate==0.7.0
jeepney==0.7.1
jmespath==0.10.0
keyring==23.4.1
lazy-object-proxy==1.7.1
mccabe==0.5.3
mock==1.3.0
msrest==0.4.29
msrestazure==0.4.34
nose==1.3.7
oauthlib==3.2.2
packaging==21.3
paramiko==2.0.2
pbr==6.1.1
pep8==1.7.1
pluggy==1.0.0
prompt-toolkit==3.0.36
py==1.11.0
pyasn1==0.5.1
pycodestyle==2.2.0
pycparser==2.21
pydocumentdb==2.3.5
pyflakes==1.3.0
Pygments==2.1.3
PyJWT==2.4.0
pylint==1.5.4
pyOpenSSL==16.2.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==3.11
requests==2.9.1
requests-oauthlib==2.0.0
scp==0.15.0
SecretStorage==3.3.3
six==1.10.0
sshtunnel==0.4.0
tabulate==0.7.7
tomli==1.2.3
typing-extensions==4.1.1
urllib3==1.16
vcrpy==1.10.3
vsts-cd-manager==1.0.2
wcwidth==0.2.13
Whoosh==2.7.4
wrapt==1.16.0
xmltodict==0.14.2
zipp==3.6.0
|
name: azure-cli
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- adal==0.4.3
- applicationinsights==0.10.0
- argcomplete==1.8.0
- astroid==1.4.9
- attrs==22.2.0
- autopep8==1.2.4
- azure-batch==2.0.1
- azure-common==1.1.28
- azure-core==1.24.2
- azure-datalake-store==0.0.9
- azure-graphrbac==0.30.0rc6
- azure-keyvault==0.3.0
- azure-mgmt-authorization==0.30.0rc6
- azure-mgmt-batch==3.0.1
- azure-mgmt-cdn==0.30.2
- azure-mgmt-cognitiveservices==1.0.0
- azure-mgmt-compute==1.0.0rc1
- azure-mgmt-containerregistry==0.2.1
- azure-mgmt-datalake-analytics==0.1.4
- azure-mgmt-datalake-nspkg==3.0.1
- azure-mgmt-datalake-store==0.1.4
- azure-mgmt-devtestlabs==2.0.0
- azure-mgmt-dns==1.0.1
- azure-mgmt-documentdb==0.1.3
- azure-mgmt-iothub==0.2.2
- azure-mgmt-keyvault==0.31.0
- azure-mgmt-monitor==0.2.1
- azure-mgmt-network==1.0.0rc3
- azure-mgmt-nspkg==1.0.0
- azure-mgmt-rdbms==0.1.0
- azure-mgmt-redis==1.0.0
- azure-mgmt-resource==1.1.0rc1
- azure-mgmt-sql==0.4.0
- azure-mgmt-storage==1.0.0rc1
- azure-mgmt-trafficmanager==0.30.0
- azure-mgmt-web==0.32.0
- azure-monitor==0.3.0
- azure-multiapi-storage==0.1.0
- azure-nspkg==1.0.0
- azure-servicefabric==5.6.130
- cffi==1.15.1
- colorama==0.3.7
- coverage==4.2
- cryptography==40.0.2
- flake8==3.2.1
- futures==3.1.1
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- isodate==0.7.0
- jeepney==0.7.1
- jmespath==0.10.0
- keyring==23.4.1
- lazy-object-proxy==1.7.1
- mccabe==0.5.3
- mock==1.3.0
- msrest==0.4.29
- msrestazure==0.4.34
- nose==1.3.7
- oauthlib==3.2.2
- packaging==21.3
- paramiko==2.0.2
- pbr==6.1.1
- pep8==1.7.1
- pip==9.0.1
- pluggy==1.0.0
- prompt-toolkit==3.0.36
- py==1.11.0
- pyasn1==0.5.1
- pycodestyle==2.2.0
- pycparser==2.21
- pydocumentdb==2.3.5
- pyflakes==1.3.0
- pygments==2.1.3
- pyjwt==2.4.0
- pylint==1.5.4
- pyopenssl==16.2.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==3.11
- requests==2.9.1
- requests-oauthlib==2.0.0
- scp==0.15.0
- secretstorage==3.3.3
- setuptools==30.4.0
- six==1.10.0
- sshtunnel==0.4.0
- tabulate==0.7.7
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.16
- vcrpy==1.10.3
- vsts-cd-manager==1.0.2
- wcwidth==0.2.13
- whoosh==2.7.4
- wrapt==1.16.0
- xmltodict==0.14.2
- zipp==3.6.0
prefix: /opt/conda/envs/azure-cli
|
[
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMOpenPortTest::test_vm_open_port"
] |
[
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateLinuxSecretsScenarioTest::test_vm_create_linux_secrets",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateWindowsSecretsScenarioTest::test_vm_create_windows_secrets",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSCreateLinuxSecretsScenarioTest::test_vmss_create_linux_secrets"
] |
[
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMImageListByAliasesScenarioTest::test_vm_image_list_by_alias",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMUsageScenarioTest::test_vm_usage",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMImageListThruServiceScenarioTest::test_vm_images_list_thru_services",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMShowListSizesListIPAddressesScenarioTest::test_vm_show_list_sizes_list_ip_addresses",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSizeListScenarioTest::test_vm_size_list",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMImageListOffersScenarioTest::test_vm_image_list_offers",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMImageListPublishersScenarioTest::test_vm_image_list_publishers",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMImageListSkusScenarioTest::test_vm_image_list_skus",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMImageShowScenarioTest::test_vm_image_show",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMGeneralizeScenarioTest::test_vm_generalize",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMWindowsLicenseTest::test_windows_vm_license_type",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateFromUnmanagedDiskTest::test_vm_create_from_unmanaged_disk",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateWithSpecializedUnmanagedDiskTest::test_vm_create_with_specialized_unmanaged_disk",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMManagedDiskScenarioTest::test_managed_disk",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateAndStateModificationsScenarioTest::test_vm_create_state_modifications",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMNoWaitScenarioTest::test_vm_create_no_wait",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMAvailSetScenarioTest::test_vm_availset",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMExtensionScenarioTest::test_vm_extension",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMMachineExtensionImageScenarioTest::test_vm_machine_extension_image",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMExtensionImageSearchScenarioTest::test_vm_extension_image_search",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateUbuntuScenarioTest::test_vm_create_ubuntu",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMMultiNicScenarioTest::test_vm_create_multi_nics",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateNoneOptionsTest::test_vm_create_none_options",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMBootDiagnostics::test_vm_boot_diagnostics",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSExtensionInstallTest::test_vmss_extension",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::DiagnosticsExtensionInstallTest::test_diagnostics_extension_install",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateExistingOptions::test_vm_create_existing_options",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateExistingIdsOptions::test_vm_create_existing_ids_options",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateCustomIP::test_vm_create_custom_ip",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMDiskAttachDetachTest::test_vm_disk_attach_detach",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMUnmanagedDataDiskTest::test_vm_data_unmanaged_disk",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMCreateCustomDataScenarioTest::test_vm_create_custom_data",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSCreateAndModify::test_vmss_create_and_modify",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSCreateOptions::test_vmss_create_options",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSCreateNoneOptionsTest::test_vmss_create_none_options",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSCreateExistingOptions::test_vmss_create_existing_options",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSCreateExistingIdsOptions::test_vmss_create_existing_ids_options",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSVMsScenarioTest::test_vmss_vms",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSCustomDataScenarioTest::test_vmss_create_custom_data",
"src/command_modules/azure-cli-vm/tests/test_vm_commands.py::VMSSNicScenarioTest::test_vmss_nics"
] |
[] |
MIT License
| 1,253 |
hylang__hy-1294
|
7c53a07b93084a0970cdf192d4aa2d712d557154
|
2017-05-16 23:42:41
|
5c720c0110908e3f47dba2e4cc1c820d16f359a1
|
gilch: I would also prefer one canonical capitalization, but I'm more inclined to use all-lowercase `nan` and `inf`, since that is the Python repr.
```
>>> float('NaN')
nan
>>> float('Inf')
inf
```
Kodiologist: I noticed that, but I figured that starting with a capital letter is better for symmetry with `False`, `True`, and `None`, and the meaning of `NaN` is clearer when written in CamelCase.
Also, I'm not 100% sure that the Python `repr` is platform-independent.
tuturto: For what it's worth, I get all lowercase inf and nan when doing ```float('NaN')``` on my Windows 10 machine or Linux machine, on both Python 2.x and 3.x. That said, I kind of like ```NaN``` nicer looking than ```nan```.
I would be inclined to choose ```NaN``` and ```Inf```` over ```nan``` and ```inf````, but I don't feel about this particularly strongly.
gilch: I'm not sure what to think. I guess my feelings are not that strong either. @kirbyfan64, what say you?
kirbyfan64: My only question is whether or not it's actually *worthwhile* to add so much extra code just to check the inf and NaN capitalization...
Kodiologist: I'm all for concise implementation, but surely you don't mean to suggest that we should interpret all of `Nan`, `nan`, `nAN`, etc. as the special floating-point value, in defiance of the case-sensitivity of the rest of the language, do you? Surely a bunch of code is a reasonable price to pay for avoiding that.
Kodiologist: C'mon, guys, nothing will happen if you don't make any decisions.
kirbyfan64: @Kodiologist can you rebase this?
|
diff --git a/NEWS b/NEWS
index a21c5142..4c963f4f 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ Changes from 0.13.0
* The compiler now automatically promotes values to Hy model objects
as necessary, so you can write ``(eval `(+ 1 ~n))`` instead of
``(eval `(+ 1 ~(HyInteger n)))``
+ * Literal `Inf`s and `NaN`s must now be capitalized like that
[ Bug Fixes ]
* Numeric literals are no longer parsed as symbols when followed by a dot
diff --git a/docs/language/api.rst b/docs/language/api.rst
index 5ed646d0..5241b3ab 100644
--- a/docs/language/api.rst
+++ b/docs/language/api.rst
@@ -52,6 +52,9 @@ digits.
(print 10,000,000,000 10_000_000_000)
+Unlike Python, Hy provides literal forms for NaN and infinity: `NaN`, `Inf`,
+and `-Inf`.
+
string literals
---------------
diff --git a/hy/contrib/hy_repr.hy b/hy/contrib/hy_repr.hy
index b5289740..20535044 100644
--- a/hy/contrib/hy_repr.hy
+++ b/hy/contrib/hy_repr.hy
@@ -2,8 +2,10 @@
;; This file is part of Hy, which is free software licensed under the Expat
;; license. See the LICENSE.
-(import [hy._compat [PY3 str-type bytes-type long-type]])
-(import [hy.models [HyObject HyExpression HySymbol HyKeyword HyInteger HyList HyDict HySet HyString HyBytes]])
+(import
+ [math [isnan]]
+ [hy._compat [PY3 str-type bytes-type long-type]]
+ [hy.models [HyObject HyExpression HySymbol HyKeyword HyInteger HyFloat HyComplex HyList HyDict HySet HyString HyBytes]])
(defn hy-repr [obj]
(setv seen (set))
@@ -72,8 +74,14 @@
(.format "(int {})" (repr x))
(and (not PY3) (in t [long_type HyInteger]))
(.rstrip (repr x) "L")
- (is t complex)
- (.strip (repr x) "()")
+ (and (in t [float HyFloat]) (isnan x))
+ "NaN"
+ (= x Inf)
+ "Inf"
+ (= x -Inf)
+ "-Inf"
+ (in t [complex HyComplex])
+ (.replace (.replace (.strip (repr x) "()") "inf" "Inf") "nan" "NaN")
(is t fraction)
(.format "{}/{}" (f x.numerator q) (f x.denominator q))
; else
diff --git a/hy/models.py b/hy/models.py
index 93cce18a..77c580fb 100644
--- a/hy/models.py
+++ b/hy/models.py
@@ -3,6 +3,7 @@
# license. See the LICENSE.
from __future__ import unicode_literals
+from math import isnan, isinf
from hy._compat import PY3, str_type, bytes_type, long_type, string_types
from fractions import Fraction
@@ -142,15 +143,24 @@ if not PY3: # do not add long on python3
_wrappers[long_type] = HyInteger
+def check_inf_nan_cap(arg, value):
+ if isinstance(arg, string_types):
+ if isinf(value) and "Inf" not in arg:
+ raise ValueError('Inf must be capitalized as "Inf"')
+ if isnan(value) and "NaN" not in arg:
+ raise ValueError('NaN must be capitalized as "NaN"')
+
+
class HyFloat(HyObject, float):
"""
Internal representation of a Hy Float. May raise a ValueError as if
float(foo) was called, given HyFloat(foo).
"""
- def __new__(cls, number, *args, **kwargs):
- number = float(strip_digit_separators(number))
- return super(HyFloat, cls).__new__(cls, number)
+ def __new__(cls, num, *args, **kwargs):
+ value = super(HyFloat, cls).__new__(cls, strip_digit_separators(num))
+ check_inf_nan_cap(num, value)
+ return value
_wrappers[float] = HyFloat
@@ -161,9 +171,18 @@ class HyComplex(HyObject, complex):
complex(foo) was called, given HyComplex(foo).
"""
- def __new__(cls, number, *args, **kwargs):
- number = complex(strip_digit_separators(number))
- return super(HyComplex, cls).__new__(cls, number)
+ def __new__(cls, num, *args, **kwargs):
+ value = super(HyComplex, cls).__new__(cls, strip_digit_separators(num))
+ if isinstance(num, string_types):
+ p1, _, p2 = num.lstrip("+-").replace("-", "+").partition("+")
+ if p2:
+ check_inf_nan_cap(p1, value.real)
+ check_inf_nan_cap(p2, value.imag)
+ elif "j" in p1:
+ check_inf_nan_cap(p1, value.imag)
+ else:
+ check_inf_nan_cap(p1, value.real)
+ return value
_wrappers[complex] = HyComplex
|
Any capitalization of "nan" or "inf" is interpreted as a float, not a symbol
For example:
=> (setv Nan 5)
File "<input>", line 1, column 7
(setv Nan 5)
^--^
HyTypeError: b"Can't assign or delete a HyFloat"
The fact that Hy accepts literals for floating-point infinity and NaN, albeit unintentional, is a nice feature that we might as well keep. But, Hy ought to recognize only one capitalization.
|
hylang/hy
|
diff --git a/tests/native_tests/contrib/hy_repr.hy b/tests/native_tests/contrib/hy_repr.hy
index 0a678b41..9bbdd095 100644
--- a/tests/native_tests/contrib/hy_repr.hy
+++ b/tests/native_tests/contrib/hy_repr.hy
@@ -3,16 +3,17 @@
;; license. See the LICENSE.
(import
+ [math [isnan]]
[hy.contrib.hy-repr [hy-repr]])
(defn test-hy-repr-roundtrip-from-value []
; Test that a variety of values round-trip properly.
(setv values [
None False True
- 5 5.1 '5 '5.1
+ 5 5.1 '5 '5.1 Inf -Inf
(int 5)
1/2
- 5j 5.1j 2+1j 1.2+3.4j
+ 5j 5.1j 2+1j 1.2+3.4j Inf-Infj
"" b""
'"" 'b""
"apple bloom" b"apple bloom" "⚘"
@@ -32,10 +33,17 @@
(for [original-val values]
(setv evaled (eval (read-str (hy-repr original-val))))
(assert (= evaled original-val))
- (assert (is (type evaled) (type original-val)))))
+ (assert (is (type evaled) (type original-val))))
+ (assert (isnan (eval (read-str (hy-repr NaN))))))
(defn test-hy-repr-roundtrip-from-str []
(setv strs [
+ "'Inf"
+ "'-Inf"
+ "'NaN"
+ "1+2j"
+ "NaN+NaNj"
+ "'NaN+NaNj"
"[1 2 3]"
"'[1 2 3]"
"[1 'a 3]"
diff --git a/tests/test_lex.py b/tests/test_lex.py
index e5f43223..dfac923c 100644
--- a/tests/test_lex.py
+++ b/tests/test_lex.py
@@ -2,6 +2,7 @@
# This file is part of Hy, which is free software licensed under the Expat
# license. See the LICENSE.
+from math import isnan
from hy.models import (HyExpression, HyInteger, HyFloat, HyComplex, HySymbol,
HyString, HyDict, HyList, HySet, HyCons)
from hy.lex import LexException, PrematureEndOfInput, tokenize
@@ -91,16 +92,38 @@ def test_lex_expression_float():
assert objs == [HyExpression([HySymbol("foo"), HyFloat(1.e7)])]
+def test_lex_nan_and_inf():
+
+ assert isnan(tokenize("NaN")[0])
+ assert tokenize("Nan") == [HySymbol("Nan")]
+ assert tokenize("nan") == [HySymbol("nan")]
+ assert tokenize("NAN") == [HySymbol("NAN")]
+
+ assert tokenize("Inf") == [HyFloat(float("inf"))]
+ assert tokenize("inf") == [HySymbol("inf")]
+ assert tokenize("INF") == [HySymbol("INF")]
+
+ assert tokenize("-Inf") == [HyFloat(float("-inf"))]
+ assert tokenize("-inf") == [HySymbol("_inf")]
+ assert tokenize("-INF") == [HySymbol("_INF")]
+
+
def test_lex_expression_complex():
""" Make sure expressions can produce complex """
- objs = tokenize("(foo 2.j)")
- assert objs == [HyExpression([HySymbol("foo"), HyComplex(2.j)])]
- objs = tokenize("(foo -0.5j)")
- assert objs == [HyExpression([HySymbol("foo"), HyComplex(-0.5j)])]
- objs = tokenize("(foo 1.e7j)")
- assert objs == [HyExpression([HySymbol("foo"), HyComplex(1.e7j)])]
- objs = tokenize("(foo j)")
- assert objs == [HyExpression([HySymbol("foo"), HySymbol("j")])]
+
+ def t(x): return tokenize("(foo {})".format(x))
+
+ def f(x): return [HyExpression([HySymbol("foo"), x])]
+
+ assert t("2.j") == f(HyComplex(2.j))
+ assert t("-0.5j") == f(HyComplex(-0.5j))
+ assert t("1.e7j") == f(HyComplex(1e7j))
+ assert t("j") == f(HySymbol("j"))
+ assert isnan(t("NaNj")[0][1].imag)
+ assert t("nanj") == f(HySymbol("nanj"))
+ assert t("Inf+Infj") == f(HyComplex(complex(float("inf"), float("inf"))))
+ assert t("Inf-Infj") == f(HyComplex(complex(float("inf"), float("-inf"))))
+ assert t("Inf-INFj") == f(HySymbol("Inf_INFj"))
def test_lex_digit_separators():
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 4
}
|
0.13
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"tox",
"Pygments>=1.6",
"Sphinx",
"sphinx_rtd_theme"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
appdirs==1.4.4
args==0.1.0
astor==0.8.1
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
clint==0.5.1
distlib==0.3.9
docutils==0.18.1
filelock==3.4.1
-e git+https://github.com/hylang/hy.git@7c53a07b93084a0970cdf192d4aa2d712d557154#egg=hy
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
Jinja2==3.0.3
MarkupSafe==2.0.1
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
platformdirs==2.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
Pygments==2.14.0
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytz==2025.2
requests==2.27.1
rply==0.7.8
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tox==3.28.0
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
virtualenv==20.17.1
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: hy
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- appdirs==1.4.4
- args==0.1.0
- astor==0.8.1
- babel==2.11.0
- charset-normalizer==2.0.12
- clint==0.5.1
- distlib==0.3.9
- docutils==0.18.1
- filelock==3.4.1
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- jinja2==3.0.3
- markupsafe==2.0.1
- platformdirs==2.4.0
- pygments==2.14.0
- pytz==2025.2
- requests==2.27.1
- rply==0.7.8
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==5.3.0
- sphinx-rtd-theme==2.0.0
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- tox==3.28.0
- urllib3==1.26.20
- virtualenv==20.17.1
prefix: /opt/conda/envs/hy
|
[
"tests/native_tests/contrib/hy_repr.hy::test_hy_repr_roundtrip_from_str",
"tests/test_lex.py::test_lex_nan_and_inf",
"tests/test_lex.py::test_lex_expression_complex"
] |
[] |
[
"tests/native_tests/contrib/hy_repr.hy::test_hy_repr_roundtrip_from_value",
"tests/native_tests/contrib/hy_repr.hy::test_hy_model_constructors",
"tests/native_tests/contrib/hy_repr.hy::test_hy_repr_self_reference",
"tests/native_tests/contrib/hy_repr.hy::test_hy_repr_dunder_method",
"tests/native_tests/contrib/hy_repr.hy::test_hy_repr_fallback",
"tests/test_lex.py::test_lex_exception",
"tests/test_lex.py::test_unbalanced_exception",
"tests/test_lex.py::test_lex_single_quote_err",
"tests/test_lex.py::test_lex_expression_symbols",
"tests/test_lex.py::test_lex_expression_strings",
"tests/test_lex.py::test_lex_expression_integer",
"tests/test_lex.py::test_lex_symbols",
"tests/test_lex.py::test_lex_strings",
"tests/test_lex.py::test_lex_integers",
"tests/test_lex.py::test_lex_fractions",
"tests/test_lex.py::test_lex_expression_float",
"tests/test_lex.py::test_lex_digit_separators",
"tests/test_lex.py::test_lex_bad_attrs",
"tests/test_lex.py::test_lex_line_counting",
"tests/test_lex.py::test_lex_line_counting_multi",
"tests/test_lex.py::test_lex_line_counting_multi_inner",
"tests/test_lex.py::test_dicts",
"tests/test_lex.py::test_sets",
"tests/test_lex.py::test_nospace",
"tests/test_lex.py::test_escapes",
"tests/test_lex.py::test_unicode_escapes",
"tests/test_lex.py::test_hashbang",
"tests/test_lex.py::test_complex",
"tests/test_lex.py::test_tag_macro",
"tests/test_lex.py::test_lex_comment_382",
"tests/test_lex.py::test_lex_mangling_star",
"tests/test_lex.py::test_lex_mangling_hyphen",
"tests/test_lex.py::test_lex_mangling_qmark",
"tests/test_lex.py::test_lex_mangling_bang",
"tests/test_lex.py::test_unmangle",
"tests/test_lex.py::test_simple_cons",
"tests/test_lex.py::test_dotted_list",
"tests/test_lex.py::test_cons_list"
] |
[] |
MIT License
| 1,258 |
zopefoundation__zope.security-24
|
2b82f83048802017a451d2abcdc2a2bae8ece182
|
2017-05-17 12:13:22
|
c192803b8e92255aea5c45349fdbd478b173224f
|
diff --git a/CHANGES.rst b/CHANGES.rst
index 0203e6a..aea7438 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,7 +4,12 @@ Changes
4.1.1 (unreleased)
------------------
-- TBD
+- Fix `issue 23 <https://github.com/zopefoundation/zope.security/issues/23>`_:
+ iteration of ``collections.OrderedDict`` and its various views is
+ now allowed by default on all versions of Python.
+
+- As a further fix for issue 20, iteration of BTree itself is now
+ allowed by default.
4.1.0 (2017-04-24)
------------------
diff --git a/src/zope/security/checker.py b/src/zope/security/checker.py
index 3187afc..344428c 100644
--- a/src/zope/security/checker.py
+++ b/src/zope/security/checker.py
@@ -770,6 +770,27 @@ if PYTHON2:
_default_checkers[type({}.iterkeys())] = _iteratorChecker
_default_checkers[type({}.itervalues())] = _iteratorChecker
+def _fixup_dictlike(dict_type):
+ empty_dict = dict_type()
+ populated_dict = dict_type({1: 2})
+ for dictlike in (empty_dict, populated_dict):
+ for attr in ('__iter__', 'keys', 'items', 'values'):
+ obj = getattr(dictlike, attr)()
+ o_type = type(obj)
+ if o_type not in _default_checkers:
+ _default_checkers[o_type] = _iteratorChecker
+
+def _fixup_odict():
+ # OrderedDicts have three different implementations: Python 2 (pure
+ # python, returns generators and lists), Python <=3.4 (pure Python,
+ # uses view classes) and CPython 3.5+ (implemented in C). These should
+ # all be iterable.
+ from collections import OrderedDict
+ _fixup_dictlike(OrderedDict)
+
+_fixup_odict()
+del _fixup_odict
+
try:
import BTrees
except ImportError: # pragma: no cover
@@ -794,20 +815,14 @@ else:
for name in ('IF', 'II', 'IO', 'OI', 'OO'):
for family_name in ('family32', 'family64'):
family = getattr(BTrees, family_name)
- btree = getattr(family, name).BTree()
-
- empty_type = type(btree.items())
- if empty_type not in _default_checkers:
- _default_checkers[empty_type] = _iteratorChecker
-
- btree[1] = 1
- populated_type = type(btree.items())
- if populated_type not in _default_checkers:
- _default_checkers[populated_type] = _iteratorChecker
+ btree = getattr(family, name).BTree
+ _fixup_dictlike(btree)
_fixup_btrees()
del _fixup_btrees
+del _fixup_dictlike
+
def _clear():
_checkers.clear()
_checkers.update(_default_checkers)
|
Iteration of OrderedDict broken under Python 3
Python 3.5 re-implemented OrderedDict in C, which results in it having custom classes for `.keys()`, `.values()`, `.items()` and `__iter__`. Likewise, Python 3 reimplemented OrderedDict to use Python "view classes" for its `__iter__`, etc. These aren't covered by the default checkers anymore. The result is code that worked prior to 3.5 suddenly raising exceptions. (Under Python 2, `__iter__` was a generator, and `keys`, `values` and `items` returned actual `list` objects.)
I think this should be handled like `dict` and `BTrees` and access granted in `_default_checkers`.
This was spotted in https://github.com/zopefoundation/zope.app.onlinehelp/pull/2
```
File "//lib/python3.5/site-packages/zope/app/tree/node.py", line 95, in getChildObjects
children = self._get_child_objects_adapter().getChildObjects()
File "/lib/python3.5/site-packages/zope/app/tree/adapters.py", line 94, in getChildObjects
return list(self.context.values()) if self.hasChildren() else []
zope.security.interfaces.ForbiddenAttribute: ('__iter__', odict_values([<zope.app.onlinehelp.onlinehelptopic.RESTOnlineHelpTopic object at 0x10f87aac8>, <zope.app.onlinehelp.onlinehelptopic.RESTOnlineHelpTopic object at 0x10f87a128>]))
```
|
zopefoundation/zope.security
|
diff --git a/src/zope/security/tests/test_checker.py b/src/zope/security/tests/test_checker.py
index ceda502..03a8883 100644
--- a/src/zope/security/tests/test_checker.py
+++ b/src/zope/security/tests/test_checker.py
@@ -391,34 +391,48 @@ class CheckerTestsBase(object):
finally:
_clear()
- @_skip_if_no_btrees
- def test_iteration_of_btree_items(self):
- # iteration of BTree.items() is allowed by default.
+ def _check_iteration_of_dict_like(self, dict_like):
from zope.security.proxy import Proxy
from zope.security.checker import Checker
- from zope.security.checker import CheckerPublic
- import BTrees
+ from zope.security.checker import _default_checkers
+
+ checker = _default_checkers[dict]
+
+ proxy = Proxy(dict_like, checker)
+ # empty
+ self.assertEqual([], list(proxy.items()))
+ self.assertEqual([], list(proxy.keys()))
+ self.assertEqual([], list(proxy.values()))
+ self.assertEqual([], list(proxy))
- checker = Checker({'items': CheckerPublic,
- 'keys': CheckerPublic,
- 'values': CheckerPublic})
+ # With an object
+ dict_like[1] = 2
+ self.assertEqual([(1, 2)], list(proxy.items()))
+ self.assertEqual([1], list(proxy.keys()))
+ self.assertEqual([1], list(proxy))
+ self.assertEqual([2], list(proxy.values()))
+
+ @_skip_if_no_btrees
+ def test_iteration_of_btree_items_keys_values(self):
+ # iteration of BTree.items() is allowed by default.
+ import BTrees
for name in ('IF', 'II', 'IO', 'OI', 'OO'):
for family_name in ('family32', 'family64'):
family = getattr(BTrees, family_name)
btree = getattr(family, name).BTree()
- proxy = Proxy(btree, checker)
- # empty
- self.assertEqual([], list(proxy.items()))
- self.assertEqual([], list(proxy.keys()))
- self.assertEqual([], list(proxy.values()))
-
- # With an object
- btree[1] = 2
- self.assertEqual([(1, 2)], list(proxy.items()))
- self.assertEqual([1], list(proxy.keys()))
- self.assertEqual([2], list(proxy.values()))
+ self._check_iteration_of_dict_like(btree)
+
+ def test_iteration_of_odict_items_keys_values(self):
+ # iteration of OrderedDict.items() is allowed by default.
+ from collections import OrderedDict
+
+ odict = OrderedDict()
+ self._check_iteration_of_dict_like(odict)
+ def test_iteration_of_dict_items_keys_values(self):
+ # iteration of regular dict is allowed by default
+ self._check_iteration_of_dict_like(dict())
class CheckerPyTests(unittest.TestCase, CheckerTestsBase):
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 2
}
|
4.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[test]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
BTrees==4.11.3
certifi==2021.5.30
cffi==1.15.1
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
persistent==4.9.3
pluggy==1.0.0
py==1.11.0
pycparser==2.21
pyparsing==3.1.4
pytest==7.0.1
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
zope.component==5.1.0
zope.configuration==4.4.1
zope.event==4.6
zope.exceptions==4.6
zope.hookable==5.4
zope.i18nmessageid==5.1.1
zope.interface==5.5.2
zope.location==4.3
zope.proxy==4.6.1
zope.schema==6.2.1
-e git+https://github.com/zopefoundation/zope.security.git@2b82f83048802017a451d2abcdc2a2bae8ece182#egg=zope.security
zope.testing==5.0.1
zope.testrunner==5.6
|
name: zope.security
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- btrees==4.11.3
- cffi==1.15.1
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- packaging==21.3
- persistent==4.9.3
- pluggy==1.0.0
- py==1.11.0
- pycparser==2.21
- pyparsing==3.1.4
- pytest==7.0.1
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
- zope-component==5.1.0
- zope-configuration==4.4.1
- zope-event==4.6
- zope-exceptions==4.6
- zope-hookable==5.4
- zope-i18nmessageid==5.1.1
- zope-interface==5.5.2
- zope-location==4.3
- zope-proxy==4.6.1
- zope-schema==6.2.1
- zope-testing==5.0.1
- zope-testrunner==5.6
prefix: /opt/conda/envs/zope.security
|
[
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_iteration_of_btree_items_keys_values",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_iteration_of_odict_items_keys_values",
"src/zope/security/tests/test_checker.py::CheckerTests::test_iteration_of_btree_items_keys_values",
"src/zope/security/tests/test_checker.py::CheckerTests::test_iteration_of_odict_items_keys_values"
] |
[] |
[
"src/zope/security/tests/test_checker.py::Test_ProxyFactory::test_no_checker_no_dunder_no_select",
"src/zope/security/tests/test_checker.py::Test_ProxyFactory::test_no_checker_no_dunder_w_select",
"src/zope/security/tests/test_checker.py::Test_ProxyFactory::test_no_checker_w_dunder",
"src/zope/security/tests/test_checker.py::Test_ProxyFactory::test_w_already_proxied_different_checker",
"src/zope/security/tests/test_checker.py::Test_ProxyFactory::test_w_already_proxied_no_checker",
"src/zope/security/tests/test_checker.py::Test_ProxyFactory::test_w_already_proxied_same_checker",
"src/zope/security/tests/test_checker.py::Test_ProxyFactory::test_w_explicit_checker",
"src/zope/security/tests/test_checker.py::Test_canWrite::test_ok",
"src/zope/security/tests/test_checker.py::Test_canWrite::test_w_setattr_forbidden_getattr_allowed",
"src/zope/security/tests/test_checker.py::Test_canWrite::test_w_setattr_forbidden_getattr_forbidden",
"src/zope/security/tests/test_checker.py::Test_canWrite::test_w_setattr_forbidden_getattr_unauth",
"src/zope/security/tests/test_checker.py::Test_canWrite::test_w_setattr_unauth",
"src/zope/security/tests/test_checker.py::Test_canAccess::test_ok",
"src/zope/security/tests/test_checker.py::Test_canAccess::test_w_getattr_unauth",
"src/zope/security/tests/test_checker.py::Test_canAccess::test_w_setattr_forbidden_getattr_allowed",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_available_by_default",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_miss",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_non_public_w_interaction_allows",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_non_public_w_interaction_denies",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_public",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_setattr_miss",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_setattr_miss_none_set",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_setattr_public",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_setattr_w_interaction_allows",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_check_setattr_w_interaction_denies",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_class_conforms_to_IChecker",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_ctor_w_non_dict_get_permissions",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_ctor_w_non_dict_set_permissions",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_instance_conforms_to_IChecker",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_iteration_of_dict_items_keys_values",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_permission_id_hit",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_permission_id_miss",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_proxy_already_proxied",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_proxy_no_checker_no_dunder_w_select",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_proxy_no_checker_w_dunder",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_proxy_no_dunder_no_select",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_setattr_permission_id_hit",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_setattr_permission_id_miss",
"src/zope/security/tests/test_checker.py::CheckerPyTests::test_setattr_permission_id_miss_none_set",
"src/zope/security/tests/test_checker.py::CheckerTests::test_check_available_by_default",
"src/zope/security/tests/test_checker.py::CheckerTests::test_check_miss",
"src/zope/security/tests/test_checker.py::CheckerTests::test_check_non_public_w_interaction_allows",
"src/zope/security/tests/test_checker.py::CheckerTests::test_check_non_public_w_interaction_denies",
"src/zope/security/tests/test_checker.py::CheckerTests::test_check_public",
"src/zope/security/tests/test_checker.py::CheckerTests::test_check_setattr_miss",
"src/zope/security/tests/test_checker.py::CheckerTests::test_check_setattr_miss_none_set",
"src/zope/security/tests/test_checker.py::CheckerTests::test_check_setattr_public",
"src/zope/security/tests/test_checker.py::CheckerTests::test_check_setattr_w_interaction_allows",
"src/zope/security/tests/test_checker.py::CheckerTests::test_check_setattr_w_interaction_denies",
"src/zope/security/tests/test_checker.py::CheckerTests::test_class_conforms_to_IChecker",
"src/zope/security/tests/test_checker.py::CheckerTests::test_ctor_w_non_dict_get_permissions",
"src/zope/security/tests/test_checker.py::CheckerTests::test_ctor_w_non_dict_set_permissions",
"src/zope/security/tests/test_checker.py::CheckerTests::test_instance_conforms_to_IChecker",
"src/zope/security/tests/test_checker.py::CheckerTests::test_iteration_of_dict_items_keys_values",
"src/zope/security/tests/test_checker.py::CheckerTests::test_permission_id_hit",
"src/zope/security/tests/test_checker.py::CheckerTests::test_permission_id_miss",
"src/zope/security/tests/test_checker.py::CheckerTests::test_proxy_already_proxied",
"src/zope/security/tests/test_checker.py::CheckerTests::test_proxy_no_checker_no_dunder_w_select",
"src/zope/security/tests/test_checker.py::CheckerTests::test_proxy_no_checker_w_dunder",
"src/zope/security/tests/test_checker.py::CheckerTests::test_proxy_no_dunder_no_select",
"src/zope/security/tests/test_checker.py::CheckerTests::test_setattr_permission_id_hit",
"src/zope/security/tests/test_checker.py::CheckerTests::test_setattr_permission_id_miss",
"src/zope/security/tests/test_checker.py::CheckerTests::test_setattr_permission_id_miss_none_set",
"src/zope/security/tests/test_checker.py::TracebackSupplementTests::test_getInfo_builtin_types",
"src/zope/security/tests/test_checker.py::TracebackSupplementTests::test_getInfo_newstyle_instance",
"src/zope/security/tests/test_checker.py::GlobalTests::test___reduce__",
"src/zope/security/tests/test_checker.py::GlobalTests::test___repr__",
"src/zope/security/tests/test_checker.py::GlobalTests::test_ctor_name_and_module",
"src/zope/security/tests/test_checker.py::Test_NamesChecker::test_empty_names_no_kw",
"src/zope/security/tests/test_checker.py::Test_NamesChecker::test_w_names_no_kw",
"src/zope/security/tests/test_checker.py::Test_NamesChecker::test_w_names_no_kw_explicit_permission",
"src/zope/security/tests/test_checker.py::Test_NamesChecker::test_w_names_w_kw_no_clash",
"src/zope/security/tests/test_checker.py::Test_NamesChecker::test_w_names_w_kw_w_clash",
"src/zope/security/tests/test_checker.py::Test_InterfaceChecker::test_derived_iface",
"src/zope/security/tests/test_checker.py::Test_InterfaceChecker::test_simple_iface_w_explicit_permission",
"src/zope/security/tests/test_checker.py::Test_InterfaceChecker::test_simple_iface_w_kw",
"src/zope/security/tests/test_checker.py::Test_InterfaceChecker::test_simple_iface_wo_kw",
"src/zope/security/tests/test_checker.py::Test_InterfaceChecker::test_w_clash",
"src/zope/security/tests/test_checker.py::Test_MultiChecker::test_empty",
"src/zope/security/tests/test_checker.py::Test_MultiChecker::test_w_spec_as_iface",
"src/zope/security/tests/test_checker.py::Test_MultiChecker::test_w_spec_as_mapping",
"src/zope/security/tests/test_checker.py::Test_MultiChecker::test_w_spec_as_names",
"src/zope/security/tests/test_checker.py::Test_MultiChecker::test_w_spec_as_names_and_iface",
"src/zope/security/tests/test_checker.py::Test_MultiChecker::test_w_spec_as_names_and_iface_clash",
"src/zope/security/tests/test_checker.py::Test_MultiChecker::test_w_spec_as_names_and_mapping_clash",
"src/zope/security/tests/test_checker.py::Test_selectCheckerPy::test_w_basic_types_NoProxy",
"src/zope/security/tests/test_checker.py::Test_selectCheckerPy::test_w_checker_inst",
"src/zope/security/tests/test_checker.py::Test_selectCheckerPy::test_w_factory_factory",
"src/zope/security/tests/test_checker.py::Test_selectCheckerPy::test_w_factory_returning_NoProxy",
"src/zope/security/tests/test_checker.py::Test_selectCheckerPy::test_w_factory_returning_None",
"src/zope/security/tests/test_checker.py::Test_selectCheckerPy::test_w_factory_returning_checker",
"src/zope/security/tests/test_checker.py::Test_selectChecker::test_w_basic_types_NoProxy",
"src/zope/security/tests/test_checker.py::Test_selectChecker::test_w_checker_inst",
"src/zope/security/tests/test_checker.py::Test_selectChecker::test_w_factory_factory",
"src/zope/security/tests/test_checker.py::Test_selectChecker::test_w_factory_returning_NoProxy",
"src/zope/security/tests/test_checker.py::Test_selectChecker::test_w_factory_returning_None",
"src/zope/security/tests/test_checker.py::Test_selectChecker::test_w_factory_returning_checker",
"src/zope/security/tests/test_checker.py::Test_getCheckerForInstancesOf::test_hit",
"src/zope/security/tests/test_checker.py::Test_getCheckerForInstancesOf::test_miss",
"src/zope/security/tests/test_checker.py::Test_defineChecker::test_w_duplicate",
"src/zope/security/tests/test_checker.py::Test_defineChecker::test_w_module",
"src/zope/security/tests/test_checker.py::Test_defineChecker::test_w_newstyle_class",
"src/zope/security/tests/test_checker.py::Test_defineChecker::test_w_wrong_type",
"src/zope/security/tests/test_checker.py::Test_undefineChecker::test_hit",
"src/zope/security/tests/test_checker.py::Test_undefineChecker::test_miss",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_lhs_forbidden_rhs_forbidden",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_lhs_forbidden_rhs_ok",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_lhs_forbidden_rhs_unauth",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_lhs_ok_rhs_not_called",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_lhs_unauth_rhs_forbidden",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_lhs_unauth_rhs_ok",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_lhs_unauth_rhs_unauth",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_setattr_lhs_forbidden_rhs_forbidden",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_setattr_lhs_forbidden_rhs_ok",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_setattr_lhs_forbidden_rhs_unauth",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_setattr_lhs_ok_rhs_not_called",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_setattr_lhs_unauth_rhs_forbidden",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_setattr_lhs_unauth_rhs_ok",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_check_setattr_lhs_unauth_rhs_unauth",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_class_conforms_to_IChecker",
"src/zope/security/tests/test_checker.py::CombinedCheckerTests::test_instance_conforms_to_IChecker",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_forbidden_attribute",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_getattr_forbidden_attribute",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_getattr_ok_normal_verbosity",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_getattr_ok_raised_verbosity_available_by_default",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_getattr_ok_raised_verbosity_normal_name",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_getattr_unauthorized",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_ok_normal_verbosity",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_ok_raised_verbosity_available_by_default",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_ok_raised_verbosity_normal_name",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_setattr_forbidden_attribute",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_setattr_ok_normal_verbosity",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_setattr_ok_raised_verbosity_normal_name",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_setattr_unauthorized",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_setitem_unauthorized",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_unauthorized",
"src/zope/security/tests/test_checker.py::CheckerLoggingMixinTests::test_check_unauthorized_raised_verbosity",
"src/zope/security/tests/test_checker.py::Test__instanceChecker::test_hit",
"src/zope/security/tests/test_checker.py::Test__instanceChecker::test_miss",
"src/zope/security/tests/test_checker.py::Test_moduleChecker::test_hit",
"src/zope/security/tests/test_checker.py::Test_moduleChecker::test_miss",
"src/zope/security/tests/test_checker.py::BasicTypesTests::test___delitem__",
"src/zope/security/tests/test_checker.py::BasicTypesTests::test___setitem__",
"src/zope/security/tests/test_checker.py::BasicTypesTests::test_clear",
"src/zope/security/tests/test_checker.py::BasicTypesTests::test_update",
"src/zope/security/tests/test_checker.py::Test::testAlwaysAvailable",
"src/zope/security/tests/test_checker.py::Test::testLayeredProxies",
"src/zope/security/tests/test_checker.py::Test::testMultiChecker",
"src/zope/security/tests/test_checker.py::Test::test_ProxyFactory",
"src/zope/security/tests/test_checker.py::Test::test_ProxyFactory_using_proxy",
"src/zope/security/tests/test_checker.py::Test::test_canWrite_canAccess",
"src/zope/security/tests/test_checker.py::Test::test_defineChecker_error",
"src/zope/security/tests/test_checker.py::Test::test_defineChecker_module",
"src/zope/security/tests/test_checker.py::Test::test_defineChecker_newstyle_class",
"src/zope/security/tests/test_checker.py::Test::test_define_and_undefineChecker",
"src/zope/security/tests/test_checker.py::Test::test_iteration",
"src/zope/security/tests/test_checker.py::TestCheckerPublic::test_that_CheckerPublic_identity_works_even_when_proxied",
"src/zope/security/tests/test_checker.py::TestCheckerPublic::test_that_pickling_CheckerPublic_retains_identity",
"src/zope/security/tests/test_checker.py::TestCombinedChecker::test_checking",
"src/zope/security/tests/test_checker.py::TestCombinedChecker::test_interface",
"src/zope/security/tests/test_checker.py::TestBasicTypes::test",
"src/zope/security/tests/test_checker.py::test_suite"
] |
[] |
Zope Public License 2.1
| 1,260 |
|
cherrypy__cherrypy-1596
|
2c5643367147bae270e83dfba25c1897f37dbe18
|
2017-05-17 12:22:19
|
2c5643367147bae270e83dfba25c1897f37dbe18
|
diff --git a/cherrypy/_helper.py b/cherrypy/_helper.py
index 5875ec0f..9b727eac 100644
--- a/cherrypy/_helper.py
+++ b/cherrypy/_helper.py
@@ -223,6 +223,30 @@ def url(path='', qs='', script_name=None, base=None, relative=None):
if qs:
qs = '?' + qs
+ def normalize_path(path):
+ if './' not in path:
+ return path
+
+ # Normalize the URL by removing ./ and ../
+ atoms = []
+ for atom in path.split('/'):
+ if atom == '.':
+ pass
+ elif atom == '..':
+ # Don't pop from empty list
+ # (i.e. ignore redundant '..')
+ if atoms:
+ atoms.pop()
+ elif atom:
+ atoms.append(atom)
+
+ newpath = '/'.join(atoms)
+ # Preserve leading '/'
+ if path.startswith('/'):
+ newpath = '/' + newpath
+
+ return newpath
+
if cherrypy.request.app:
if not path.startswith('/'):
# Append/remove trailing slash from path_info as needed
@@ -246,7 +270,7 @@ def url(path='', qs='', script_name=None, base=None, relative=None):
if base is None:
base = cherrypy.request.base
- newurl = base + script_name + path + qs
+ newurl = base + script_name + normalize_path(path) + qs
else:
# No request.app (we're being called outside a request).
# We'll have to guess the base from server.* attributes.
@@ -256,19 +280,7 @@ def url(path='', qs='', script_name=None, base=None, relative=None):
base = cherrypy.server.base()
path = (script_name or '') + path
- newurl = base + path + qs
-
- if './' in newurl:
- # Normalize the URL by removing ./ and ../
- atoms = []
- for atom in newurl.split('/'):
- if atom == '.':
- pass
- elif atom == '..':
- atoms.pop()
- else:
- atoms.append(atom)
- newurl = '/'.join(atoms)
+ newurl = base + normalize_path(path) + qs
# At this point, we should have a fully-qualified absolute URL.
|
`cherrypy.url` fails to normalize path
This call to `cherrypy.url` fails with `IndexError`:
```
>>> cherrypy.url(qs='../../../../../../etc/passwd')
...
IndexError: pop from empty list
```
The culprit seems in this logic, which strips `newurl` of as many `atoms` as there are `..`:
https://github.com/cherrypy/cherrypy/blob/master/cherrypy/_helper.py#L261,L271
There are various problems.
- That logic should only applied to the "path" part of `newurl`, not to the full url.
- As a consequence of the point above, `..` in the query string `qs` should not be considered
- To consider: redundant `..` should be ignored, to mimic `os.path.normpath`:
```
>>> os.path.normpath('/etc/../../../usr')
'/usr'
```
|
cherrypy/cherrypy
|
diff --git a/cherrypy/test/test_core.py b/cherrypy/test/test_core.py
index f16efd58..252c1ac5 100644
--- a/cherrypy/test/test_core.py
+++ b/cherrypy/test/test_core.py
@@ -74,6 +74,9 @@ class CoreRequestHandlingTest(helper.CPWebCase):
relative = bool(relative)
return cherrypy.url(path_info, relative=relative)
+ def qs(self, qs):
+ return cherrypy.url(qs=qs)
+
def log_status():
Status.statuses.append(cherrypy.response.status)
cherrypy.tools.log_status = cherrypy.Tool(
@@ -647,6 +650,8 @@ class CoreRequestHandlingTest(helper.CPWebCase):
self.assertBody('%s/url/other/page1' % self.base())
self.getPage('/url/?path_info=/other/./page1')
self.assertBody('%s/other/page1' % self.base())
+ self.getPage('/url/?path_info=/other/././././page1')
+ self.assertBody('%s/other/page1' % self.base())
# Double dots
self.getPage('/url/leaf?path_info=../page1')
@@ -655,6 +660,20 @@ class CoreRequestHandlingTest(helper.CPWebCase):
self.assertBody('%s/url/page1' % self.base())
self.getPage('/url/leaf?path_info=/other/../page1')
self.assertBody('%s/page1' % self.base())
+ self.getPage('/url/leaf?path_info=/other/../../../page1')
+ self.assertBody('%s/page1' % self.base())
+ self.getPage('/url/leaf?path_info=/other/../../../../../page1')
+ self.assertBody('%s/page1' % self.base())
+
+ # qs param is not normalized as a path
+ self.getPage('/url/qs?qs=/other')
+ self.assertBody('%s/url/qs?/other' % self.base())
+ self.getPage('/url/qs?qs=/other/../page1')
+ self.assertBody('%s/url/qs?/other/../page1' % self.base())
+ self.getPage('/url/qs?qs=../page1')
+ self.assertBody('%s/url/qs?../page1' % self.base())
+ self.getPage('/url/qs?qs=../../page1')
+ self.assertBody('%s/url/qs?../../page1' % self.base())
# Output relative to current path or script_name
self.getPage('/url/?path_info=page1&relative=True')
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
10.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc libssl-dev"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
cheroot==10.0.1
-e git+https://github.com/cherrypy/cherrypy.git@2c5643367147bae270e83dfba25c1897f37dbe18#egg=CherryPy
exceptiongroup==1.2.2
iniconfig==2.1.0
jaraco.functools==4.1.0
more-itertools==10.6.0
packaging==24.2
pluggy==1.5.0
portend==3.2.0
pytest==8.3.5
python-dateutil==2.9.0.post0
six==1.17.0
tempora==5.8.0
tomli==2.2.1
|
name: cherrypy
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- cheroot==10.0.1
- exceptiongroup==1.2.2
- iniconfig==2.1.0
- jaraco-functools==4.1.0
- more-itertools==10.6.0
- packaging==24.2
- pluggy==1.5.0
- portend==3.2.0
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- six==1.17.0
- tempora==5.8.0
- tomli==2.2.1
prefix: /opt/conda/envs/cherrypy
|
[
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_cherrypy_url"
] |
[] |
[
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testCookies",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testDefaultContentType",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testFavicon",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testFlatten",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testRanges",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testRedirect",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testSlashes",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::testStatus",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_InternalRedirect",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_expose_decorator",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_multiple_headers",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_on_end_resource_status",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_redirect_with_unicode",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_redirect_with_xss",
"cherrypy/test/test_core.py::CoreRequestHandlingTest::test_gc",
"cherrypy/test/test_core.py::ErrorTests::test_contextmanager",
"cherrypy/test/test_core.py::ErrorTests::test_start_response_error",
"cherrypy/test/test_core.py::ErrorTests::test_gc",
"cherrypy/test/test_core.py::TestBinding::test_bind_ephemeral_port"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 1,261 |
|
borgbackup__borg-2527
|
eaf90cb73dfbe2e7996ae444d5c6bffd0ea89f7a
|
2017-05-17 17:34:07
|
a439fa3e720c8bb2a82496768ffcce282fb7f7b7
|
codecov-io: # [Codecov](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=h1) Report
> Merging [#2527](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=desc) into [master](https://codecov.io/gh/borgbackup/borg/commit/eaf90cb73dfbe2e7996ae444d5c6bffd0ea89f7a?src=pr&el=desc) will **decrease** coverage by `0.06%`.
> The diff coverage is `68.18%`.
[](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #2527 +/- ##
==========================================
- Coverage 83.53% 83.46% -0.07%
==========================================
Files 22 22
Lines 7938 7966 +28
Branches 1349 1360 +11
==========================================
+ Hits 6631 6649 +18
- Misses 936 942 +6
- Partials 371 375 +4
```
| [Impacted Files](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/borg/helpers.py](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=tree#diff-c3JjL2JvcmcvaGVscGVycy5weQ==) | `87.52% <ø> (+0.17%)` | :arrow_up: |
| [src/borg/logger.py](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=tree#diff-c3JjL2JvcmcvbG9nZ2VyLnB5) | `70.68% <100%> (+0.77%)` | :arrow_up: |
| [src/borg/archiver.py](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=tree#diff-c3JjL2JvcmcvYXJjaGl2ZXIucHk=) | `82.9% <100%> (+0.02%)` | :arrow_up: |
| [src/borg/remote.py](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=tree#diff-c3JjL2JvcmcvcmVtb3RlLnB5) | `76.36% <60%> (-1.39%)` | :arrow_down: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=footer). Last update [eaf90cb...6cedd7f](https://codecov.io/gh/borgbackup/borg/pull/2527?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
enkore: Thanks, I clarified these in f0b84042.
|
diff --git a/src/borg/archiver.py b/src/borg/archiver.py
index 0ddfe1fe..9946dd47 100644
--- a/src/borg/archiver.py
+++ b/src/borg/archiver.py
@@ -3815,15 +3815,15 @@ def _setup_implied_logging(self, args):
""" turn on INFO level logging for args that imply that they will produce output """
# map of option name to name of logger for that option
option_logger = {
- 'output_list': 'borg.output.list',
- 'show_version': 'borg.output.show-version',
- 'show_rc': 'borg.output.show-rc',
- 'stats': 'borg.output.stats',
- 'progress': 'borg.output.progress',
- }
+ 'output_list': 'borg.output.list',
+ 'show_version': 'borg.output.show-version',
+ 'show_rc': 'borg.output.show-rc',
+ 'stats': 'borg.output.stats',
+ 'progress': 'borg.output.progress',
+ }
for option, logger_name in option_logger.items():
- if args.get(option, False):
- logging.getLogger(logger_name).setLevel('INFO')
+ option_set = args.get(option, False)
+ logging.getLogger(logger_name).setLevel('INFO' if option_set else 'WARN')
def _setup_topic_debugging(self, args):
"""Turn on DEBUG level logging for specified --debug-topics."""
@@ -3839,8 +3839,10 @@ def run(self, args):
# This works around http://bugs.python.org/issue9351
func = getattr(args, 'func', None) or getattr(args, 'fallback_func')
# do not use loggers before this!
- setup_logging(level=args.log_level, is_serve=func == self.do_serve, json=args.log_json)
+ is_serve = func == self.do_serve
+ setup_logging(level=args.log_level, is_serve=is_serve, json=args.log_json)
self.log_json = args.log_json
+ args.progress |= is_serve
self._setup_implied_logging(vars(args))
self._setup_topic_debugging(args)
if args.show_version:
diff --git a/src/borg/helpers.py b/src/borg/helpers.py
index ec06946e..a93ba710 100644
--- a/src/borg/helpers.py
+++ b/src/borg/helpers.py
@@ -1226,6 +1226,14 @@ def __init__(self, msgid=None):
if self.logger.level == logging.NOTSET:
self.logger.setLevel(logging.WARN)
self.logger.propagate = False
+
+ # If --progress is not set then the progress logger level will be WARN
+ # due to setup_implied_logging (it may be NOTSET with a logging config file,
+ # but the interactions there are generally unclear), so self.emit becomes
+ # False, which is correct.
+ # If --progress is set then the level will be INFO as per setup_implied_logging;
+ # note that this is always the case for serve processes due to a "args.progress |= is_serve".
+ # In this case self.emit is True.
self.emit = self.logger.getEffectiveLevel() == logging.INFO
def __del__(self):
diff --git a/src/borg/logger.py b/src/borg/logger.py
index 6300776d..69cb86f1 100644
--- a/src/borg/logger.py
+++ b/src/borg/logger.py
@@ -88,15 +88,21 @@ def setup_logging(stream=None, conf_fname=None, env_var='BORG_LOGGING_CONF', lev
# if we did not / not successfully load a logging configuration, fallback to this:
logger = logging.getLogger('')
handler = logging.StreamHandler(stream)
- if is_serve:
+ if is_serve and not json:
fmt = '$LOG %(levelname)s %(name)s Remote: %(message)s'
else:
fmt = '%(message)s'
- formatter = JsonFormatter(fmt) if json and not is_serve else logging.Formatter(fmt)
+ formatter = JsonFormatter(fmt) if json else logging.Formatter(fmt)
handler.setFormatter(formatter)
borg_logger = logging.getLogger('borg')
borg_logger.formatter = formatter
borg_logger.json = json
+ if configured and logger.handlers:
+ # The RepositoryServer can call setup_logging a second time to adjust the output
+ # mode from text-ish is_serve to json is_serve.
+ # Thus, remove the previously installed handler, if any.
+ logger.handlers[0].close()
+ logger.handlers.clear()
logger.addHandler(handler)
logger.setLevel(level.upper())
configured = True
@@ -224,6 +230,8 @@ def format(self, record):
data = {
'type': 'log_message',
'time': record.created,
+ 'message': '',
+ 'levelname': 'CRITICAL',
}
for attr in self.RECORD_ATTRIBUTES:
value = getattr(record, attr, None)
diff --git a/src/borg/remote.py b/src/borg/remote.py
index c32ba9e6..1a67930e 100644
--- a/src/borg/remote.py
+++ b/src/borg/remote.py
@@ -2,29 +2,30 @@
import fcntl
import functools
import inspect
+import json
import logging
import os
import select
import shlex
import sys
import tempfile
-import traceback
import textwrap
import time
+import traceback
from subprocess import Popen, PIPE
import msgpack
from . import __version__
from .helpers import Error, IntegrityError
-from .helpers import get_home_dir
-from .helpers import sysinfo
from .helpers import bin_to_hex
-from .helpers import replace_placeholders
+from .helpers import get_home_dir
from .helpers import hostname_is_unique
+from .helpers import replace_placeholders
+from .helpers import sysinfo
+from .logger import create_logger, setup_logging
from .repository import Repository, MAX_OBJECT_SIZE, LIST_SCAN_LIMIT
from .version import parse_version, format_version
-from .logger import create_logger
logger = create_logger(__name__)
@@ -312,6 +313,10 @@ def negotiate(self, client_data):
# clients since 1.1.0b3 use a dict as client_data
if isinstance(client_data, dict):
self.client_version = client_data[b'client_version']
+ if client_data.get(b'client_supports_log_v3', False):
+ level = logging.getLevelName(logging.getLogger('').level)
+ setup_logging(is_serve=True, json=True, level=level)
+ logger.debug('Initialized logging system for new (v3) protocol')
else:
self.client_version = BORG_VERSION # seems to be newer than current version (no known old format)
@@ -555,7 +560,10 @@ def __init__(self, location, create=False, exclusive=False, lock_wait=None, lock
try:
try:
- version = self.call('negotiate', {'client_data': {b'client_version': BORG_VERSION}})
+ version = self.call('negotiate', {'client_data': {
+ b'client_version': BORG_VERSION,
+ b'client_supports_log_v3': True,
+ }})
except ConnectionClosed:
raise ConnectionClosedWithHint('Is borg working on the server?') from None
if version == RPC_PROTOCOL_VERSION:
@@ -646,12 +654,23 @@ def borg_cmd(self, args, testing):
opts.append('--critical')
else:
raise ValueError('log level missing, fix this code')
- try:
- borg_logger = logging.getLogger('borg')
- if borg_logger.json:
- opts.append('--log-json')
- except AttributeError:
- pass
+
+ # Tell the remote server about debug topics it may need to consider.
+ # Note that debug topics are usable for "spew" or "trace" logs which would
+ # be too plentiful to transfer for normal use, so the server doesn't send
+ # them unless explicitly enabled.
+ #
+ # Needless to say, if you do --debug-topic=repository.compaction, for example,
+ # with a 1.0.x server it won't work, because the server does not recognize the
+ # option.
+ #
+ # This is not considered a problem, since this is a debugging feature that
+ # should not be used for regular use.
+ for topic in args.debug_topics:
+ if '.' not in topic:
+ topic = 'borg.debug.' + topic
+ if 'repository' in topic:
+ opts.append('--debug-topic=%s' % topic)
env_vars = []
if not hostname_is_unique():
env_vars.append('BORG_HOSTNAME_IS_UNIQUE=no')
@@ -930,7 +949,63 @@ def preload(self, ids):
def handle_remote_line(line):
- if line.startswith('$LOG '):
+ """
+ Handle a remote log line.
+
+ This function is remarkably complex because it handles multiple wire formats.
+ """
+ if line.startswith('{'):
+ # This format is used by Borg since 1.1.0b6 for new-protocol clients.
+ # It is the same format that is exposed by --log-json.
+ msg = json.loads(line)
+
+ if msg['type'] not in ('progress_message', 'progress_percent', 'log_message'):
+ logger.warning('Dropped remote log message with unknown type %r: %s', msg['type'], line)
+ return
+
+ if msg['type'] == 'log_message':
+ # Re-emit log messages on the same level as the remote to get correct log suppression and verbosity.
+ level = getattr(logging, msg['levelname'], logging.CRITICAL)
+ assert isinstance(level, int)
+ target_logger = logging.getLogger(msg['name'])
+ msg['message'] = 'Remote: ' + msg['message']
+ # In JSON mode, we manually check whether the log message should be propagated.
+ if logging.getLogger('borg').json and level >= target_logger.getEffectiveLevel():
+ sys.stderr.write(json.dumps(msg) + '\n')
+ else:
+ target_logger.log(level, '%s', msg['message'])
+ elif msg['type'].startswith('progress_'):
+ # Progress messages are a bit more complex.
+ # First of all, we check whether progress output is enabled. This is signalled
+ # through the effective level of the borg.output.progress logger
+ # (also see ProgressIndicatorBase in borg.helpers).
+ progress_logger = logging.getLogger('borg.output.progress')
+ if progress_logger.getEffectiveLevel() == logging.INFO:
+ # When progress output is enabled, we check whether the client is in
+ # --log-json mode, as signalled by the "json" attribute on the "borg" logger.
+ if logging.getLogger('borg').json:
+ # In --log-json mode we re-emit the progress JSON line as sent by the server,
+ # with the message, if any, prefixed with "Remote: ".
+ if 'message' in msg:
+ msg['message'] = 'Remote: ' + msg['message']
+ sys.stderr.write(json.dumps(msg) + '\n')
+ elif 'message' in msg:
+ # In text log mode we write only the message to stderr and terminate with \r
+ # (carriage return, i.e. move the write cursor back to the beginning of the line)
+ # so that the next message, progress or not, overwrites it. This mirrors the behaviour
+ # of local progress displays.
+ sys.stderr.write('Remote: ' + msg['message'] + '\r')
+ elif line.startswith('$LOG '):
+ # This format is used by Borg since 1.1.0b1.
+ # It prefixed log lines with $LOG as a marker, followed by the log level
+ # and optionally a logger name, then "Remote:" as a separator followed by the original
+ # message.
+ #
+ # It is the oldest format supported by these servers, so it was important to make
+ # it readable with older (1.0.x) clients.
+ #
+ # TODO: Remove this block (so it'll be handled by the "else:" below) with a Borg 1.1 RC.
+ # Also check whether client_supports_log_v3 should be removed.
_, level, msg = line.split(' ', 2)
level = getattr(logging, level, logging.CRITICAL) # str -> int
if msg.startswith('Remote:'):
@@ -941,7 +1016,15 @@ def handle_remote_line(line):
logname, msg = msg.split(' ', 1)
logging.getLogger(logname).log(level, msg.rstrip())
else:
- sys.stderr.write('Remote: ' + line)
+ # Plain 1.0.x and older format - re-emit to stderr (mirroring what the 1.0.x
+ # client did) or as a generic log message.
+ # We don't know what priority the line had.
+ if logging.getLogger('borg').json:
+ logging.getLogger('').warning('Remote: ' + line.strip())
+ else:
+ # In non-JSON mode we circumvent logging to preserve carriage returns (\r)
+ # which are generated by remote progress displays.
+ sys.stderr.write('Remote: ' + line)
class RepositoryNoCache:
|
--progress for serve/RPC doesn't work
I think this was broken with the implied logging stuff?
---
:moneybag: [there is a bounty for this](https://www.bountysource.com/issues/42549881-progress-for-serve-rpc-doesn-t-work)
|
borgbackup/borg
|
diff --git a/src/borg/testsuite/repository.py b/src/borg/testsuite/repository.py
index 2819c64c..16f47b91 100644
--- a/src/borg/testsuite/repository.py
+++ b/src/borg/testsuite/repository.py
@@ -714,6 +714,7 @@ def test_borg_cmd(self):
class MockArgs:
remote_path = 'borg'
umask = 0o077
+ debug_topics = []
assert self.repository.borg_cmd(None, testing=True) == [sys.executable, '-m', 'borg.archiver', 'serve']
args = MockArgs()
@@ -723,6 +724,9 @@ class MockArgs:
assert self.repository.borg_cmd(args, testing=False) == ['borg', 'serve', '--umask=077', '--info']
args.remote_path = 'borg-0.28.2'
assert self.repository.borg_cmd(args, testing=False) == ['borg-0.28.2', 'serve', '--umask=077', '--info']
+ args.debug_topics = ['something_client_side', 'repository_compaction']
+ assert self.repository.borg_cmd(args, testing=False) == ['borg-0.28.2', 'serve', '--umask=077', '--info',
+ '--debug-topic=borg.debug.repository_compaction']
class RemoteLegacyFree(RepositoryTestCaseBase):
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 4
}
|
1.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-xdist pytest-cov pytest-benchmark"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc libssl-dev libacl1-dev liblz4-dev libfuse-dev"
],
"python": "3.9",
"reqs_path": [
"requirements.d/development.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/borgbackup/borg.git@eaf90cb73dfbe2e7996ae444d5c6bffd0ea89f7a#egg=borgbackup
cachetools==5.5.2
chardet==5.2.0
colorama==0.4.6
coverage==7.8.0
Cython==3.0.12
distlib==0.3.9
exceptiongroup==1.2.2
execnet==2.1.1
filelock==3.18.0
iniconfig==2.1.0
msgpack-python==0.5.6
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
py-cpuinfo==9.0.0
pyproject-api==1.9.0
pytest==8.3.5
pytest-benchmark==5.1.0
pytest-cov==6.0.0
pytest-xdist==3.6.1
setuptools-scm==8.2.0
tomli==2.2.1
tox==4.25.0
typing_extensions==4.13.0
virtualenv==20.29.3
|
name: borg
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- cachetools==5.5.2
- chardet==5.2.0
- colorama==0.4.6
- coverage==7.8.0
- cython==3.0.12
- distlib==0.3.9
- exceptiongroup==1.2.2
- execnet==2.1.1
- filelock==3.18.0
- iniconfig==2.1.0
- msgpack-python==0.5.6
- packaging==24.2
- platformdirs==4.3.7
- pluggy==1.5.0
- py-cpuinfo==9.0.0
- pyproject-api==1.9.0
- pytest==8.3.5
- pytest-benchmark==5.1.0
- pytest-cov==6.0.0
- pytest-xdist==3.6.1
- setuptools-scm==8.2.0
- tomli==2.2.1
- tox==4.25.0
- typing-extensions==4.13.0
- virtualenv==20.29.3
prefix: /opt/conda/envs/borg
|
[
"src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_borg_cmd"
] |
[
"src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test1",
"src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_consistency",
"src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_invalid_rpc",
"src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_max_data_size",
"src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_rpc_exception_transport",
"src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_corrupted_commit_segment",
"src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_corrupted_segment",
"src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_missing_commit_segment",
"src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_no_commits"
] |
[
"src/borg/testsuite/repository.py::RepositoryTestCase::test1",
"src/borg/testsuite/repository.py::RepositoryTestCase::test2",
"src/borg/testsuite/repository.py::RepositoryTestCase::test_consistency",
"src/borg/testsuite/repository.py::RepositoryTestCase::test_consistency2",
"src/borg/testsuite/repository.py::RepositoryTestCase::test_list",
"src/borg/testsuite/repository.py::RepositoryTestCase::test_max_data_size",
"src/borg/testsuite/repository.py::RepositoryTestCase::test_overwrite_in_same_transaction",
"src/borg/testsuite/repository.py::RepositoryTestCase::test_scan",
"src/borg/testsuite/repository.py::RepositoryTestCase::test_single_kind_transactions",
"src/borg/testsuite/repository.py::LocalRepositoryTestCase::test_sparse1",
"src/borg/testsuite/repository.py::LocalRepositoryTestCase::test_sparse2",
"src/borg/testsuite/repository.py::LocalRepositoryTestCase::test_sparse_delete",
"src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_crash_before_compact_segments",
"src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_crash_before_deleting_compacted_segments",
"src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_crash_before_write_index",
"src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_ignores_commit_tag_in_data",
"src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_moved_deletes_are_tracked",
"src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_replay_lock_upgrade",
"src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_replay_lock_upgrade_old",
"src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_replay_of_missing_index",
"src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_shadow_index_rollback",
"src/borg/testsuite/repository.py::RepositoryCommitTestCase::test_shadowed_entries_are_preserved",
"src/borg/testsuite/repository.py::RepositoryAppendOnlyTestCase::test_append_only",
"src/borg/testsuite/repository.py::RepositoryAppendOnlyTestCase::test_destroy_append_only",
"src/borg/testsuite/repository.py::RepositoryFreeSpaceTestCase::test_additional_free_space",
"src/borg/testsuite/repository.py::RepositoryFreeSpaceTestCase::test_create_free_space",
"src/borg/testsuite/repository.py::NonceReservation::test_commit_nonce_reservation",
"src/borg/testsuite/repository.py::NonceReservation::test_commit_nonce_reservation_asserts",
"src/borg/testsuite/repository.py::NonceReservation::test_get_free_nonce",
"src/borg/testsuite/repository.py::NonceReservation::test_get_free_nonce_asserts",
"src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_corrupted_hints",
"src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_deleted_hints",
"src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_deleted_index",
"src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_index",
"src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_index_outside_transaction",
"src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_unreadable_hints",
"src/borg/testsuite/repository.py::RepositoryAuxiliaryCorruptionTestCase::test_unreadable_index",
"src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_crash_before_compact",
"src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_corrupted_commit_segment",
"src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_corrupted_segment",
"src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_index_too_new",
"src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_missing_commit_segment",
"src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_missing_index",
"src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_missing_segment",
"src/borg/testsuite/repository.py::RepositoryCheckTestCase::test_repair_no_commits",
"src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test2",
"src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_consistency2",
"src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_list",
"src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_overwrite_in_same_transaction",
"src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_scan",
"src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_single_kind_transactions",
"src/borg/testsuite/repository.py::RemoteRepositoryTestCase::test_ssh_cmd",
"src/borg/testsuite/repository.py::RemoteLegacyFree::test_legacy_free",
"src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_crash_before_compact",
"src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_index_too_new",
"src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_missing_index",
"src/borg/testsuite/repository.py::RemoteRepositoryCheckTestCase::test_repair_missing_segment",
"src/borg/testsuite/repository.py::RemoteLoggerTestCase::test_info_to_correct_local_child",
"src/borg/testsuite/repository.py::RemoteLoggerTestCase::test_post11_format_messages",
"src/borg/testsuite/repository.py::RemoteLoggerTestCase::test_pre11_format_messages",
"src/borg/testsuite/repository.py::RemoteLoggerTestCase::test_remote_messages_screened",
"src/borg/testsuite/repository.py::RemoteLoggerTestCase::test_stderr_messages"
] |
[] |
BSD License
| 1,262 |
nipy__nipype-2030
|
cda3fdc3be231f2c9d7bdbdbadee472a0bad9e92
|
2017-05-17 22:13:57
|
14161a590a3166b5a9c0f4afd42ff1acf843a960
|
diff --git a/nipype/interfaces/spm/model.py b/nipype/interfaces/spm/model.py
index 4a55a4ea7..ddf35ef44 100644
--- a/nipype/interfaces/spm/model.py
+++ b/nipype/interfaces/spm/model.py
@@ -29,7 +29,7 @@ from ...utils.filemanip import (filename_to_list, list_to_filename,
from ..base import (Bunch, traits, TraitedSpec, File, Directory,
OutputMultiPath, InputMultiPath, isdefined)
from .base import (SPMCommand, SPMCommandInputSpec,
- scans_for_fnames)
+ scans_for_fnames, ImageFileSPM)
__docformat__ = 'restructuredtext'
logger = logging.getLogger('interface')
@@ -179,27 +179,38 @@ class Level1Design(SPMCommand):
class EstimateModelInputSpec(SPMCommandInputSpec):
spm_mat_file = File(exists=True, field='spmmat',
- desc='absolute path to SPM.mat',
- copyfile=True,
- mandatory=True)
- estimation_method = traits.Dict(traits.Enum('Classical', 'Bayesian2',
- 'Bayesian'),
- field='method',
- desc=('Classical, Bayesian2, '
- 'Bayesian (dict)'),
- mandatory=True)
- flags = traits.Str(desc='optional arguments (opt)')
+ copyfile=True, mandatory=True,
+ desc='Absolute path to SPM.mat')
+ estimation_method = traits.Dict(
+ traits.Enum('Classical', 'Bayesian2', 'Bayesian'),
+ field='method', mandatory=True,
+ desc=('Dictionary of either Classical: 1, Bayesian: 1, '
+ 'or Bayesian2: 1 (dict)'))
+ write_residuals = traits.Bool(field='write_residuals',
+ desc="Write individual residual images")
+ flags = traits.Dict(desc='Additional arguments')
class EstimateModelOutputSpec(TraitedSpec):
- mask_image = File(exists=True,
- desc='binary mask to constrain estimation')
- beta_images = OutputMultiPath(File(exists=True),
- desc='design parameter estimates')
- residual_image = File(exists=True,
- desc='Mean-squared image of the residuals')
- RPVimage = File(exists=True, desc='Resels per voxel image')
+ mask_image = ImageFileSPM(exists=True,
+ desc='binary mask to constrain estimation')
+ beta_images = OutputMultiPath(ImageFileSPM(exists=True),
+ desc='design parameter estimates')
+ residual_image = ImageFileSPM(exists=True,
+ desc='Mean-squared image of the residuals')
+ residual_images = OutputMultiPath(ImageFileSPM(exists=True),
+ desc="individual residual images (requires `write_residuals`")
+ RPVimage = ImageFileSPM(exists=True, desc='Resels per voxel image')
spm_mat_file = File(exists=True, desc='Updated SPM mat file')
+ labels = ImageFileSPM(exists=True, desc="label file")
+ SDerror = OutputMultiPath(ImageFileSPM(exists=True),
+ desc="Images of the standard deviation of the error")
+ ARcoef = OutputMultiPath(ImageFileSPM(exists=True),
+ desc="Images of the AR coefficient")
+ Cbetas = OutputMultiPath(ImageFileSPM(exists=True),
+ desc="Images of the parameter posteriors")
+ SDbetas = OutputMultiPath(ImageFileSPM(exists=True),
+ desc="Images of the standard deviation of parameter posteriors")
class EstimateModel(SPMCommand):
@@ -211,6 +222,7 @@ class EstimateModel(SPMCommand):
--------
>>> est = EstimateModel()
>>> est.inputs.spm_mat_file = 'SPM.mat'
+ >>> est.inputs.estimation_method = {'Classical': 1}
>>> est.run() # doctest: +SKIP
"""
input_spec = EstimateModelInputSpec
@@ -225,7 +237,7 @@ class EstimateModel(SPMCommand):
return np.array([str(val)], dtype=object)
if opt == 'estimation_method':
if isinstance(val, (str, bytes)):
- return {'%s' % val: 1}
+ return {'{}'.format(val): 1}
else:
return val
return super(EstimateModel, self)._format_arg(opt, spec, val)
@@ -235,36 +247,43 @@ class EstimateModel(SPMCommand):
"""
einputs = super(EstimateModel, self)._parse_inputs(skip=('flags'))
if isdefined(self.inputs.flags):
- einputs[0].update(self.inputs.flags)
+ einputs[0].update({flag: val for (flag, val) in
+ self.inputs.flags.items()})
return einputs
def _list_outputs(self):
outputs = self._outputs().get()
- pth, _ = os.path.split(self.inputs.spm_mat_file)
- spm12 = '12' in self.version.split('.')[0]
- if spm12:
- mask = os.path.join(pth, 'mask.nii')
- else:
- mask = os.path.join(pth, 'mask.img')
- outputs['mask_image'] = mask
+ pth = os.path.dirname(self.inputs.spm_mat_file)
+ outtype = 'nii' if '12' in self.version.split('.')[0] else 'img'
spm = sio.loadmat(self.inputs.spm_mat_file, struct_as_record=False)
- betas = []
- for vbeta in spm['SPM'][0, 0].Vbeta[0]:
- betas.append(str(os.path.join(pth, vbeta.fname[0])))
- if betas:
- outputs['beta_images'] = betas
- if spm12:
- resms = os.path.join(pth, 'ResMS.nii')
- else:
- resms = os.path.join(pth, 'ResMS.img')
- outputs['residual_image'] = resms
- if spm12:
- rpv = os.path.join(pth, 'RPV.nii')
- else:
- rpv = os.path.join(pth, 'RPV.img')
- outputs['RPVimage'] = rpv
- spm = os.path.join(pth, 'SPM.mat')
- outputs['spm_mat_file'] = spm
+
+ betas = [vbeta.fname[0] for vbeta in spm['SPM'][0, 0].Vbeta[0]]
+ if ('Bayesian' in self.inputs.estimation_method.keys() or
+ 'Bayesian2' in self.inputs.estimation_method.keys()):
+ outputs['labels'] = os.path.join(pth,
+ 'labels.{}'.format(outtype))
+ outputs['SDerror'] = glob(os.path.join(pth, 'Sess*_SDerror*'))
+ outputs['ARcoef'] = glob(os.path.join(pth, 'Sess*_AR_*'))
+ if betas:
+ outputs['Cbetas'] = [os.path.join(pth, 'C{}'.format(beta))
+ for beta in betas]
+ outputs['SDbetas'] = [os.path.join(pth, 'SD{}'.format(beta))
+ for beta in betas]
+
+ if 'Classical' in self.inputs.estimation_method.keys():
+ outputs['residual_image'] = os.path.join(pth,
+ 'ResMS.{}'.format(outtype))
+ outputs['RPVimage'] = os.path.join(pth,
+ 'RPV.{}'.format(outtype))
+ if self.inputs.write_residuals:
+ outputs['residual_images'] = glob(os.path.join(pth, 'Res_*'))
+ if betas:
+ outputs['beta_images'] = [os.path.join(pth, beta)
+ for beta in betas]
+
+ outputs['mask_image'] = os.path.join(pth,
+ 'mask.{}'.format(outtype))
+ outputs['spm_mat_file'] = os.path.join(pth, 'SPM.mat')
return outputs
|
spm.EstimateModel additional args broken
### Summary
Issue brought up on [Neurostars#436](https://neurostars.org/t/nipype-interfaces-without-options-present-in-the-underlying-executable-function/436)
### Actual behavior
`EstimateModel` expects a string for input `flags`, but later expects a dictionary.
### Expected behavior
Additional inputs can be added.
### Platform details:
Please paste the output of: `python -c "import nipype; print(nipype.get_info()); print(nipype.__version__)"`
```
{'pkg_path': '/code/nipype/nipype', 'commit_source': 'repository', 'commit_hash': '71e2140', 'nipype_version': '1.0.0-g71e2140.dev', 'sys_version': '3.6.1 | packaged by conda-forge | (default, Mar 23 2017, 21:05:12) \n[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)]', 'sys_executable': '/home/mathias/miniconda2/envs/dev3/bin/python', 'sys_platform': 'linux', 'numpy_version': '1.12.1', 'scipy_version': '0.19.0', 'networkx_version': '1.11', 'nibabel_version': '2.1.0', 'traits_version': '4.6.0'}
1.0.0-g71e2140.dev
```
### Execution environment
Local
Addressing this now
|
nipy/nipype
|
diff --git a/nipype/interfaces/spm/tests/test_auto_EstimateModel.py b/nipype/interfaces/spm/tests/test_auto_EstimateModel.py
index c99ff7dd0..703c97c6f 100644
--- a/nipype/interfaces/spm/tests/test_auto_EstimateModel.py
+++ b/nipype/interfaces/spm/tests/test_auto_EstimateModel.py
@@ -23,6 +23,8 @@ def test_EstimateModel_inputs():
use_v8struct=dict(min_ver='8',
usedefault=True,
),
+ write_residuals=dict(field='write_residuals',
+ ),
)
inputs = EstimateModel.input_spec()
@@ -32,10 +34,16 @@ def test_EstimateModel_inputs():
def test_EstimateModel_outputs():
- output_map = dict(RPVimage=dict(),
+ output_map = dict(ARcoef=dict(),
+ Cbetas=dict(),
+ RPVimage=dict(),
+ SDbetas=dict(),
+ SDerror=dict(),
beta_images=dict(),
+ labels=dict(),
mask_image=dict(),
residual_image=dict(),
+ residual_images=dict(),
spm_mat_file=dict(),
)
outputs = EstimateModel.output_spec()
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 1
}
|
0.13
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
click==8.0.4
configparser==5.2.0
decorator==4.4.2
funcsigs==1.0.2
future==1.0.0
importlib-metadata==4.8.3
iniconfig==1.1.1
isodate==0.6.1
lxml==5.3.1
mock==5.2.0
networkx==2.5.1
nibabel==3.2.2
-e git+https://github.com/nipy/nipype.git@cda3fdc3be231f2c9d7bdbdbadee472a0bad9e92#egg=nipype
numpy==1.19.5
packaging==21.3
pluggy==1.0.0
prov==2.0.1
py==1.11.0
pydotplus==2.0.2
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
rdflib==5.0.0
scipy==1.5.4
simplejson==3.20.1
six==1.17.0
tomli==1.2.3
traits==6.4.1
typing_extensions==4.1.1
zipp==3.6.0
|
name: nipype
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- click==8.0.4
- configparser==5.2.0
- decorator==4.4.2
- funcsigs==1.0.2
- future==1.0.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- isodate==0.6.1
- lxml==5.3.1
- mock==5.2.0
- networkx==2.5.1
- nibabel==3.2.2
- numpy==1.19.5
- packaging==21.3
- pluggy==1.0.0
- prov==2.0.1
- py==1.11.0
- pydotplus==2.0.2
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- rdflib==5.0.0
- scipy==1.5.4
- simplejson==3.20.1
- six==1.17.0
- tomli==1.2.3
- traits==6.4.1
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/nipype
|
[
"nipype/interfaces/spm/tests/test_auto_EstimateModel.py::test_EstimateModel_inputs"
] |
[] |
[
"nipype/interfaces/spm/tests/test_auto_EstimateModel.py::test_EstimateModel_outputs"
] |
[] |
Apache License 2.0
| 1,265 |
|
python-cmd2__cmd2-101
|
398cec2fd27c7e09d1b01dc383c5aefeb28511c3
|
2017-05-18 15:00:05
|
ddfd3d9a400ae81468e9abcc89fe690c30b7ec7f
|
diff --git a/cmd2.py b/cmd2.py
index 1f65f5a1..1de93ec2 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -87,7 +87,7 @@ try:
except ImportError:
pass
-__version__ = '0.7.1a'
+__version__ = '0.7.1'
# Pyparsing enablePackrat() can greatly speed up parsing, but problems have been seen in Python 3 in the past
pyparsing.ParserElement.enablePackrat()
@@ -1461,7 +1461,7 @@ class Cmd(cmd.Cmd):
return []
# Get a list of every directory in the PATH environment variable and ignore symbolic links
- paths = [p for p in os.getenv('PATH').split(':') if not os.path.islink(p)]
+ paths = [p for p in os.getenv('PATH').split(os.path.pathsep) if not os.path.islink(p)]
# Find every executable file in the PATH that matches the pattern
exes = []
diff --git a/setup.py b/setup.py
index 58505a0a..d09c5fd3 100755
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ Setuptools setup file, used to install or test 'cmd2'
"""
from setuptools import setup
-VERSION = '0.7.1a'
+VERSION = '0.7.1'
DESCRIPTION = "Extra features for standard library's cmd module"
LONG_DESCRIPTION = """cmd2 is an enhancement to the standard library's cmd module for Python 2.7
|
Shell command completion not working on windows
Completion of shell commands isn't working on windows, though path completion is working just fine on Windows and shell command completion is working on fine on both Linux and Mac.
|
python-cmd2/cmd2
|
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 10ae4329..3b0f752e 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -22,7 +22,7 @@ from conftest import run_cmd, normalize, BASE_HELP, HELP_HISTORY, SHORTCUTS_TXT,
def test_ver():
- assert cmd2.__version__ == '0.7.1a'
+ assert cmd2.__version__ == '0.7.1'
def test_base_help(base_app):
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 2
}
|
0.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "",
"pip_packages": [
"mock",
"pytest",
"pyparsing"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
-e git+https://github.com/python-cmd2/cmd2.git@398cec2fd27c7e09d1b01dc383c5aefeb28511c3#egg=cmd2
importlib-metadata==4.8.3
iniconfig==1.1.1
mock==5.2.0
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: cmd2
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- mock==5.2.0
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/cmd2
|
[
"tests/test_cmd2.py::test_ver"
] |
[
"tests/test_cmd2.py::test_output_redirection"
] |
[
"tests/test_cmd2.py::test_base_help",
"tests/test_cmd2.py::test_base_help_history",
"tests/test_cmd2.py::test_base_shortcuts",
"tests/test_cmd2.py::test_base_show",
"tests/test_cmd2.py::test_base_show_long",
"tests/test_cmd2.py::test_base_set",
"tests/test_cmd2.py::test_base_set_not_supported",
"tests/test_cmd2.py::test_base_shell",
"tests/test_cmd2.py::test_base_py",
"tests/test_cmd2.py::test_base_run_python_script",
"tests/test_cmd2.py::test_base_error",
"tests/test_cmd2.py::test_base_history",
"tests/test_cmd2.py::test_base_list",
"tests/test_cmd2.py::test_list_with_string_argument",
"tests/test_cmd2.py::test_list_with_integer_argument",
"tests/test_cmd2.py::test_list_with_integer_span",
"tests/test_cmd2.py::test_base_cmdenvironment",
"tests/test_cmd2.py::test_base_load",
"tests/test_cmd2.py::test_base_load_default_file",
"tests/test_cmd2.py::test_base_relative_load",
"tests/test_cmd2.py::test_base_save",
"tests/test_cmd2.py::test_allow_redirection",
"tests/test_cmd2.py::test_input_redirection",
"tests/test_cmd2.py::test_pipe_to_shell",
"tests/test_cmd2.py::test_send_to_paste_buffer",
"tests/test_cmd2.py::test_base_timing",
"tests/test_cmd2.py::test_base_debug",
"tests/test_cmd2.py::test_base_colorize",
"tests/test_cmd2.py::test_edit_no_editor",
"tests/test_cmd2.py::test_edit_file",
"tests/test_cmd2.py::test_edit_number",
"tests/test_cmd2.py::test_edit_blank",
"tests/test_cmd2.py::test_base_py_interactive",
"tests/test_cmd2.py::test_base_cmdloop_with_queue",
"tests/test_cmd2.py::test_base_cmdloop_without_queue",
"tests/test_cmd2.py::test_cmdloop_without_rawinput"
] |
[] |
MIT License
| 1,268 |
|
tox-dev__tox-519
|
cf1a1c00386ce42ff9c1d21744c1fab97853bc2c
|
2017-05-18 17:01:57
|
e374ce61bf101fb2cc2eddd955f57048df153017
|
diff --git a/CHANGELOG b/CHANGELOG
index 8bdb5b8d..d0a878c7 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,7 @@ Not released yet
- #474: Start using setuptools_scm for tag based versioning.
- #506: With `-a`: do not show additional environments header if there are none
+- #518: Forward `USERPROFILE` by default on Windows.
2.7.0
-----
diff --git a/tox/config.py b/tox/config.py
index 406cc5de..a1b1cbf6 100755
--- a/tox/config.py
+++ b/tox/config.py
@@ -489,6 +489,7 @@ def tox_addoption(parser):
passenv.add("COMSPEC") # needed for distutils cygwincompiler
passenv.add("TEMP")
passenv.add("TMP")
+ passenv.add("USERPROFILE") # needed for `os.path.expanduser()`.
else:
passenv.add("TMPDIR")
for spec in value:
|
USERPROFILE is not automatically forwarded on Windows
Hi there!
Given the following `tox.ini`:
```ini
[tox]
skipsdist = true
[testenv]
commands =
python -c 'import os.path; print(os.path.expanduser("~"))'
```
Then, on Windows, this will incorrectly print `~`.
If you add a `passenv` section to forward `USERPROFILE`, then it gives the right output:
```ini
[tox]
skipsdist = true
[testenv]
passenv =
USERPROFILE
commands =
python -c 'import os.path; print(os.path.expanduser("~"))'
```
This prints `C:\Users\...` as you would expect.
If I'm not mistaken, I believe `HOME` is forwarded by default on other systems, I would assume `USERPROFILE` should also be forwarded by default on Windows.
I'll gladly work on a patch if you're willing to accept such a contribution!
|
tox-dev/tox
|
diff --git a/tests/test_config.py b/tests/test_config.py
index 4eac45e6..5a87159f 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -864,6 +864,7 @@ class TestConfigTestEnv:
assert "COMSPEC" in envconfig.passenv
assert "TEMP" in envconfig.passenv
assert "TMP" in envconfig.passenv
+ assert "USERPROFILE" in envconfig.passenv
else:
assert "TMPDIR" in envconfig.passenv
assert "PATH" in envconfig.passenv
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 2
}
|
2.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-timeout"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
distlib==0.3.9
filelock==3.4.1
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
platformdirs==2.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytest-timeout==2.1.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
-e git+https://github.com/tox-dev/tox.git@cf1a1c00386ce42ff9c1d21744c1fab97853bc2c#egg=tox
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
virtualenv==20.17.1
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: tox
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- distlib==0.3.9
- filelock==3.4.1
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- platformdirs==2.4.0
- pytest-timeout==2.1.0
- virtualenv==20.17.1
prefix: /opt/conda/envs/tox
|
[
"tests/test_config.py::TestConfigTestEnv::test_passenv_as_multiline_list[win32]"
] |
[
"tests/test_config.py::TestVenvConfig::test_force_dep_with_url",
"tests/test_config.py::TestIniParser::test_getbool"
] |
[
"tests/test_config.py::TestVenvConfig::test_config_parsing_minimal",
"tests/test_config.py::TestVenvConfig::test_config_parsing_multienv",
"tests/test_config.py::TestVenvConfig::test_envdir_set_manually",
"tests/test_config.py::TestVenvConfig::test_envdir_set_manually_with_substitutions",
"tests/test_config.py::TestVenvConfig::test_force_dep_version",
"tests/test_config.py::TestVenvConfig::test_is_same_dep",
"tests/test_config.py::TestConfigPlatform::test_config_parse_platform",
"tests/test_config.py::TestConfigPlatform::test_config_parse_platform_rex",
"tests/test_config.py::TestConfigPlatform::test_config_parse_platform_with_factors[win]",
"tests/test_config.py::TestConfigPlatform::test_config_parse_platform_with_factors[lin]",
"tests/test_config.py::TestConfigPackage::test_defaults",
"tests/test_config.py::TestConfigPackage::test_defaults_distshare",
"tests/test_config.py::TestConfigPackage::test_defaults_changed_dir",
"tests/test_config.py::TestConfigPackage::test_project_paths",
"tests/test_config.py::TestParseconfig::test_search_parents",
"tests/test_config.py::TestParseconfig::test_explicit_config_path",
"tests/test_config.py::test_get_homedir",
"tests/test_config.py::TestGetcontextname::test_blank",
"tests/test_config.py::TestGetcontextname::test_jenkins",
"tests/test_config.py::TestGetcontextname::test_hudson_legacy",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section_multiline",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section_posargs",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_section_and_posargs_substitution",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_env_substitution",
"tests/test_config.py::TestIniParser::test_getstring_single",
"tests/test_config.py::TestIniParser::test_missing_substitution",
"tests/test_config.py::TestIniParser::test_getstring_fallback_sections",
"tests/test_config.py::TestIniParser::test_getstring_substitution",
"tests/test_config.py::TestIniParser::test_getlist",
"tests/test_config.py::TestIniParser::test_getdict",
"tests/test_config.py::TestIniParser::test_getstring_environment_substitution",
"tests/test_config.py::TestIniParser::test_getstring_environment_substitution_with_default",
"tests/test_config.py::TestIniParser::test_value_matches_section_substituion",
"tests/test_config.py::TestIniParser::test_value_doesn_match_section_substitution",
"tests/test_config.py::TestIniParser::test_getstring_other_section_substitution",
"tests/test_config.py::TestIniParser::test_argvlist",
"tests/test_config.py::TestIniParser::test_argvlist_windows_escaping",
"tests/test_config.py::TestIniParser::test_argvlist_multiline",
"tests/test_config.py::TestIniParser::test_argvlist_quoting_in_command",
"tests/test_config.py::TestIniParser::test_argvlist_comment_after_command",
"tests/test_config.py::TestIniParser::test_argvlist_command_contains_hash",
"tests/test_config.py::TestIniParser::test_argvlist_positional_substitution",
"tests/test_config.py::TestIniParser::test_argvlist_quoted_posargs",
"tests/test_config.py::TestIniParser::test_argvlist_posargs_with_quotes",
"tests/test_config.py::TestIniParser::test_positional_arguments_are_only_replaced_when_standing_alone",
"tests/test_config.py::TestIniParser::test_posargs_are_added_escaped_issue310",
"tests/test_config.py::TestIniParser::test_substitution_with_multiple_words",
"tests/test_config.py::TestIniParser::test_getargv",
"tests/test_config.py::TestIniParser::test_getpath",
"tests/test_config.py::TestIniParserPrefix::test_basic_section_access",
"tests/test_config.py::TestIniParserPrefix::test_fallback_sections",
"tests/test_config.py::TestIniParserPrefix::test_value_matches_prefixed_section_substituion",
"tests/test_config.py::TestIniParserPrefix::test_value_doesn_match_prefixed_section_substitution",
"tests/test_config.py::TestIniParserPrefix::test_other_section_substitution",
"tests/test_config.py::TestConfigTestEnv::test_commentchars_issue33",
"tests/test_config.py::TestConfigTestEnv::test_defaults",
"tests/test_config.py::TestConfigTestEnv::test_sitepackages_switch",
"tests/test_config.py::TestConfigTestEnv::test_installpkg_tops_develop",
"tests/test_config.py::TestConfigTestEnv::test_specific_command_overrides",
"tests/test_config.py::TestConfigTestEnv::test_whitelist_externals",
"tests/test_config.py::TestConfigTestEnv::test_changedir",
"tests/test_config.py::TestConfigTestEnv::test_ignore_errors",
"tests/test_config.py::TestConfigTestEnv::test_envbindir",
"tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[jython]",
"tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[pypy]",
"tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[pypy3]",
"tests/test_config.py::TestConfigTestEnv::test_passenv_as_multiline_list[linux2]",
"tests/test_config.py::TestConfigTestEnv::test_passenv_as_space_separated_list[win32]",
"tests/test_config.py::TestConfigTestEnv::test_passenv_as_space_separated_list[linux2]",
"tests/test_config.py::TestConfigTestEnv::test_passenv_with_factor",
"tests/test_config.py::TestConfigTestEnv::test_passenv_from_global_env",
"tests/test_config.py::TestConfigTestEnv::test_passenv_glob_from_global_env",
"tests/test_config.py::TestConfigTestEnv::test_changedir_override",
"tests/test_config.py::TestConfigTestEnv::test_install_command_setting",
"tests/test_config.py::TestConfigTestEnv::test_install_command_must_contain_packages",
"tests/test_config.py::TestConfigTestEnv::test_install_command_substitutions",
"tests/test_config.py::TestConfigTestEnv::test_pip_pre",
"tests/test_config.py::TestConfigTestEnv::test_pip_pre_cmdline_override",
"tests/test_config.py::TestConfigTestEnv::test_simple",
"tests/test_config.py::TestConfigTestEnv::test_substitution_error",
"tests/test_config.py::TestConfigTestEnv::test_substitution_defaults",
"tests/test_config.py::TestConfigTestEnv::test_substitution_notfound_issue246",
"tests/test_config.py::TestConfigTestEnv::test_substitution_positional",
"tests/test_config.py::TestConfigTestEnv::test_substitution_noargs_issue240",
"tests/test_config.py::TestConfigTestEnv::test_substitution_double",
"tests/test_config.py::TestConfigTestEnv::test_posargs_backslashed_or_quoted",
"tests/test_config.py::TestConfigTestEnv::test_rewrite_posargs",
"tests/test_config.py::TestConfigTestEnv::test_rewrite_simple_posargs",
"tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_testenv[envlist0-deps0]",
"tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_testenv[envlist1-deps1]",
"tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_section",
"tests/test_config.py::TestConfigTestEnv::test_multilevel_substitution",
"tests/test_config.py::TestConfigTestEnv::test_recursive_substitution_cycle_fails",
"tests/test_config.py::TestConfigTestEnv::test_single_value_from_other_secton",
"tests/test_config.py::TestConfigTestEnv::test_factors",
"tests/test_config.py::TestConfigTestEnv::test_factor_ops",
"tests/test_config.py::TestConfigTestEnv::test_default_factors",
"tests/test_config.py::TestConfigTestEnv::test_factors_in_boolean",
"tests/test_config.py::TestConfigTestEnv::test_factors_in_setenv",
"tests/test_config.py::TestConfigTestEnv::test_factor_use_not_checked",
"tests/test_config.py::TestConfigTestEnv::test_factors_groups_touch",
"tests/test_config.py::TestConfigTestEnv::test_period_in_factor",
"tests/test_config.py::TestConfigTestEnv::test_ignore_outcome",
"tests/test_config.py::TestGlobalOptions::test_notest",
"tests/test_config.py::TestGlobalOptions::test_verbosity",
"tests/test_config.py::TestGlobalOptions::test_substitution_jenkins_default",
"tests/test_config.py::TestGlobalOptions::test_substitution_jenkins_context",
"tests/test_config.py::TestGlobalOptions::test_sdist_specification",
"tests/test_config.py::TestGlobalOptions::test_env_selection",
"tests/test_config.py::TestGlobalOptions::test_py_venv",
"tests/test_config.py::TestGlobalOptions::test_default_environments",
"tests/test_config.py::TestGlobalOptions::test_envlist_expansion",
"tests/test_config.py::TestGlobalOptions::test_envlist_cross_product",
"tests/test_config.py::TestGlobalOptions::test_envlist_multiline",
"tests/test_config.py::TestGlobalOptions::test_minversion",
"tests/test_config.py::TestGlobalOptions::test_skip_missing_interpreters_true",
"tests/test_config.py::TestGlobalOptions::test_skip_missing_interpreters_false",
"tests/test_config.py::TestGlobalOptions::test_defaultenv_commandline",
"tests/test_config.py::TestGlobalOptions::test_defaultenv_partial_override",
"tests/test_config.py::TestHashseedOption::test_default",
"tests/test_config.py::TestHashseedOption::test_passing_integer",
"tests/test_config.py::TestHashseedOption::test_passing_string",
"tests/test_config.py::TestHashseedOption::test_passing_empty_string",
"tests/test_config.py::TestHashseedOption::test_setenv",
"tests/test_config.py::TestHashseedOption::test_noset",
"tests/test_config.py::TestHashseedOption::test_noset_with_setenv",
"tests/test_config.py::TestHashseedOption::test_one_random_hashseed",
"tests/test_config.py::TestHashseedOption::test_setenv_in_one_testenv",
"tests/test_config.py::TestSetenv::test_getdict_lazy",
"tests/test_config.py::TestSetenv::test_getdict_lazy_update",
"tests/test_config.py::TestSetenv::test_setenv_uses_os_environ",
"tests/test_config.py::TestSetenv::test_setenv_default_os_environ",
"tests/test_config.py::TestSetenv::test_setenv_uses_other_setenv",
"tests/test_config.py::TestSetenv::test_setenv_recursive_direct",
"tests/test_config.py::TestSetenv::test_setenv_overrides",
"tests/test_config.py::TestSetenv::test_setenv_with_envdir_and_basepython",
"tests/test_config.py::TestSetenv::test_setenv_ordering_1",
"tests/test_config.py::TestSetenv::test_setenv_cross_section_subst_issue294",
"tests/test_config.py::TestSetenv::test_setenv_cross_section_subst_twice",
"tests/test_config.py::TestSetenv::test_setenv_cross_section_mixed",
"tests/test_config.py::TestIndexServer::test_indexserver",
"tests/test_config.py::TestIndexServer::test_parse_indexserver",
"tests/test_config.py::TestIndexServer::test_multiple_homedir_relative_local_indexservers",
"tests/test_config.py::TestConfigConstSubstitutions::test_replace_pathsep_unix[:]",
"tests/test_config.py::TestConfigConstSubstitutions::test_replace_pathsep_unix[;]",
"tests/test_config.py::TestConfigConstSubstitutions::test_pathsep_regex",
"tests/test_config.py::TestParseEnv::test_parse_recreate",
"tests/test_config.py::TestCmdInvocation::test_help",
"tests/test_config.py::TestCmdInvocation::test_version",
"tests/test_config.py::TestCmdInvocation::test_listenvs",
"tests/test_config.py::TestCmdInvocation::test_listenvs_verbose_description",
"tests/test_config.py::TestCmdInvocation::test_listenvs_all",
"tests/test_config.py::TestCmdInvocation::test_listenvs_all_verbose_description",
"tests/test_config.py::TestCmdInvocation::test_listenvs_all_verbose_description_no_additional_environments",
"tests/test_config.py::TestCmdInvocation::test_config_specific_ini",
"tests/test_config.py::TestCmdInvocation::test_no_tox_ini",
"tests/test_config.py::TestCmdInvocation::test_override_workdir",
"tests/test_config.py::TestCmdInvocation::test_showconfig_with_force_dep_version",
"tests/test_config.py::test_env_spec[-e",
"tests/test_config.py::TestCommandParser::test_command_parser_for_word",
"tests/test_config.py::TestCommandParser::test_command_parser_for_posargs",
"tests/test_config.py::TestCommandParser::test_command_parser_for_multiple_words",
"tests/test_config.py::TestCommandParser::test_command_parser_for_substitution_with_spaces",
"tests/test_config.py::TestCommandParser::test_command_parser_with_complex_word_set",
"tests/test_config.py::TestCommandParser::test_command_with_runs_of_whitespace",
"tests/test_config.py::TestCommandParser::test_command_with_split_line_in_subst_arguments",
"tests/test_config.py::TestCommandParser::test_command_parsing_for_issue_10"
] |
[] |
MIT License
| 1,269 |
|
tox-dev__tox-520
|
88e5b59db694b6ecf4386a2a6ae61722fbd81dca
|
2017-05-18 17:08:09
|
e374ce61bf101fb2cc2eddd955f57048df153017
|
diff --git a/CHANGELOG b/CHANGELOG
index befff952..84e10651 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,8 @@ Not released yet
- #474: Start using setuptools_scm for tag based versioning.
- #506: With `-a`: do not show additional environments header if there are none
+- #517: Forward NUMBER_OF_PROCESSORS by default on Windows to fix
+ `multiprocessor.cpu_count()`.
- #518: Forward `USERPROFILE` by default on Windows.
2.7.0
diff --git a/tox/config.py b/tox/config.py
index a1b1cbf6..a61fe7ca 100755
--- a/tox/config.py
+++ b/tox/config.py
@@ -489,6 +489,9 @@ def tox_addoption(parser):
passenv.add("COMSPEC") # needed for distutils cygwincompiler
passenv.add("TEMP")
passenv.add("TMP")
+ # for `multiprocessing.cpu_count()` on Windows
+ # (prior to Python 3.4).
+ passenv.add("NUMBER_OF_PROCESSORS")
passenv.add("USERPROFILE") # needed for `os.path.expanduser()`.
else:
passenv.add("TMPDIR")
|
Foward NUMBER_OF_PROCESSORS environment variable by default
Hi there!
In one project, I have a Python 2.7-only dependency that uses [`multiprocessing.cpu_count()`](https://docs.python.org/2/library/multiprocessing.html#multiprocessing.cpu_count) on Windows. This has a hidden dependency on the `NUMBER_OF_PROCESSORS` environment variable. This is quite confusing when porting this type of project into Tox.
**Note**: in Python 3.4+, this is API is superseeded by [`os.cpu_count()`](https://docs.python.org/3/library/os.html#os.cpu_count) which does not depend on this environment variable.
The case is a bit weak (Python up to 3.3 only, plus multiprocessing is not popular on Windows), but I feel like the standard library should work by default inside a Tox test environment.
I'm willing to work on a patch if you would accept such a contribution!
|
tox-dev/tox
|
diff --git a/tests/test_config.py b/tests/test_config.py
index 5a87159f..827934ef 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -864,6 +864,7 @@ class TestConfigTestEnv:
assert "COMSPEC" in envconfig.passenv
assert "TEMP" in envconfig.passenv
assert "TMP" in envconfig.passenv
+ assert "NUMBER_OF_PROCESSORS" in envconfig.passenv
assert "USERPROFILE" in envconfig.passenv
else:
assert "TMPDIR" in envconfig.passenv
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 2
}
|
2.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-timeout"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
distlib==0.3.9
filelock==3.4.1
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
platformdirs==2.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytest-timeout==2.1.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
-e git+https://github.com/tox-dev/tox.git@88e5b59db694b6ecf4386a2a6ae61722fbd81dca#egg=tox
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
virtualenv==20.17.1
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: tox
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- distlib==0.3.9
- filelock==3.4.1
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- platformdirs==2.4.0
- pytest-timeout==2.1.0
- virtualenv==20.17.1
prefix: /opt/conda/envs/tox
|
[
"tests/test_config.py::TestConfigTestEnv::test_passenv_as_multiline_list[win32]"
] |
[
"tests/test_config.py::TestVenvConfig::test_force_dep_with_url",
"tests/test_config.py::TestIniParser::test_getbool"
] |
[
"tests/test_config.py::TestVenvConfig::test_config_parsing_minimal",
"tests/test_config.py::TestVenvConfig::test_config_parsing_multienv",
"tests/test_config.py::TestVenvConfig::test_envdir_set_manually",
"tests/test_config.py::TestVenvConfig::test_envdir_set_manually_with_substitutions",
"tests/test_config.py::TestVenvConfig::test_force_dep_version",
"tests/test_config.py::TestVenvConfig::test_is_same_dep",
"tests/test_config.py::TestConfigPlatform::test_config_parse_platform",
"tests/test_config.py::TestConfigPlatform::test_config_parse_platform_rex",
"tests/test_config.py::TestConfigPlatform::test_config_parse_platform_with_factors[win]",
"tests/test_config.py::TestConfigPlatform::test_config_parse_platform_with_factors[lin]",
"tests/test_config.py::TestConfigPackage::test_defaults",
"tests/test_config.py::TestConfigPackage::test_defaults_distshare",
"tests/test_config.py::TestConfigPackage::test_defaults_changed_dir",
"tests/test_config.py::TestConfigPackage::test_project_paths",
"tests/test_config.py::TestParseconfig::test_search_parents",
"tests/test_config.py::TestParseconfig::test_explicit_config_path",
"tests/test_config.py::test_get_homedir",
"tests/test_config.py::TestGetcontextname::test_blank",
"tests/test_config.py::TestGetcontextname::test_jenkins",
"tests/test_config.py::TestGetcontextname::test_hudson_legacy",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section_multiline",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section_posargs",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_section_and_posargs_substitution",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_env_substitution",
"tests/test_config.py::TestIniParser::test_getstring_single",
"tests/test_config.py::TestIniParser::test_missing_substitution",
"tests/test_config.py::TestIniParser::test_getstring_fallback_sections",
"tests/test_config.py::TestIniParser::test_getstring_substitution",
"tests/test_config.py::TestIniParser::test_getlist",
"tests/test_config.py::TestIniParser::test_getdict",
"tests/test_config.py::TestIniParser::test_getstring_environment_substitution",
"tests/test_config.py::TestIniParser::test_getstring_environment_substitution_with_default",
"tests/test_config.py::TestIniParser::test_value_matches_section_substituion",
"tests/test_config.py::TestIniParser::test_value_doesn_match_section_substitution",
"tests/test_config.py::TestIniParser::test_getstring_other_section_substitution",
"tests/test_config.py::TestIniParser::test_argvlist",
"tests/test_config.py::TestIniParser::test_argvlist_windows_escaping",
"tests/test_config.py::TestIniParser::test_argvlist_multiline",
"tests/test_config.py::TestIniParser::test_argvlist_quoting_in_command",
"tests/test_config.py::TestIniParser::test_argvlist_comment_after_command",
"tests/test_config.py::TestIniParser::test_argvlist_command_contains_hash",
"tests/test_config.py::TestIniParser::test_argvlist_positional_substitution",
"tests/test_config.py::TestIniParser::test_argvlist_quoted_posargs",
"tests/test_config.py::TestIniParser::test_argvlist_posargs_with_quotes",
"tests/test_config.py::TestIniParser::test_positional_arguments_are_only_replaced_when_standing_alone",
"tests/test_config.py::TestIniParser::test_posargs_are_added_escaped_issue310",
"tests/test_config.py::TestIniParser::test_substitution_with_multiple_words",
"tests/test_config.py::TestIniParser::test_getargv",
"tests/test_config.py::TestIniParser::test_getpath",
"tests/test_config.py::TestIniParserPrefix::test_basic_section_access",
"tests/test_config.py::TestIniParserPrefix::test_fallback_sections",
"tests/test_config.py::TestIniParserPrefix::test_value_matches_prefixed_section_substituion",
"tests/test_config.py::TestIniParserPrefix::test_value_doesn_match_prefixed_section_substitution",
"tests/test_config.py::TestIniParserPrefix::test_other_section_substitution",
"tests/test_config.py::TestConfigTestEnv::test_commentchars_issue33",
"tests/test_config.py::TestConfigTestEnv::test_defaults",
"tests/test_config.py::TestConfigTestEnv::test_sitepackages_switch",
"tests/test_config.py::TestConfigTestEnv::test_installpkg_tops_develop",
"tests/test_config.py::TestConfigTestEnv::test_specific_command_overrides",
"tests/test_config.py::TestConfigTestEnv::test_whitelist_externals",
"tests/test_config.py::TestConfigTestEnv::test_changedir",
"tests/test_config.py::TestConfigTestEnv::test_ignore_errors",
"tests/test_config.py::TestConfigTestEnv::test_envbindir",
"tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[jython]",
"tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[pypy]",
"tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[pypy3]",
"tests/test_config.py::TestConfigTestEnv::test_passenv_as_multiline_list[linux2]",
"tests/test_config.py::TestConfigTestEnv::test_passenv_as_space_separated_list[win32]",
"tests/test_config.py::TestConfigTestEnv::test_passenv_as_space_separated_list[linux2]",
"tests/test_config.py::TestConfigTestEnv::test_passenv_with_factor",
"tests/test_config.py::TestConfigTestEnv::test_passenv_from_global_env",
"tests/test_config.py::TestConfigTestEnv::test_passenv_glob_from_global_env",
"tests/test_config.py::TestConfigTestEnv::test_changedir_override",
"tests/test_config.py::TestConfigTestEnv::test_install_command_setting",
"tests/test_config.py::TestConfigTestEnv::test_install_command_must_contain_packages",
"tests/test_config.py::TestConfigTestEnv::test_install_command_substitutions",
"tests/test_config.py::TestConfigTestEnv::test_pip_pre",
"tests/test_config.py::TestConfigTestEnv::test_pip_pre_cmdline_override",
"tests/test_config.py::TestConfigTestEnv::test_simple",
"tests/test_config.py::TestConfigTestEnv::test_substitution_error",
"tests/test_config.py::TestConfigTestEnv::test_substitution_defaults",
"tests/test_config.py::TestConfigTestEnv::test_substitution_notfound_issue246",
"tests/test_config.py::TestConfigTestEnv::test_substitution_positional",
"tests/test_config.py::TestConfigTestEnv::test_substitution_noargs_issue240",
"tests/test_config.py::TestConfigTestEnv::test_substitution_double",
"tests/test_config.py::TestConfigTestEnv::test_posargs_backslashed_or_quoted",
"tests/test_config.py::TestConfigTestEnv::test_rewrite_posargs",
"tests/test_config.py::TestConfigTestEnv::test_rewrite_simple_posargs",
"tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_testenv[envlist0-deps0]",
"tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_testenv[envlist1-deps1]",
"tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_section",
"tests/test_config.py::TestConfigTestEnv::test_multilevel_substitution",
"tests/test_config.py::TestConfigTestEnv::test_recursive_substitution_cycle_fails",
"tests/test_config.py::TestConfigTestEnv::test_single_value_from_other_secton",
"tests/test_config.py::TestConfigTestEnv::test_factors",
"tests/test_config.py::TestConfigTestEnv::test_factor_ops",
"tests/test_config.py::TestConfigTestEnv::test_default_factors",
"tests/test_config.py::TestConfigTestEnv::test_factors_in_boolean",
"tests/test_config.py::TestConfigTestEnv::test_factors_in_setenv",
"tests/test_config.py::TestConfigTestEnv::test_factor_use_not_checked",
"tests/test_config.py::TestConfigTestEnv::test_factors_groups_touch",
"tests/test_config.py::TestConfigTestEnv::test_period_in_factor",
"tests/test_config.py::TestConfigTestEnv::test_ignore_outcome",
"tests/test_config.py::TestGlobalOptions::test_notest",
"tests/test_config.py::TestGlobalOptions::test_verbosity",
"tests/test_config.py::TestGlobalOptions::test_substitution_jenkins_default",
"tests/test_config.py::TestGlobalOptions::test_substitution_jenkins_context",
"tests/test_config.py::TestGlobalOptions::test_sdist_specification",
"tests/test_config.py::TestGlobalOptions::test_env_selection",
"tests/test_config.py::TestGlobalOptions::test_py_venv",
"tests/test_config.py::TestGlobalOptions::test_default_environments",
"tests/test_config.py::TestGlobalOptions::test_envlist_expansion",
"tests/test_config.py::TestGlobalOptions::test_envlist_cross_product",
"tests/test_config.py::TestGlobalOptions::test_envlist_multiline",
"tests/test_config.py::TestGlobalOptions::test_minversion",
"tests/test_config.py::TestGlobalOptions::test_skip_missing_interpreters_true",
"tests/test_config.py::TestGlobalOptions::test_skip_missing_interpreters_false",
"tests/test_config.py::TestGlobalOptions::test_defaultenv_commandline",
"tests/test_config.py::TestGlobalOptions::test_defaultenv_partial_override",
"tests/test_config.py::TestHashseedOption::test_default",
"tests/test_config.py::TestHashseedOption::test_passing_integer",
"tests/test_config.py::TestHashseedOption::test_passing_string",
"tests/test_config.py::TestHashseedOption::test_passing_empty_string",
"tests/test_config.py::TestHashseedOption::test_setenv",
"tests/test_config.py::TestHashseedOption::test_noset",
"tests/test_config.py::TestHashseedOption::test_noset_with_setenv",
"tests/test_config.py::TestHashseedOption::test_one_random_hashseed",
"tests/test_config.py::TestHashseedOption::test_setenv_in_one_testenv",
"tests/test_config.py::TestSetenv::test_getdict_lazy",
"tests/test_config.py::TestSetenv::test_getdict_lazy_update",
"tests/test_config.py::TestSetenv::test_setenv_uses_os_environ",
"tests/test_config.py::TestSetenv::test_setenv_default_os_environ",
"tests/test_config.py::TestSetenv::test_setenv_uses_other_setenv",
"tests/test_config.py::TestSetenv::test_setenv_recursive_direct",
"tests/test_config.py::TestSetenv::test_setenv_overrides",
"tests/test_config.py::TestSetenv::test_setenv_with_envdir_and_basepython",
"tests/test_config.py::TestSetenv::test_setenv_ordering_1",
"tests/test_config.py::TestSetenv::test_setenv_cross_section_subst_issue294",
"tests/test_config.py::TestSetenv::test_setenv_cross_section_subst_twice",
"tests/test_config.py::TestSetenv::test_setenv_cross_section_mixed",
"tests/test_config.py::TestIndexServer::test_indexserver",
"tests/test_config.py::TestIndexServer::test_parse_indexserver",
"tests/test_config.py::TestIndexServer::test_multiple_homedir_relative_local_indexservers",
"tests/test_config.py::TestConfigConstSubstitutions::test_replace_pathsep_unix[:]",
"tests/test_config.py::TestConfigConstSubstitutions::test_replace_pathsep_unix[;]",
"tests/test_config.py::TestConfigConstSubstitutions::test_pathsep_regex",
"tests/test_config.py::TestParseEnv::test_parse_recreate",
"tests/test_config.py::TestCmdInvocation::test_help",
"tests/test_config.py::TestCmdInvocation::test_version",
"tests/test_config.py::TestCmdInvocation::test_listenvs",
"tests/test_config.py::TestCmdInvocation::test_listenvs_verbose_description",
"tests/test_config.py::TestCmdInvocation::test_listenvs_all",
"tests/test_config.py::TestCmdInvocation::test_listenvs_all_verbose_description",
"tests/test_config.py::TestCmdInvocation::test_listenvs_all_verbose_description_no_additional_environments",
"tests/test_config.py::TestCmdInvocation::test_config_specific_ini",
"tests/test_config.py::TestCmdInvocation::test_no_tox_ini",
"tests/test_config.py::TestCmdInvocation::test_override_workdir",
"tests/test_config.py::TestCmdInvocation::test_showconfig_with_force_dep_version",
"tests/test_config.py::test_env_spec[-e",
"tests/test_config.py::TestCommandParser::test_command_parser_for_word",
"tests/test_config.py::TestCommandParser::test_command_parser_for_posargs",
"tests/test_config.py::TestCommandParser::test_command_parser_for_multiple_words",
"tests/test_config.py::TestCommandParser::test_command_parser_for_substitution_with_spaces",
"tests/test_config.py::TestCommandParser::test_command_parser_with_complex_word_set",
"tests/test_config.py::TestCommandParser::test_command_with_runs_of_whitespace",
"tests/test_config.py::TestCommandParser::test_command_with_split_line_in_subst_arguments",
"tests/test_config.py::TestCommandParser::test_command_parsing_for_issue_10"
] |
[] |
MIT License
| 1,270 |
|
tox-dev__tox-521
|
6889c81a4c31fedeb22af056e9f2b7e8f86f00cf
|
2017-05-18 18:00:01
|
e374ce61bf101fb2cc2eddd955f57048df153017
|
diff --git a/CHANGELOG b/CHANGELOG
index 6da74217..eeb48cff 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,8 @@ Not released yet
- #517: Forward NUMBER_OF_PROCESSORS by default on Windows to fix
`multiprocessor.cpu_count()`.
- #518: Forward `USERPROFILE` by default on Windows.
+- #515: Don't require environment variables in test environments
+ where they are not used.
2.7.0
-----
diff --git a/tox/config.py b/tox/config.py
index d797951c..e5e616b3 100755
--- a/tox/config.py
+++ b/tox/config.py
@@ -792,7 +792,8 @@ class parseini:
factors = set(name.split('-'))
if section in self._cfg or factors <= known_factors:
config.envconfigs[name] = \
- self.make_envconfig(name, section, reader._subs, config)
+ self.make_envconfig(name, section, reader._subs, config,
+ replace=name in config.envlist)
all_develop = all(name in config.envconfigs
and config.envconfigs[name].usedevelop
@@ -808,7 +809,7 @@ class parseini:
factors.update(*mapcat(_split_factor_expr, exprs))
return factors
- def make_envconfig(self, name, section, subs, config):
+ def make_envconfig(self, name, section, subs, config, replace=True):
factors = set(name.split('-'))
reader = SectionReader(section, self._cfg, fallbacksections=["testenv"],
factors=factors)
@@ -823,7 +824,7 @@ class parseini:
atype = env_attr.type
if atype in ("bool", "path", "string", "dict", "dict_setenv", "argv", "argvlist"):
meth = getattr(reader, "get" + atype)
- res = meth(env_attr.name, env_attr.default)
+ res = meth(env_attr.name, env_attr.default, replace=replace)
elif atype == "space-separated-list":
res = reader.getlist(env_attr.name, sep=" ")
elif atype == "line-list":
@@ -942,9 +943,9 @@ class SectionReader:
if _posargs:
self.posargs = _posargs
- def getpath(self, name, defaultpath):
+ def getpath(self, name, defaultpath, replace=True):
toxinidir = self._subs['toxinidir']
- path = self.getstring(name, defaultpath)
+ path = self.getstring(name, defaultpath, replace=replace)
if path is not None:
return toxinidir.join(path, abs=True)
@@ -954,12 +955,12 @@ class SectionReader:
return []
return [x.strip() for x in s.split(sep) if x.strip()]
- def getdict(self, name, default=None, sep="\n"):
+ def getdict(self, name, default=None, sep="\n", replace=True):
value = self.getstring(name, None)
return self._getdict(value, default=default, sep=sep)
- def getdict_setenv(self, name, default=None, sep="\n"):
- value = self.getstring(name, None, replace=True, crossonly=True)
+ def getdict_setenv(self, name, default=None, sep="\n", replace=True):
+ value = self.getstring(name, None, replace=replace, crossonly=True)
definitions = self._getdict(value, default=default, sep=sep)
self._setenv = SetenvDict(definitions, reader=self)
return self._setenv
@@ -976,8 +977,8 @@ class SectionReader:
return d
- def getbool(self, name, default=None):
- s = self.getstring(name, default)
+ def getbool(self, name, default=None, replace=True):
+ s = self.getstring(name, default, replace=replace)
if not s:
s = default
if s is None:
@@ -994,12 +995,12 @@ class SectionReader:
"boolean value %r needs to be 'True' or 'False'")
return s
- def getargvlist(self, name, default=""):
+ def getargvlist(self, name, default="", replace=True):
s = self.getstring(name, default, replace=False)
- return _ArgvlistReader.getargvlist(self, s)
+ return _ArgvlistReader.getargvlist(self, s, replace=replace)
- def getargv(self, name, default=""):
- return self.getargvlist(name, default)[0]
+ def getargv(self, name, default="", replace=True):
+ return self.getargvlist(name, default, replace=replace)[0]
def getstring(self, name, default=None, replace=True, crossonly=False):
x = None
@@ -1153,7 +1154,7 @@ class Replacer:
class _ArgvlistReader:
@classmethod
- def getargvlist(cls, reader, value):
+ def getargvlist(cls, reader, value, replace=True):
"""Parse ``commands`` argvlist multiline string.
:param str name: Key name in a section.
@@ -1178,7 +1179,7 @@ class _ArgvlistReader:
replaced = reader._replace(current_command, crossonly=True)
commands.extend(cls.getargvlist(reader, replaced))
else:
- commands.append(cls.processcommand(reader, current_command))
+ commands.append(cls.processcommand(reader, current_command, replace))
current_command = ""
else:
if current_command:
@@ -1188,7 +1189,7 @@ class _ArgvlistReader:
return commands
@classmethod
- def processcommand(cls, reader, command):
+ def processcommand(cls, reader, command, replace=True):
posargs = getattr(reader, "posargs", "")
posargs_string = list2cmdline([x for x in posargs if x])
@@ -1196,23 +1197,26 @@ class _ArgvlistReader:
# appropriate to construct the new command string. This
# string is then broken up into exec argv components using
# shlex.
- newcommand = ""
- for word in CommandParser(command).words():
- if word == "{posargs}" or word == "[]":
- newcommand += posargs_string
- continue
- elif word.startswith("{posargs:") and word.endswith("}"):
- if posargs:
+ if replace:
+ newcommand = ""
+ for word in CommandParser(command).words():
+ if word == "{posargs}" or word == "[]":
newcommand += posargs_string
continue
- else:
- word = word[9:-1]
- new_arg = ""
- new_word = reader._replace(word)
- new_word = reader._replace(new_word)
- new_word = new_word.replace('\\{', '{').replace('\\}', '}')
- new_arg += new_word
- newcommand += new_arg
+ elif word.startswith("{posargs:") and word.endswith("}"):
+ if posargs:
+ newcommand += posargs_string
+ continue
+ else:
+ word = word[9:-1]
+ new_arg = ""
+ new_word = reader._replace(word)
+ new_word = reader._replace(new_word)
+ new_word = new_word.replace('\\{', '{').replace('\\}', '}')
+ new_arg += new_word
+ newcommand += new_arg
+ else:
+ newcommand = command
# Construct shlex object that will not escape any values,
# use all values as is in argv.
|
Environment variables required across unrelated environments
Hi there,
I have an issue where if one environment uses an `{env:X}` subsitution (without default), then that environment variable is required in all environments regardless of whether they are necessary or not.
Given this example `tox.ini` file:
```ini
[tox]
skipsdist = true
[testenv:standard-greeting]
commands =
python -c 'print("Hello, world!")'
[testenv:custom-greeting]
passenv =
NAME
commands =
python -c 'print("Hello, {env:NAME}!"'
```
Then `custom-greeting` environment cannot be used unless `NAME` is present in the calling environment, even if that environment doesn't use the `{env:NAME}`.
```shell
$ tox -e standard-greeting
tox.ConfigError: ConfigError: substitution env:'NAME': unknown environment variable 'NAME' or recursive definition.
```
I got this with tox 2.7.0 with both Python 3.5 and 2.7 on Windows.
|
tox-dev/tox
|
diff --git a/tests/test_config.py b/tests/test_config.py
index 9254e992..743b08ed 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -1088,6 +1088,27 @@ class TestConfigTestEnv:
assert 'FOO' in env
assert 'BAR' in env
+ def test_substitution_notfound_issue515(tmpdir, newconfig):
+ config = newconfig("""
+ [tox]
+ envlist = standard-greeting
+
+ [testenv:standard-greeting]
+ commands =
+ python -c 'print("Hello, world!")'
+
+ [testenv:custom-greeting]
+ passenv =
+ NAME
+ commands =
+ python -c 'print("Hello, {env:NAME}!")'
+ """)
+ conf = config.envconfigs['standard-greeting']
+ assert conf.commands == [
+ ['python', '-c', 'print("Hello, world!")'],
+ ]
+
+ @pytest.mark.xfail(raises=AssertionError, reason="issue #301")
def test_substitution_nested_env_defaults_issue301(tmpdir, newconfig, monkeypatch):
monkeypatch.setenv("IGNORE_STATIC_DEFAULT", "env")
monkeypatch.setenv("IGNORE_DYNAMIC_DEFAULT", "env")
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 2
}
|
2.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest>=2.3.5",
"pytest-timeout",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
distlib==0.3.9
filelock==3.4.1
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
platformdirs==2.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytest-timeout==2.1.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
-e git+https://github.com/tox-dev/tox.git@6889c81a4c31fedeb22af056e9f2b7e8f86f00cf#egg=tox
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
virtualenv==20.17.1
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: tox
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- distlib==0.3.9
- filelock==3.4.1
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- platformdirs==2.4.0
- pytest-timeout==2.1.0
- virtualenv==20.17.1
prefix: /opt/conda/envs/tox
|
[
"tests/test_config.py::TestConfigTestEnv::test_substitution_notfound_issue515"
] |
[
"tests/test_config.py::TestVenvConfig::test_force_dep_with_url",
"tests/test_config.py::TestIniParser::test_getbool"
] |
[
"tests/test_config.py::TestVenvConfig::test_config_parsing_minimal",
"tests/test_config.py::TestVenvConfig::test_config_parsing_multienv",
"tests/test_config.py::TestVenvConfig::test_envdir_set_manually",
"tests/test_config.py::TestVenvConfig::test_envdir_set_manually_with_substitutions",
"tests/test_config.py::TestVenvConfig::test_force_dep_version",
"tests/test_config.py::TestVenvConfig::test_is_same_dep",
"tests/test_config.py::TestConfigPlatform::test_config_parse_platform",
"tests/test_config.py::TestConfigPlatform::test_config_parse_platform_rex",
"tests/test_config.py::TestConfigPlatform::test_config_parse_platform_with_factors[win]",
"tests/test_config.py::TestConfigPlatform::test_config_parse_platform_with_factors[lin]",
"tests/test_config.py::TestConfigPackage::test_defaults",
"tests/test_config.py::TestConfigPackage::test_defaults_distshare",
"tests/test_config.py::TestConfigPackage::test_defaults_changed_dir",
"tests/test_config.py::TestConfigPackage::test_project_paths",
"tests/test_config.py::TestParseconfig::test_search_parents",
"tests/test_config.py::TestParseconfig::test_explicit_config_path",
"tests/test_config.py::test_get_homedir",
"tests/test_config.py::TestGetcontextname::test_blank",
"tests/test_config.py::TestGetcontextname::test_jenkins",
"tests/test_config.py::TestGetcontextname::test_hudson_legacy",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section_multiline",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_substitution_from_other_section_posargs",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_section_and_posargs_substitution",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_env_substitution",
"tests/test_config.py::TestIniParserAgainstCommandsKey::test_command_env_substitution_global",
"tests/test_config.py::TestIniParser::test_getstring_single",
"tests/test_config.py::TestIniParser::test_missing_substitution",
"tests/test_config.py::TestIniParser::test_getstring_fallback_sections",
"tests/test_config.py::TestIniParser::test_getstring_substitution",
"tests/test_config.py::TestIniParser::test_getlist",
"tests/test_config.py::TestIniParser::test_getdict",
"tests/test_config.py::TestIniParser::test_getstring_environment_substitution",
"tests/test_config.py::TestIniParser::test_getstring_environment_substitution_with_default",
"tests/test_config.py::TestIniParser::test_value_matches_section_substituion",
"tests/test_config.py::TestIniParser::test_value_doesn_match_section_substitution",
"tests/test_config.py::TestIniParser::test_getstring_other_section_substitution",
"tests/test_config.py::TestIniParser::test_argvlist",
"tests/test_config.py::TestIniParser::test_argvlist_windows_escaping",
"tests/test_config.py::TestIniParser::test_argvlist_multiline",
"tests/test_config.py::TestIniParser::test_argvlist_quoting_in_command",
"tests/test_config.py::TestIniParser::test_argvlist_comment_after_command",
"tests/test_config.py::TestIniParser::test_argvlist_command_contains_hash",
"tests/test_config.py::TestIniParser::test_argvlist_positional_substitution",
"tests/test_config.py::TestIniParser::test_argvlist_quoted_posargs",
"tests/test_config.py::TestIniParser::test_argvlist_posargs_with_quotes",
"tests/test_config.py::TestIniParser::test_positional_arguments_are_only_replaced_when_standing_alone",
"tests/test_config.py::TestIniParser::test_posargs_are_added_escaped_issue310",
"tests/test_config.py::TestIniParser::test_substitution_with_multiple_words",
"tests/test_config.py::TestIniParser::test_getargv",
"tests/test_config.py::TestIniParser::test_getpath",
"tests/test_config.py::TestIniParserPrefix::test_basic_section_access",
"tests/test_config.py::TestIniParserPrefix::test_fallback_sections",
"tests/test_config.py::TestIniParserPrefix::test_value_matches_prefixed_section_substituion",
"tests/test_config.py::TestIniParserPrefix::test_value_doesn_match_prefixed_section_substitution",
"tests/test_config.py::TestIniParserPrefix::test_other_section_substitution",
"tests/test_config.py::TestConfigTestEnv::test_commentchars_issue33",
"tests/test_config.py::TestConfigTestEnv::test_defaults",
"tests/test_config.py::TestConfigTestEnv::test_sitepackages_switch",
"tests/test_config.py::TestConfigTestEnv::test_installpkg_tops_develop",
"tests/test_config.py::TestConfigTestEnv::test_specific_command_overrides",
"tests/test_config.py::TestConfigTestEnv::test_whitelist_externals",
"tests/test_config.py::TestConfigTestEnv::test_changedir",
"tests/test_config.py::TestConfigTestEnv::test_ignore_errors",
"tests/test_config.py::TestConfigTestEnv::test_envbindir",
"tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[jython]",
"tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[pypy]",
"tests/test_config.py::TestConfigTestEnv::test_envbindir_jython[pypy3]",
"tests/test_config.py::TestConfigTestEnv::test_passenv_as_multiline_list[win32]",
"tests/test_config.py::TestConfigTestEnv::test_passenv_as_multiline_list[linux2]",
"tests/test_config.py::TestConfigTestEnv::test_passenv_as_space_separated_list[win32]",
"tests/test_config.py::TestConfigTestEnv::test_passenv_as_space_separated_list[linux2]",
"tests/test_config.py::TestConfigTestEnv::test_passenv_with_factor",
"tests/test_config.py::TestConfigTestEnv::test_passenv_from_global_env",
"tests/test_config.py::TestConfigTestEnv::test_passenv_glob_from_global_env",
"tests/test_config.py::TestConfigTestEnv::test_changedir_override",
"tests/test_config.py::TestConfigTestEnv::test_install_command_setting",
"tests/test_config.py::TestConfigTestEnv::test_install_command_must_contain_packages",
"tests/test_config.py::TestConfigTestEnv::test_install_command_substitutions",
"tests/test_config.py::TestConfigTestEnv::test_pip_pre",
"tests/test_config.py::TestConfigTestEnv::test_pip_pre_cmdline_override",
"tests/test_config.py::TestConfigTestEnv::test_simple",
"tests/test_config.py::TestConfigTestEnv::test_substitution_error",
"tests/test_config.py::TestConfigTestEnv::test_substitution_defaults",
"tests/test_config.py::TestConfigTestEnv::test_substitution_notfound_issue246",
"tests/test_config.py::TestConfigTestEnv::test_substitution_positional",
"tests/test_config.py::TestConfigTestEnv::test_substitution_noargs_issue240",
"tests/test_config.py::TestConfigTestEnv::test_substitution_double",
"tests/test_config.py::TestConfigTestEnv::test_posargs_backslashed_or_quoted",
"tests/test_config.py::TestConfigTestEnv::test_rewrite_posargs",
"tests/test_config.py::TestConfigTestEnv::test_rewrite_simple_posargs",
"tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_testenv[envlist0-deps0]",
"tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_testenv[envlist1-deps1]",
"tests/test_config.py::TestConfigTestEnv::test_take_dependencies_from_other_section",
"tests/test_config.py::TestConfigTestEnv::test_multilevel_substitution",
"tests/test_config.py::TestConfigTestEnv::test_recursive_substitution_cycle_fails",
"tests/test_config.py::TestConfigTestEnv::test_single_value_from_other_secton",
"tests/test_config.py::TestConfigTestEnv::test_factors",
"tests/test_config.py::TestConfigTestEnv::test_factor_ops",
"tests/test_config.py::TestConfigTestEnv::test_default_factors",
"tests/test_config.py::TestConfigTestEnv::test_factors_in_boolean",
"tests/test_config.py::TestConfigTestEnv::test_factors_in_setenv",
"tests/test_config.py::TestConfigTestEnv::test_factor_use_not_checked",
"tests/test_config.py::TestConfigTestEnv::test_factors_groups_touch",
"tests/test_config.py::TestConfigTestEnv::test_period_in_factor",
"tests/test_config.py::TestConfigTestEnv::test_ignore_outcome",
"tests/test_config.py::TestGlobalOptions::test_notest",
"tests/test_config.py::TestGlobalOptions::test_verbosity",
"tests/test_config.py::TestGlobalOptions::test_substitution_jenkins_default",
"tests/test_config.py::TestGlobalOptions::test_substitution_jenkins_context",
"tests/test_config.py::TestGlobalOptions::test_sdist_specification",
"tests/test_config.py::TestGlobalOptions::test_env_selection",
"tests/test_config.py::TestGlobalOptions::test_py_venv",
"tests/test_config.py::TestGlobalOptions::test_default_environments",
"tests/test_config.py::TestGlobalOptions::test_envlist_expansion",
"tests/test_config.py::TestGlobalOptions::test_envlist_cross_product",
"tests/test_config.py::TestGlobalOptions::test_envlist_multiline",
"tests/test_config.py::TestGlobalOptions::test_minversion",
"tests/test_config.py::TestGlobalOptions::test_skip_missing_interpreters_true",
"tests/test_config.py::TestGlobalOptions::test_skip_missing_interpreters_false",
"tests/test_config.py::TestGlobalOptions::test_defaultenv_commandline",
"tests/test_config.py::TestGlobalOptions::test_defaultenv_partial_override",
"tests/test_config.py::TestHashseedOption::test_default",
"tests/test_config.py::TestHashseedOption::test_passing_integer",
"tests/test_config.py::TestHashseedOption::test_passing_string",
"tests/test_config.py::TestHashseedOption::test_passing_empty_string",
"tests/test_config.py::TestHashseedOption::test_setenv",
"tests/test_config.py::TestHashseedOption::test_noset",
"tests/test_config.py::TestHashseedOption::test_noset_with_setenv",
"tests/test_config.py::TestHashseedOption::test_one_random_hashseed",
"tests/test_config.py::TestHashseedOption::test_setenv_in_one_testenv",
"tests/test_config.py::TestSetenv::test_getdict_lazy",
"tests/test_config.py::TestSetenv::test_getdict_lazy_update",
"tests/test_config.py::TestSetenv::test_setenv_uses_os_environ",
"tests/test_config.py::TestSetenv::test_setenv_default_os_environ",
"tests/test_config.py::TestSetenv::test_setenv_uses_other_setenv",
"tests/test_config.py::TestSetenv::test_setenv_recursive_direct",
"tests/test_config.py::TestSetenv::test_setenv_overrides",
"tests/test_config.py::TestSetenv::test_setenv_with_envdir_and_basepython",
"tests/test_config.py::TestSetenv::test_setenv_ordering_1",
"tests/test_config.py::TestSetenv::test_setenv_cross_section_subst_issue294",
"tests/test_config.py::TestSetenv::test_setenv_cross_section_subst_twice",
"tests/test_config.py::TestSetenv::test_setenv_cross_section_mixed",
"tests/test_config.py::TestIndexServer::test_indexserver",
"tests/test_config.py::TestIndexServer::test_parse_indexserver",
"tests/test_config.py::TestIndexServer::test_multiple_homedir_relative_local_indexservers",
"tests/test_config.py::TestConfigConstSubstitutions::test_replace_pathsep_unix[:]",
"tests/test_config.py::TestConfigConstSubstitutions::test_replace_pathsep_unix[;]",
"tests/test_config.py::TestConfigConstSubstitutions::test_pathsep_regex",
"tests/test_config.py::TestParseEnv::test_parse_recreate",
"tests/test_config.py::TestCmdInvocation::test_help",
"tests/test_config.py::TestCmdInvocation::test_version",
"tests/test_config.py::TestCmdInvocation::test_listenvs",
"tests/test_config.py::TestCmdInvocation::test_listenvs_verbose_description",
"tests/test_config.py::TestCmdInvocation::test_listenvs_all",
"tests/test_config.py::TestCmdInvocation::test_listenvs_all_verbose_description",
"tests/test_config.py::TestCmdInvocation::test_listenvs_all_verbose_description_no_additional_environments",
"tests/test_config.py::TestCmdInvocation::test_config_specific_ini",
"tests/test_config.py::TestCmdInvocation::test_no_tox_ini",
"tests/test_config.py::TestCmdInvocation::test_override_workdir",
"tests/test_config.py::TestCmdInvocation::test_showconfig_with_force_dep_version",
"tests/test_config.py::test_env_spec[-e",
"tests/test_config.py::TestCommandParser::test_command_parser_for_word",
"tests/test_config.py::TestCommandParser::test_command_parser_for_posargs",
"tests/test_config.py::TestCommandParser::test_command_parser_for_multiple_words",
"tests/test_config.py::TestCommandParser::test_command_parser_for_substitution_with_spaces",
"tests/test_config.py::TestCommandParser::test_command_parser_with_complex_word_set",
"tests/test_config.py::TestCommandParser::test_command_with_runs_of_whitespace",
"tests/test_config.py::TestCommandParser::test_command_with_split_line_in_subst_arguments",
"tests/test_config.py::TestCommandParser::test_command_parsing_for_issue_10"
] |
[] |
MIT License
| 1,271 |
|
auth0__auth0-python-64
|
0d7decce20e04703d11a614bffc8f9d9f6e9723e
|
2017-05-19 09:54:07
|
a9fd8e39c6aee52bf1654d96c494287121d9e141
|
diff --git a/auth0/v3/authentication/base.py b/auth0/v3/authentication/base.py
index b4ccd1d..778912c 100644
--- a/auth0/v3/authentication/base.py
+++ b/auth0/v3/authentication/base.py
@@ -19,8 +19,8 @@ class AuthenticationBase(object):
except ValueError:
return response.text
else:
- if 'error' in text:
- raise Auth0Error(status_code=text['error'],
- error_code=text['error'],
- message=text['error_description'])
+ if response.status_code is None or response.status_code >= 400:
+ raise Auth0Error(status_code=response.status_code,
+ error_code=text.get('error', ''),
+ message=text.get('error_description', ''))
return text
|
Auth0Error not being raised due to inconsistent API error responses
Currently `Auth0Error` is raised whenever the API response contains an `error` key in the response JSON. Unfortunately at least one endpoint (`/dbconnections/signup`) returns inconsistent error messages (that do not always contain the `error` key) for different scenarios and as a result `Auth0Error` is not raised when an error occurs.
Examples of inconsistent responses:
* when making a signup request with an email that is already registered:
```
{
"code": "user_exists",
"description": "The user already exists.",
"name": "BadRequestError",
"statusCode": 400
}
```
* when making a request with an invalid `client_id` (with public signup disabled)
```
{
"name": "NotFoundError",
"statusCode": 404
}
```
* when making a request with an invalid password (with password strength enabled)
```
{
"code": "invalid_password",
"description": {
"rules": [
{
"code": "lengthAtLeast",
"format": [
6
],
"message": "At least %d characters in length",
"verified": false
}
],
"verified": false
},
"message": "Password is too weak",
"name": "PasswordStrengthError",
"policy": "* At least 6 characters in length",
"statusCode": 400
}
```
* when making a request with missing password
```
{
"error": "password is required"
}
```
The last example highlights a related issue. Even though there is an `error` key, a `KeyError` exception will ultimately occur because `AuthenticationBase._process_response` assumes the additional existence of an `error_description` key when creating the `Auth0Error` and setting its message.
|
auth0/auth0-python
|
diff --git a/auth0/v3/test/authentication/test_base.py b/auth0/v3/test/authentication/test_base.py
index c058864..d6539c8 100644
--- a/auth0/v3/test/authentication/test_base.py
+++ b/auth0/v3/test/authentication/test_base.py
@@ -10,6 +10,7 @@ class TestBase(unittest.TestCase):
def test_post(self, mock_post):
ab = AuthenticationBase()
+ mock_post.return_value.status_code = 200
mock_post.return_value.text = '{"x": "y"}'
data = ab.post('the-url', data={'a': 'b'}, headers={'c': 'd'})
@@ -23,12 +24,14 @@ class TestBase(unittest.TestCase):
def test_post_error(self, mock_post):
ab = AuthenticationBase()
- mock_post.return_value.text = '{"error": "e0",' \
- '"error_description": "desc"}'
+ for error_status in [400, 500, None]:
+ mock_post.return_value.status_code = error_status
+ mock_post.return_value.text = '{"error": "e0",' \
+ '"error_description": "desc"}'
- with self.assertRaises(Auth0Error) as context:
- data = ab.post('the-url', data={'a': 'b'}, headers={'c': 'd'})
+ with self.assertRaises(Auth0Error) as context:
+ data = ab.post('the-url', data={'a': 'b'}, headers={'c': 'd'})
- self.assertEqual(context.exception.status_code, 'e0')
- self.assertEqual(context.exception.error_code, 'e0')
- self.assertEqual(context.exception.message, 'desc')
+ self.assertEqual(context.exception.status_code, error_status)
+ self.assertEqual(context.exception.error_code, 'e0')
+ self.assertEqual(context.exception.message, 'desc')
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 1
}
|
3.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/auth0/auth0-python.git@0d7decce20e04703d11a614bffc8f9d9f6e9723e#egg=auth0_python
coverage==7.8.0
exceptiongroup==1.2.2
iniconfig==2.1.0
mock==1.3.0
packaging==24.2
pbr==6.1.1
pluggy==1.5.0
pytest==8.3.5
pytest-cov==6.0.0
requests==2.8.1
six==1.17.0
tomli==2.2.1
|
name: auth0-python
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==7.8.0
- exceptiongroup==1.2.2
- iniconfig==2.1.0
- mock==1.3.0
- packaging==24.2
- pbr==6.1.1
- pluggy==1.5.0
- pytest==8.3.5
- pytest-cov==6.0.0
- requests==2.8.1
- six==1.17.0
- tomli==2.2.1
prefix: /opt/conda/envs/auth0-python
|
[
"auth0/v3/test/authentication/test_base.py::TestBase::test_post_error"
] |
[] |
[
"auth0/v3/test/authentication/test_base.py::TestBase::test_post"
] |
[] |
MIT License
| 1,274 |
|
zhmcclient__python-zhmcclient-286
|
077e1ada5272d57143f1d453568ac5dd9daa6a8c
|
2017-05-19 14:18:55
|
9f0ff2df0f65b934e2e75b1bfdf0635677416ac7
|
GitCop: There were the following issues with your Pull Request
* Commit: a2e553b013c36998d69c086281ac2156d71481d3
* Your commit message body contains a line that is longer than 80 characters
Guidelines are available at https://github.com/zhmcclient/python-zhmcclient/blob/master/CONTRIBUTING.rst
---
This message was auto-generated by https://gitcop.com
GitCop: There were the following issues with your Pull Request
* Commit: 56a1eaed0dc89da51487a141e15dc7912f86a9af
* Your commit message body contains a line that is longer than 80 characters
Guidelines are available at https://github.com/zhmcclient/python-zhmcclient/blob/master/CONTRIBUTING.rst
---
This message was auto-generated by https://gitcop.com
|
diff --git a/docs/changes.rst b/docs/changes.rst
index f6dccff..51adb06 100755
--- a/docs/changes.rst
+++ b/docs/changes.rst
@@ -27,6 +27,10 @@ Released: not yet
**Incompatible changes:**
+* Changed the return value of ``TimeStatsKeeper.snapshot()`` from a list of
+ key/value tuples to a dictionary. This is more flexible and reduces the
+ number of data structure conversions in different scenarios. See issue #269.
+
**Deprecations:**
**Bug fixes:**
diff --git a/zhmcclient/_timestats.py b/zhmcclient/_timestats.py
index e0d9c3d..07dc648 100644
--- a/zhmcclient/_timestats.py
+++ b/zhmcclient/_timestats.py
@@ -280,13 +280,13 @@ class TimeStatsKeeper(object):
Returns:
- : A list of tuples (name, stats) with:
+ dict: A dictionary of the time statistics by operation, where:
- - name (:term:`string`): Name of the operation
- - stats (:class:`~zhmcclient.TimeStats`): Time statistics for the
+ - key (:term:`string`): Name of the operation
+ - value (:class:`~zhmcclient.TimeStats`): Time statistics for the
operation
"""
- return copy.deepcopy(self._time_stats).items()
+ return copy.deepcopy(self._time_stats)
def __str__(self):
"""
@@ -303,7 +303,8 @@ class TimeStatsKeeper(object):
ret = "Time statistics (times in seconds):\n"
if self.enabled:
ret += "Count Average Minimum Maximum Operation name\n"
- snapshot_by_avg = sorted(self.snapshot(),
+ stats_dict = self.snapshot()
+ snapshot_by_avg = sorted(stats_dict.items(),
key=lambda item: item[1].avg_time,
reverse=True)
for name, stats in snapshot_by_avg:
|
TimeStatsKeeper.snapshot() result not very handy
The `TimeStatsKeeper.snapshot()` method returns a list of tuples (op_name, TimeStats), which it produces by appliying the `items()` method on the internal dictionary.
Most uses of the snapshot I have seen so far, transform that back into a dictionary by using `dict(snapshot)`.
It would be more efficient and more convenient if snapshot() simply returned (a copy of) the dictionary directly.
Note that this would be an incompatible change.
|
zhmcclient/python-zhmcclient
|
diff --git a/tests/unit/test_timestats.py b/tests/unit/test_timestats.py
index 1155489..1733f6f 100755
--- a/tests/unit/test_timestats.py
+++ b/tests/unit/test_timestats.py
@@ -142,7 +142,9 @@ class TimeStatsTests(unittest.TestCase):
stats = keeper.get_stats('foo')
dur = measure(stats, duration)
- for _, stats in keeper.snapshot():
+ stats_dict = keeper.snapshot()
+ for op_name in stats_dict:
+ stats = stats_dict[op_name]
self.assertEqual(stats.count, 1)
self.assertLess(time_abs_delta(stats.avg_time, dur), delta,
"avg time: actual: %f, expected: %f, delta: %f" %
@@ -174,7 +176,9 @@ class TimeStatsTests(unittest.TestCase):
time.sleep(duration)
stats.end()
- for _, stats in keeper.snapshot():
+ stats_dict = keeper.snapshot()
+ for op_name in stats_dict:
+ stats = stats_dict[op_name]
self.assertEqual(stats.count, 0)
self.assertEqual(stats.avg_time, 0)
self.assertEqual(stats.min_time, float('inf'))
@@ -196,7 +200,7 @@ class TimeStatsTests(unittest.TestCase):
stats.end()
# take the snapshot
- snapshot = keeper.snapshot()
+ snap_stats_dict = keeper.snapshot()
# produce a second data item
stats.begin()
@@ -204,7 +208,8 @@ class TimeStatsTests(unittest.TestCase):
stats.end()
# verify that only the first data item is in the snapshot
- for _, snap_stats in snapshot:
+ for op_name in snap_stats_dict:
+ snap_stats = snap_stats_dict[op_name]
self.assertEqual(snap_stats.count, 1)
# verify that both data items are in the original stats object
@@ -230,7 +235,9 @@ class TimeStatsTests(unittest.TestCase):
max_dur = max(m_durations)
avg_dur = sum(m_durations) / float(count)
- for _, stats in keeper.snapshot():
+ stats_dict = keeper.snapshot()
+ for op_name in stats_dict:
+ stats = stats_dict[op_name]
self.assertEqual(stats.count, 3)
self.assertLess(time_abs_delta(stats.avg_time, avg_dur), delta,
"avg time: actual: %f, expected: %f, delta: %f" %
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 2
}
|
0.13
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-xdist"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
click==8.0.4
click-repl==0.3.0
click-spinner==0.1.10
coverage==6.2
decorator==5.1.1
docopt==0.6.2
execnet==1.9.0
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
pbr==6.1.1
pluggy==1.0.0
progressbar2==3.55.0
prompt-toolkit==3.0.36
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
python-utils==3.5.2
requests==2.27.1
six==1.17.0
stomp.py==8.1.0
tabulate==0.8.10
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
wcwidth==0.2.13
websocket-client==1.3.1
-e git+https://github.com/zhmcclient/python-zhmcclient.git@077e1ada5272d57143f1d453568ac5dd9daa6a8c#egg=zhmcclient
zipp==3.6.0
|
name: python-zhmcclient
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- charset-normalizer==2.0.12
- click==8.0.4
- click-repl==0.3.0
- click-spinner==0.1.10
- coverage==6.2
- decorator==5.1.1
- docopt==0.6.2
- execnet==1.9.0
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- packaging==21.3
- pbr==6.1.1
- pluggy==1.0.0
- progressbar2==3.55.0
- prompt-toolkit==3.0.36
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-xdist==3.0.2
- python-utils==3.5.2
- requests==2.27.1
- six==1.17.0
- stomp-py==8.1.0
- tabulate==0.8.10
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- wcwidth==0.2.13
- websocket-client==1.3.1
- zipp==3.6.0
prefix: /opt/conda/envs/python-zhmcclient
|
[
"tests/unit/test_timestats.py::TimeStatsTests::test_measure_avg_min_max",
"tests/unit/test_timestats.py::TimeStatsTests::test_measure_enabled",
"tests/unit/test_timestats.py::TimeStatsTests::test_snapshot"
] |
[] |
[
"tests/unit/test_timestats.py::TimeStatsTests::test_enabling",
"tests/unit/test_timestats.py::TimeStatsTests::test_get",
"tests/unit/test_timestats.py::TimeStatsTests::test_measure_disabled",
"tests/unit/test_timestats.py::TimeStatsTests::test_str_disabled",
"tests/unit/test_timestats.py::TimeStatsTests::test_str_empty"
] |
[] |
Apache License 2.0
| 1,275 |
watson-developer-cloud__python-sdk-208
|
13290dc52276d56ec04bf4eb19f21669d8ca3828
|
2017-05-19 22:05:31
|
f0fda953cf81204d2bf11d61d1e792292ced0d6f
|
diff --git a/watson_developer_cloud/speech_to_text_v1.py b/watson_developer_cloud/speech_to_text_v1.py
index e849ad67..c2f717a6 100644
--- a/watson_developer_cloud/speech_to_text_v1.py
+++ b/watson_developer_cloud/speech_to_text_v1.py
@@ -118,7 +118,7 @@ class SpeechToTextV1(WatsonDeveloperCloudService):
headers = {'Content-Type': 'application/octet-stream'}
- return self.request(method='GET',
+ return self.request(method='POST',
url=url.format(customization_id,
corpus_name),
headers=headers,
|
SpeechToTextV1.add_corpus() uses wrong http method (GET, should use POST)
Currently, using `add_corpus` will break with a `WatsonException: Unknown error` error. This is due to the method using the wrong HTTP method (GET, instead of POST). The tests don't catch this because the assertion in `test_custom_corpora` only checks the number of requests made and not the details of those requests.
I have a patch that should be ready soon.
|
watson-developer-cloud/python-sdk
|
diff --git a/test/test_speech_to_text_v1.py b/test/test_speech_to_text_v1.py
index 2334f4b5..3153dcdf 100755
--- a/test/test_speech_to_text_v1.py
+++ b/test/test_speech_to_text_v1.py
@@ -106,49 +106,48 @@ def test_custom_model():
assert len(responses.calls) == 5
[email protected]
def test_custom_corpora():
corpora_url = 'https://stream.watsonplatform.net/speech-to-text/api/v1/customizations/{0}/corpora'
get_corpora_url = '{0}/{1}'.format(corpora_url.format('customid'),'corpus')
- responses.add(responses.GET, corpora_url.format('customid'),
- body='{"get response": "yep"}', status=200,
- content_type='application/json')
+ with responses.RequestsMock(assert_all_requests_are_fired=True) as rsps:
+ rsps.add(responses.GET, corpora_url.format('customid'),
+ body='{"get response": "yep"}', status=200,
+ content_type='application/json')
- responses.add(responses.POST, get_corpora_url,
+ rsps.add(responses.POST, get_corpora_url,
body='{"get response": "yep"}',
status=200,
content_type='application/json')
- responses.add(responses.GET, get_corpora_url,
+ rsps.add(responses.GET, get_corpora_url,
body='{"get response": "yep"}',
status=200,
content_type='application/json')
- responses.add(responses.DELETE, get_corpora_url,
- body='{"get response": "yep"}',
- status=200,
- content_type='application/json')
+ rsps.add(responses.DELETE, get_corpora_url,
+ body='{"get response": "yep"}',
+ status=200,
+ content_type='application/json')
- speech_to_text = watson_developer_cloud.SpeechToTextV1(
- username="username", password="password")
+ speech_to_text = watson_developer_cloud.SpeechToTextV1(
+ username="username", password="password")
- speech_to_text.list_corpora(customization_id='customid')
+ speech_to_text.list_corpora(customization_id='customid')
- file_path = '../resources/speech_to_text/corpus-short-1.txt'
- full_path = os.path.join(os.path.dirname(__file__), file_path)
- with open(full_path) as corpus_file:
- speech_to_text.add_corpus(customization_id='customid',
- corpus_name="corpus", file_data=corpus_file)
+ file_path = '../resources/speech_to_text/corpus-short-1.txt'
+ full_path = os.path.join(os.path.dirname(__file__), file_path)
+ with open(full_path) as corpus_file:
+ speech_to_text.add_corpus(customization_id='customid',
+ corpus_name="corpus", file_data=corpus_file)
- speech_to_text.get_corpus(customization_id='customid',
- corpus_name='corpus')
+ speech_to_text.get_corpus(customization_id='customid',
+ corpus_name='corpus')
- speech_to_text.delete_corpus(customization_id='customid',
- corpus_name='corpus')
+ speech_to_text.delete_corpus(customization_id='customid',
+ corpus_name='corpus')
- assert len(responses.calls) == 4
@responses.activate
def test_custom_words():
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 1
}
|
0.26
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"responses",
"python_dotenv"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
cffi==1.15.1
charset-normalizer==2.0.12
cryptography==40.0.2
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pycparser==2.21
pyOpenSSL==23.2.0
pyparsing==3.1.4
pysolr==3.10.0
pytest==7.0.1
python-dotenv==0.20.0
requests==2.27.1
responses==0.17.0
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
-e git+https://github.com/watson-developer-cloud/python-sdk.git@13290dc52276d56ec04bf4eb19f21669d8ca3828#egg=watson_developer_cloud
zipp==3.6.0
|
name: python-sdk
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- argparse==1.4.0
- attrs==22.2.0
- cffi==1.15.1
- charset-normalizer==2.0.12
- cryptography==40.0.2
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pycparser==2.21
- pyopenssl==23.2.0
- pyparsing==3.1.4
- pysolr==3.10.0
- pytest==7.0.1
- python-dotenv==0.20.0
- requests==2.27.1
- responses==0.17.0
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- zipp==3.6.0
prefix: /opt/conda/envs/python-sdk
|
[
"test/test_speech_to_text_v1.py::test_custom_corpora"
] |
[] |
[
"test/test_speech_to_text_v1.py::test_success",
"test/test_speech_to_text_v1.py::test_get_model",
"test/test_speech_to_text_v1.py::test_custom_model",
"test/test_speech_to_text_v1.py::test_custom_words"
] |
[] |
Apache License 2.0
| 1,277 |
|
tornadoweb__tornado-2045
|
06be57c11f98b24ce0f6ee2d04f0cfe8bfdb3b4d
|
2017-05-20 16:16:33
|
03f13800e854a6fc9e6efa2168e694d9599348bd
|
diff --git a/tornado/web.py b/tornado/web.py
index 132f42dd..d79889fa 100644
--- a/tornado/web.py
+++ b/tornado/web.py
@@ -319,7 +319,10 @@ class RequestHandler(object):
if reason is not None:
self._reason = escape.native_str(reason)
else:
- self._reason = httputil.responses.get(status_code, "Unknown")
+ try:
+ self._reason = httputil.responses[status_code]
+ except KeyError:
+ raise ValueError("unknown status code %d" % status_code)
def get_status(self):
"""Returns the status code for our response."""
@@ -1558,7 +1561,11 @@ class RequestHandler(object):
# send a response.
return
if isinstance(e, HTTPError):
- self.send_error(e.status_code, exc_info=sys.exc_info())
+ if e.status_code not in httputil.responses and not e.reason:
+ gen_log.error("Bad HTTP status code: %d", e.status_code)
+ self.send_error(500, exc_info=sys.exc_info())
+ else:
+ self.send_error(e.status_code, exc_info=sys.exc_info())
else:
self.send_error(500, exc_info=sys.exc_info())
diff --git a/tornado/websocket.py b/tornado/websocket.py
index 69437ee4..7600910c 100644
--- a/tornado/websocket.py
+++ b/tornado/websocket.py
@@ -764,10 +764,7 @@ class WebSocketProtocol13(WebSocketProtocol):
data = mask + _websocket_mask(mask, data)
frame += data
self._wire_bytes_out += len(frame)
- try:
- return self.stream.write(frame)
- except StreamClosedError:
- self._abort()
+ return self.stream.write(frame)
def write_message(self, message, binary=False):
"""Sends the given message to the client of this Web Socket."""
@@ -951,7 +948,10 @@ class WebSocketProtocol13(WebSocketProtocol):
self.close(self.handler.close_code)
elif opcode == 0x9:
# Ping
- self._write_frame(True, 0xA, data)
+ try:
+ self._write_frame(True, 0xA, data)
+ except StreamClosedError:
+ self._abort()
self._run_callback(self.handler.on_ping, data)
elif opcode == 0xA:
# Pong
@@ -972,7 +972,10 @@ class WebSocketProtocol13(WebSocketProtocol):
close_data = struct.pack('>H', code)
if reason is not None:
close_data += utf8(reason)
- self._write_frame(True, 0x8, close_data)
+ try:
+ self._write_frame(True, 0x8, close_data)
+ except StreamClosedError:
+ self._abort()
self.server_terminated = True
if self.client_terminated:
if self._waiting is not None:
|
websocket `yield connection.write_message()` throws BadYieldError
At present code such as:
yield connection.write_message(data)
will throw BadYieldError if called on a closed connection.
Documentation for WebSocketHandler.write_message says it was changed in 4.3 so that it " Returns a `.Future` which can be used for flow control." In fact it can return either a Future or None. It actually returns the result from the method WebSocketProtocol13._write_frame, and that ends with:
try:
return self.stream.write(frame)
except StreamClosedError:
self._abort()
so in the case where the stream is closed it will return None. It should instead use gen.Return() to send back None as the result.:
try:
return self.stream.write(frame)
except StreamClosedError:
self._abort()
raise gen.Return()
|
tornadoweb/tornado
|
diff --git a/tornado/test/web_test.py b/tornado/test/web_test.py
index de26c42e..d79ea52c 100644
--- a/tornado/test/web_test.py
+++ b/tornado/test/web_test.py
@@ -917,10 +917,6 @@ class ErrorResponseTest(WebTestCase):
self.assertEqual(response.code, 503)
self.assertTrue(b"503: Service Unavailable" in response.body)
- response = self.fetch("/default?status=435")
- self.assertEqual(response.code, 435)
- self.assertTrue(b"435: Unknown" in response.body)
-
def test_write_error(self):
with ExpectLog(app_log, "Uncaught exception"):
response = self.fetch("/write_error")
@@ -1493,9 +1489,9 @@ class StatusReasonTest(SimpleHandlerTestCase):
response = self.fetch("/?code=682&reason=Bar")
self.assertEqual(response.code, 682)
self.assertEqual(response.reason, "Bar")
- response = self.fetch("/?code=682")
- self.assertEqual(response.code, 682)
- self.assertEqual(response.reason, "Unknown")
+ with ExpectLog(app_log, 'Uncaught exception'):
+ response = self.fetch("/?code=682")
+ self.assertEqual(response.code, 500)
@wsgi_safe
diff --git a/tornado/test/websocket_test.py b/tornado/test/websocket_test.py
index d47a74e6..e0b5573d 100644
--- a/tornado/test/websocket_test.py
+++ b/tornado/test/websocket_test.py
@@ -7,6 +7,7 @@ import traceback
from tornado.concurrent import Future
from tornado import gen
from tornado.httpclient import HTTPError, HTTPRequest
+from tornado.iostream import StreamClosedError
from tornado.log import gen_log, app_log
from tornado.template import DictLoader
from tornado.testing import AsyncHTTPTestCase, gen_test, bind_unused_port, ExpectLog
@@ -50,7 +51,10 @@ class TestWebSocketHandler(WebSocketHandler):
class EchoHandler(TestWebSocketHandler):
def on_message(self, message):
- self.write_message(message, isinstance(message, bytes))
+ try:
+ self.write_message(message, isinstance(message, bytes))
+ except StreamClosedError:
+ pass
class ErrorInOnMessageHandler(TestWebSocketHandler):
@@ -327,6 +331,14 @@ class WebSocketTest(WebSocketBaseTestCase):
self.assertEqual(code, 1001)
self.assertEqual(reason, 'goodbye')
+ @gen_test
+ def test_write_after_close(self):
+ ws = yield self.ws_connect('/close_reason')
+ msg = yield ws.read_message()
+ self.assertIs(msg, None)
+ with self.assertRaises(StreamClosedError):
+ ws.write_message('hello')
+
@gen_test
def test_async_prepare(self):
# Previously, an async prepare method triggered a bug that would
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 2
}
|
4.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
-e git+https://github.com/tornadoweb/tornado.git@06be57c11f98b24ce0f6ee2d04f0cfe8bfdb3b4d#egg=tornado
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: tornado
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
prefix: /opt/conda/envs/tornado
|
[
"tornado/test/web_test.py::StatusReasonTest::test_status",
"tornado/test/websocket_test.py::WebSocketTest::test_write_after_close"
] |
[] |
[
"tornado/test/web_test.py::SecureCookieV1Test::test_arbitrary_bytes",
"tornado/test/web_test.py::SecureCookieV1Test::test_cookie_tampering_future_timestamp",
"tornado/test/web_test.py::SecureCookieV1Test::test_round_trip",
"tornado/test/web_test.py::SecureCookieV2Test::test_key_version_increment_version",
"tornado/test/web_test.py::SecureCookieV2Test::test_key_version_invalidate_version",
"tornado/test/web_test.py::SecureCookieV2Test::test_key_version_roundtrip",
"tornado/test/web_test.py::SecureCookieV2Test::test_key_version_roundtrip_differing_version",
"tornado/test/web_test.py::SecureCookieV2Test::test_round_trip",
"tornado/test/web_test.py::CookieTest::test_cookie_special_char",
"tornado/test/web_test.py::CookieTest::test_get_cookie",
"tornado/test/web_test.py::CookieTest::test_set_cookie",
"tornado/test/web_test.py::CookieTest::test_set_cookie_domain",
"tornado/test/web_test.py::CookieTest::test_set_cookie_expires_days",
"tornado/test/web_test.py::CookieTest::test_set_cookie_false_flags",
"tornado/test/web_test.py::CookieTest::test_set_cookie_max_age",
"tornado/test/web_test.py::CookieTest::test_set_cookie_overwrite",
"tornado/test/web_test.py::AuthRedirectTest::test_absolute_auth_redirect",
"tornado/test/web_test.py::AuthRedirectTest::test_relative_auth_redirect",
"tornado/test/web_test.py::ConnectionCloseTest::test_connection_close",
"tornado/test/web_test.py::RequestEncodingTest::test_error",
"tornado/test/web_test.py::RequestEncodingTest::test_group_encoding",
"tornado/test/web_test.py::RequestEncodingTest::test_group_question_mark",
"tornado/test/web_test.py::RequestEncodingTest::test_slashes",
"tornado/test/web_test.py::WSGISafeWebTest::test_decode_argument",
"tornado/test/web_test.py::WSGISafeWebTest::test_decode_argument_invalid_unicode",
"tornado/test/web_test.py::WSGISafeWebTest::test_decode_argument_plus",
"tornado/test/web_test.py::WSGISafeWebTest::test_get_argument",
"tornado/test/web_test.py::WSGISafeWebTest::test_get_body_arguments",
"tornado/test/web_test.py::WSGISafeWebTest::test_get_query_arguments",
"tornado/test/web_test.py::WSGISafeWebTest::test_header_injection",
"tornado/test/web_test.py::WSGISafeWebTest::test_multi_header",
"tornado/test/web_test.py::WSGISafeWebTest::test_no_gzip",
"tornado/test/web_test.py::WSGISafeWebTest::test_optional_path",
"tornado/test/web_test.py::WSGISafeWebTest::test_redirect",
"tornado/test/web_test.py::WSGISafeWebTest::test_reverse_url",
"tornado/test/web_test.py::WSGISafeWebTest::test_types",
"tornado/test/web_test.py::WSGISafeWebTest::test_uimodule_resources",
"tornado/test/web_test.py::WSGISafeWebTest::test_uimodule_unescaped",
"tornado/test/web_test.py::WSGISafeWebTest::test_web_redirect",
"tornado/test/web_test.py::WSGISafeWebTest::test_web_redirect_double_slash",
"tornado/test/web_test.py::NonWSGIWebTests::test_empty_flush",
"tornado/test/web_test.py::NonWSGIWebTests::test_flow_control",
"tornado/test/web_test.py::ErrorResponseTest::test_default",
"tornado/test/web_test.py::ErrorResponseTest::test_failed_write_error",
"tornado/test/web_test.py::ErrorResponseTest::test_write_error",
"tornado/test/web_test.py::StaticFileTest::test_absolute_static_url",
"tornado/test/web_test.py::StaticFileTest::test_absolute_version_exclusion",
"tornado/test/web_test.py::StaticFileTest::test_include_host_override",
"tornado/test/web_test.py::StaticFileTest::test_path_traversal_protection",
"tornado/test/web_test.py::StaticFileTest::test_relative_version_exclusion",
"tornado/test/web_test.py::StaticFileTest::test_root_static_path",
"tornado/test/web_test.py::StaticFileTest::test_static_304_if_modified_since",
"tornado/test/web_test.py::StaticFileTest::test_static_304_if_none_match",
"tornado/test/web_test.py::StaticFileTest::test_static_404",
"tornado/test/web_test.py::StaticFileTest::test_static_compressed_files",
"tornado/test/web_test.py::StaticFileTest::test_static_etag",
"tornado/test/web_test.py::StaticFileTest::test_static_files",
"tornado/test/web_test.py::StaticFileTest::test_static_head",
"tornado/test/web_test.py::StaticFileTest::test_static_head_range",
"tornado/test/web_test.py::StaticFileTest::test_static_if_modified_since_pre_epoch",
"tornado/test/web_test.py::StaticFileTest::test_static_if_modified_since_time_zone",
"tornado/test/web_test.py::StaticFileTest::test_static_invalid_range",
"tornado/test/web_test.py::StaticFileTest::test_static_range_if_none_match",
"tornado/test/web_test.py::StaticFileTest::test_static_unsatisfiable_range_invalid_start",
"tornado/test/web_test.py::StaticFileTest::test_static_unsatisfiable_range_zero_suffix",
"tornado/test/web_test.py::StaticFileTest::test_static_url",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range_end_edge",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range_full_file",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range_full_past_end",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range_neg_end",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range_partial_past_end",
"tornado/test/web_test.py::StaticDefaultFilenameTest::test_static_default_filename",
"tornado/test/web_test.py::StaticDefaultFilenameTest::test_static_default_redirect",
"tornado/test/web_test.py::StaticFileWithPathTest::test_serve",
"tornado/test/web_test.py::CustomStaticFileTest::test_serve",
"tornado/test/web_test.py::CustomStaticFileTest::test_static_url",
"tornado/test/web_test.py::HostMatchingTest::test_host_matching",
"tornado/test/web_test.py::DefaultHostMatchingTest::test_default_host_matching",
"tornado/test/web_test.py::NamedURLSpecGroupsTest::test_named_urlspec_groups",
"tornado/test/web_test.py::ClearHeaderTest::test_clear_header",
"tornado/test/web_test.py::Header204Test::test_204_headers",
"tornado/test/web_test.py::Header304Test::test_304_headers",
"tornado/test/web_test.py::DateHeaderTest::test_date_header",
"tornado/test/web_test.py::RaiseWithReasonTest::test_httperror_str",
"tornado/test/web_test.py::RaiseWithReasonTest::test_httperror_str_from_httputil",
"tornado/test/web_test.py::RaiseWithReasonTest::test_raise_with_reason",
"tornado/test/web_test.py::ErrorHandlerXSRFTest::test_404_xsrf",
"tornado/test/web_test.py::ErrorHandlerXSRFTest::test_error_xsrf",
"tornado/test/web_test.py::GzipTestCase::test_gzip",
"tornado/test/web_test.py::GzipTestCase::test_gzip_not_requested",
"tornado/test/web_test.py::GzipTestCase::test_gzip_static",
"tornado/test/web_test.py::GzipTestCase::test_vary_already_present",
"tornado/test/web_test.py::GzipTestCase::test_vary_already_present_multiple",
"tornado/test/web_test.py::PathArgsInPrepareTest::test_kw",
"tornado/test/web_test.py::PathArgsInPrepareTest::test_pos",
"tornado/test/web_test.py::ClearAllCookiesTest::test_clear_all_cookies",
"tornado/test/web_test.py::ExceptionHandlerTest::test_http_error",
"tornado/test/web_test.py::ExceptionHandlerTest::test_known_error",
"tornado/test/web_test.py::ExceptionHandlerTest::test_unknown_error",
"tornado/test/web_test.py::BuggyLoggingTest::test_buggy_log_exception",
"tornado/test/web_test.py::UIMethodUIModuleTest::test_ui_method",
"tornado/test/web_test.py::GetArgumentErrorTest::test_catch_error",
"tornado/test/web_test.py::MultipleExceptionTest::test_multi_exception",
"tornado/test/web_test.py::SetLazyPropertiesTest::test_set_properties",
"tornado/test/web_test.py::GetCurrentUserTest::test_get_current_user_from_ui_module_is_lazy",
"tornado/test/web_test.py::GetCurrentUserTest::test_get_current_user_from_ui_module_works",
"tornado/test/web_test.py::GetCurrentUserTest::test_get_current_user_works",
"tornado/test/web_test.py::UnimplementedHTTPMethodsTest::test_unimplemented_standard_methods",
"tornado/test/web_test.py::UnimplementedNonStandardMethodsTest::test_unimplemented_other",
"tornado/test/web_test.py::UnimplementedNonStandardMethodsTest::test_unimplemented_patch",
"tornado/test/web_test.py::AllHTTPMethodsTest::test_standard_methods",
"tornado/test/web_test.py::PatchMethodTest::test_other",
"tornado/test/web_test.py::PatchMethodTest::test_patch",
"tornado/test/web_test.py::FinishInPrepareTest::test_finish_in_prepare",
"tornado/test/web_test.py::Default404Test::test_404",
"tornado/test/web_test.py::Custom404Test::test_404",
"tornado/test/web_test.py::DefaultHandlerArgumentsTest::test_403",
"tornado/test/web_test.py::HandlerByNameTest::test_handler_by_name",
"tornado/test/web_test.py::StreamingRequestBodyTest::test_close_during_upload",
"tornado/test/web_test.py::StreamingRequestBodyTest::test_early_return",
"tornado/test/web_test.py::StreamingRequestBodyTest::test_early_return_with_data",
"tornado/test/web_test.py::StreamingRequestBodyTest::test_streaming_body",
"tornado/test/web_test.py::DecoratedStreamingRequestFlowControlTest::test_flow_control_chunked_body",
"tornado/test/web_test.py::DecoratedStreamingRequestFlowControlTest::test_flow_control_compressed_body",
"tornado/test/web_test.py::DecoratedStreamingRequestFlowControlTest::test_flow_control_fixed_body",
"tornado/test/web_test.py::NativeStreamingRequestFlowControlTest::test_flow_control_chunked_body",
"tornado/test/web_test.py::NativeStreamingRequestFlowControlTest::test_flow_control_compressed_body",
"tornado/test/web_test.py::NativeStreamingRequestFlowControlTest::test_flow_control_fixed_body",
"tornado/test/web_test.py::IncorrectContentLengthTest::test_content_length_too_high",
"tornado/test/web_test.py::IncorrectContentLengthTest::test_content_length_too_low",
"tornado/test/web_test.py::ClientCloseTest::test_client_close",
"tornado/test/web_test.py::SignedValueTest::test_expired",
"tornado/test/web_test.py::SignedValueTest::test_key_version_retrieval",
"tornado/test/web_test.py::SignedValueTest::test_key_versioning_invalid_key",
"tornado/test/web_test.py::SignedValueTest::test_key_versioning_read_write_default_key",
"tornado/test/web_test.py::SignedValueTest::test_key_versioning_read_write_non_default_key",
"tornado/test/web_test.py::SignedValueTest::test_known_values",
"tornado/test/web_test.py::SignedValueTest::test_name_swap",
"tornado/test/web_test.py::SignedValueTest::test_non_ascii",
"tornado/test/web_test.py::SignedValueTest::test_payload_tampering",
"tornado/test/web_test.py::SignedValueTest::test_signature_tampering",
"tornado/test/web_test.py::XSRFTest::test_cross_user",
"tornado/test/web_test.py::XSRFTest::test_distinct_tokens",
"tornado/test/web_test.py::XSRFTest::test_refresh_token",
"tornado/test/web_test.py::XSRFTest::test_versioning",
"tornado/test/web_test.py::XSRFTest::test_xsrf_fail_argument_invalid_format",
"tornado/test/web_test.py::XSRFTest::test_xsrf_fail_body_no_cookie",
"tornado/test/web_test.py::XSRFTest::test_xsrf_fail_cookie_invalid_format",
"tornado/test/web_test.py::XSRFTest::test_xsrf_fail_cookie_no_body",
"tornado/test/web_test.py::XSRFTest::test_xsrf_fail_no_token",
"tornado/test/web_test.py::XSRFTest::test_xsrf_success_header",
"tornado/test/web_test.py::XSRFTest::test_xsrf_success_non_hex_token",
"tornado/test/web_test.py::XSRFTest::test_xsrf_success_post_body",
"tornado/test/web_test.py::XSRFTest::test_xsrf_success_query_string",
"tornado/test/web_test.py::XSRFTest::test_xsrf_success_short_token",
"tornado/test/web_test.py::XSRFCookieKwargsTest::test_xsrf_httponly",
"tornado/test/web_test.py::FinishExceptionTest::test_finish_exception",
"tornado/test/web_test.py::DecoratorTest::test_addslash",
"tornado/test/web_test.py::DecoratorTest::test_removeslash",
"tornado/test/web_test.py::CacheTest::test_multiple_strong_etag_match",
"tornado/test/web_test.py::CacheTest::test_multiple_strong_etag_not_match",
"tornado/test/web_test.py::CacheTest::test_multiple_weak_etag_match",
"tornado/test/web_test.py::CacheTest::test_multiple_weak_etag_not_match",
"tornado/test/web_test.py::CacheTest::test_strong_etag_match",
"tornado/test/web_test.py::CacheTest::test_strong_etag_not_match",
"tornado/test/web_test.py::CacheTest::test_weak_etag_match",
"tornado/test/web_test.py::CacheTest::test_weak_etag_not_match",
"tornado/test/web_test.py::CacheTest::test_wildcard_etag",
"tornado/test/web_test.py::RequestSummaryTest::test_missing_remote_ip",
"tornado/test/web_test.py::HTTPErrorTest::test_copy",
"tornado/test/web_test.py::ApplicationTest::test_listen",
"tornado/test/web_test.py::URLSpecReverseTest::test_non_reversible",
"tornado/test/web_test.py::URLSpecReverseTest::test_reverse",
"tornado/test/web_test.py::URLSpecReverseTest::test_reverse_arguments",
"tornado/test/web_test.py::RedirectHandlerTest::test_basic_redirect",
"tornado/test/web_test.py::RedirectHandlerTest::test_redirect_pattern",
"tornado/test/websocket_test.py::WebSocketTest::test_async_prepare",
"tornado/test/websocket_test.py::WebSocketTest::test_bad_websocket_version",
"tornado/test/websocket_test.py::WebSocketTest::test_binary_message",
"tornado/test/websocket_test.py::WebSocketTest::test_check_origin_invalid",
"tornado/test/websocket_test.py::WebSocketTest::test_check_origin_invalid_partial_url",
"tornado/test/websocket_test.py::WebSocketTest::test_check_origin_invalid_subdomains",
"tornado/test/websocket_test.py::WebSocketTest::test_check_origin_valid_no_path",
"tornado/test/websocket_test.py::WebSocketTest::test_check_origin_valid_with_path",
"tornado/test/websocket_test.py::WebSocketTest::test_client_close_reason",
"tornado/test/websocket_test.py::WebSocketTest::test_coroutine",
"tornado/test/websocket_test.py::WebSocketTest::test_error_in_on_message",
"tornado/test/websocket_test.py::WebSocketTest::test_http_request",
"tornado/test/websocket_test.py::WebSocketTest::test_path_args",
"tornado/test/websocket_test.py::WebSocketTest::test_render_message",
"tornado/test/websocket_test.py::WebSocketTest::test_server_close_reason",
"tornado/test/websocket_test.py::WebSocketTest::test_unicode_message",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_callbacks",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_close_buffered_data",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_gen",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_header_echo",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_headers",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_http_fail",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_http_success",
"tornado/test/websocket_test.py::WebSocketTest::test_websocket_network_fail",
"tornado/test/websocket_test.py::WebSocketNativeCoroutineTest::test_native_coroutine",
"tornado/test/websocket_test.py::NoCompressionTest::test_message_sizes",
"tornado/test/websocket_test.py::ServerOnlyCompressionTest::test_message_sizes",
"tornado/test/websocket_test.py::ClientOnlyCompressionTest::test_message_sizes",
"tornado/test/websocket_test.py::DefaultCompressionTest::test_message_sizes",
"tornado/test/websocket_test.py::PythonMaskFunctionTest::test_mask",
"tornado/test/websocket_test.py::CythonMaskFunctionTest::test_mask",
"tornado/test/websocket_test.py::ServerPeriodicPingTest::test_server_ping",
"tornado/test/websocket_test.py::ClientPeriodicPingTest::test_client_ping",
"tornado/test/websocket_test.py::MaxMessageSizeTest::test_large_message"
] |
[] |
Apache License 2.0
| 1,280 |
|
tornadoweb__tornado-2047
|
06be57c11f98b24ce0f6ee2d04f0cfe8bfdb3b4d
|
2017-05-20 17:01:53
|
03f13800e854a6fc9e6efa2168e694d9599348bd
|
diff --git a/tornado/ioloop.py b/tornado/ioloop.py
index ad35787f..a1288e77 100644
--- a/tornado/ioloop.py
+++ b/tornado/ioloop.py
@@ -121,6 +121,16 @@ class IOLoop(Configurable):
current instance. If ``make_current=False``, the new `IOLoop` will
not try to become current.
+ In general, an `IOLoop` cannot survive a fork or be shared across
+ processes in any way. When multiple processes are being used, each
+ process should create its own `IOLoop`, which also implies that
+ any objects which depend on the `IOLoop` (such as
+ `.AsyncHTTPClient`) must also be created in the child processes.
+ As a guideline, anything that starts processes (including the
+ `tornado.process` and `multiprocessing` modules) should do so as
+ early as possible, ideally the first thing the application does
+ after loading its configuration in ``main()``.
+
.. versionchanged:: 4.2
Added the ``make_current`` keyword argument to the `IOLoop`
constructor.
@@ -701,6 +711,7 @@ class PollIOLoop(IOLoop):
self._stopped = False
self._closing = False
self._thread_ident = None
+ self._pid = os.getpid()
self._blocking_signal_threshold = None
self._timeout_counter = itertools.count()
@@ -753,6 +764,8 @@ class PollIOLoop(IOLoop):
def start(self):
if self._running:
raise RuntimeError("IOLoop is already running")
+ if os.getpid() != self._pid:
+ raise RuntimeError("Cannot share PollIOLoops across processes")
self._setup_logging()
if self._stopped:
self._stopped = False
diff --git a/tornado/web.py b/tornado/web.py
index 132f42dd..d79889fa 100644
--- a/tornado/web.py
+++ b/tornado/web.py
@@ -319,7 +319,10 @@ class RequestHandler(object):
if reason is not None:
self._reason = escape.native_str(reason)
else:
- self._reason = httputil.responses.get(status_code, "Unknown")
+ try:
+ self._reason = httputil.responses[status_code]
+ except KeyError:
+ raise ValueError("unknown status code %d" % status_code)
def get_status(self):
"""Returns the status code for our response."""
@@ -1558,7 +1561,11 @@ class RequestHandler(object):
# send a response.
return
if isinstance(e, HTTPError):
- self.send_error(e.status_code, exc_info=sys.exc_info())
+ if e.status_code not in httputil.responses and not e.reason:
+ gen_log.error("Bad HTTP status code: %d", e.status_code)
+ self.send_error(500, exc_info=sys.exc_info())
+ else:
+ self.send_error(e.status_code, exc_info=sys.exc_info())
else:
self.send_error(500, exc_info=sys.exc_info())
|
Check _events and _handlers before start()
```
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/tornado/ioloop.py", line 887, in start
fd_obj, handler_func = self._handlers[fd]
KeyError: 16
```
https://github.com/tornadoweb/tornado/blob/master/tornado/ioloop.py#L883
I ran into this issue when testing using multiple processes and threads. We sandbox our test processes using multiprocessing and were getting this cryptic error.
I found a blog post @toumorokoshi wrote going over his own experiences with this issue: http://y.tsutsumi.io/keyerror-in-self_handlers-a-journey-deep-into-tornados-internals.html
At the very least it would be nice to have some documentation suggesting that you run IOLoop.clear_instance() and IOLoop.clear_current() after a fork()
|
tornadoweb/tornado
|
diff --git a/tornado/test/web_test.py b/tornado/test/web_test.py
index de26c42e..d79ea52c 100644
--- a/tornado/test/web_test.py
+++ b/tornado/test/web_test.py
@@ -917,10 +917,6 @@ class ErrorResponseTest(WebTestCase):
self.assertEqual(response.code, 503)
self.assertTrue(b"503: Service Unavailable" in response.body)
- response = self.fetch("/default?status=435")
- self.assertEqual(response.code, 435)
- self.assertTrue(b"435: Unknown" in response.body)
-
def test_write_error(self):
with ExpectLog(app_log, "Uncaught exception"):
response = self.fetch("/write_error")
@@ -1493,9 +1489,9 @@ class StatusReasonTest(SimpleHandlerTestCase):
response = self.fetch("/?code=682&reason=Bar")
self.assertEqual(response.code, 682)
self.assertEqual(response.reason, "Bar")
- response = self.fetch("/?code=682")
- self.assertEqual(response.code, 682)
- self.assertEqual(response.reason, "Unknown")
+ with ExpectLog(app_log, 'Uncaught exception'):
+ response = self.fetch("/?code=682")
+ self.assertEqual(response.code, 500)
@wsgi_safe
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 2
}
|
4.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc python3-dev"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
coverage==6.2
execnet==1.9.0
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
tomli==1.2.3
-e git+https://github.com/tornadoweb/tornado.git@06be57c11f98b24ce0f6ee2d04f0cfe8bfdb3b4d#egg=tornado
typing_extensions==4.1.1
zipp==3.6.0
|
name: tornado
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- coverage==6.2
- execnet==1.9.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-asyncio==0.16.0
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-xdist==3.0.2
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/tornado
|
[
"tornado/test/web_test.py::StatusReasonTest::test_status"
] |
[] |
[
"tornado/test/web_test.py::SecureCookieV1Test::test_arbitrary_bytes",
"tornado/test/web_test.py::SecureCookieV1Test::test_cookie_tampering_future_timestamp",
"tornado/test/web_test.py::SecureCookieV1Test::test_round_trip",
"tornado/test/web_test.py::SecureCookieV2Test::test_key_version_increment_version",
"tornado/test/web_test.py::SecureCookieV2Test::test_key_version_invalidate_version",
"tornado/test/web_test.py::SecureCookieV2Test::test_key_version_roundtrip",
"tornado/test/web_test.py::SecureCookieV2Test::test_key_version_roundtrip_differing_version",
"tornado/test/web_test.py::SecureCookieV2Test::test_round_trip",
"tornado/test/web_test.py::CookieTest::test_cookie_special_char",
"tornado/test/web_test.py::CookieTest::test_get_cookie",
"tornado/test/web_test.py::CookieTest::test_set_cookie",
"tornado/test/web_test.py::CookieTest::test_set_cookie_domain",
"tornado/test/web_test.py::CookieTest::test_set_cookie_expires_days",
"tornado/test/web_test.py::CookieTest::test_set_cookie_false_flags",
"tornado/test/web_test.py::CookieTest::test_set_cookie_max_age",
"tornado/test/web_test.py::CookieTest::test_set_cookie_overwrite",
"tornado/test/web_test.py::AuthRedirectTest::test_absolute_auth_redirect",
"tornado/test/web_test.py::AuthRedirectTest::test_relative_auth_redirect",
"tornado/test/web_test.py::ConnectionCloseTest::test_connection_close",
"tornado/test/web_test.py::RequestEncodingTest::test_error",
"tornado/test/web_test.py::RequestEncodingTest::test_group_encoding",
"tornado/test/web_test.py::RequestEncodingTest::test_group_question_mark",
"tornado/test/web_test.py::RequestEncodingTest::test_slashes",
"tornado/test/web_test.py::WSGISafeWebTest::test_decode_argument",
"tornado/test/web_test.py::WSGISafeWebTest::test_decode_argument_invalid_unicode",
"tornado/test/web_test.py::WSGISafeWebTest::test_decode_argument_plus",
"tornado/test/web_test.py::WSGISafeWebTest::test_get_argument",
"tornado/test/web_test.py::WSGISafeWebTest::test_get_body_arguments",
"tornado/test/web_test.py::WSGISafeWebTest::test_get_query_arguments",
"tornado/test/web_test.py::WSGISafeWebTest::test_header_injection",
"tornado/test/web_test.py::WSGISafeWebTest::test_multi_header",
"tornado/test/web_test.py::WSGISafeWebTest::test_no_gzip",
"tornado/test/web_test.py::WSGISafeWebTest::test_optional_path",
"tornado/test/web_test.py::WSGISafeWebTest::test_redirect",
"tornado/test/web_test.py::WSGISafeWebTest::test_reverse_url",
"tornado/test/web_test.py::WSGISafeWebTest::test_types",
"tornado/test/web_test.py::WSGISafeWebTest::test_uimodule_resources",
"tornado/test/web_test.py::WSGISafeWebTest::test_uimodule_unescaped",
"tornado/test/web_test.py::WSGISafeWebTest::test_web_redirect",
"tornado/test/web_test.py::WSGISafeWebTest::test_web_redirect_double_slash",
"tornado/test/web_test.py::NonWSGIWebTests::test_empty_flush",
"tornado/test/web_test.py::NonWSGIWebTests::test_flow_control",
"tornado/test/web_test.py::ErrorResponseTest::test_default",
"tornado/test/web_test.py::ErrorResponseTest::test_failed_write_error",
"tornado/test/web_test.py::ErrorResponseTest::test_write_error",
"tornado/test/web_test.py::StaticFileTest::test_absolute_static_url",
"tornado/test/web_test.py::StaticFileTest::test_absolute_version_exclusion",
"tornado/test/web_test.py::StaticFileTest::test_include_host_override",
"tornado/test/web_test.py::StaticFileTest::test_path_traversal_protection",
"tornado/test/web_test.py::StaticFileTest::test_relative_version_exclusion",
"tornado/test/web_test.py::StaticFileTest::test_root_static_path",
"tornado/test/web_test.py::StaticFileTest::test_static_304_if_modified_since",
"tornado/test/web_test.py::StaticFileTest::test_static_304_if_none_match",
"tornado/test/web_test.py::StaticFileTest::test_static_404",
"tornado/test/web_test.py::StaticFileTest::test_static_compressed_files",
"tornado/test/web_test.py::StaticFileTest::test_static_etag",
"tornado/test/web_test.py::StaticFileTest::test_static_files",
"tornado/test/web_test.py::StaticFileTest::test_static_head",
"tornado/test/web_test.py::StaticFileTest::test_static_head_range",
"tornado/test/web_test.py::StaticFileTest::test_static_if_modified_since_pre_epoch",
"tornado/test/web_test.py::StaticFileTest::test_static_if_modified_since_time_zone",
"tornado/test/web_test.py::StaticFileTest::test_static_invalid_range",
"tornado/test/web_test.py::StaticFileTest::test_static_range_if_none_match",
"tornado/test/web_test.py::StaticFileTest::test_static_unsatisfiable_range_invalid_start",
"tornado/test/web_test.py::StaticFileTest::test_static_unsatisfiable_range_zero_suffix",
"tornado/test/web_test.py::StaticFileTest::test_static_url",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range_end_edge",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range_full_file",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range_full_past_end",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range_neg_end",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range_partial_past_end",
"tornado/test/web_test.py::StaticDefaultFilenameTest::test_static_default_filename",
"tornado/test/web_test.py::StaticDefaultFilenameTest::test_static_default_redirect",
"tornado/test/web_test.py::StaticFileWithPathTest::test_serve",
"tornado/test/web_test.py::CustomStaticFileTest::test_serve",
"tornado/test/web_test.py::CustomStaticFileTest::test_static_url",
"tornado/test/web_test.py::HostMatchingTest::test_host_matching",
"tornado/test/web_test.py::DefaultHostMatchingTest::test_default_host_matching",
"tornado/test/web_test.py::NamedURLSpecGroupsTest::test_named_urlspec_groups",
"tornado/test/web_test.py::ClearHeaderTest::test_clear_header",
"tornado/test/web_test.py::Header204Test::test_204_headers",
"tornado/test/web_test.py::Header304Test::test_304_headers",
"tornado/test/web_test.py::DateHeaderTest::test_date_header",
"tornado/test/web_test.py::RaiseWithReasonTest::test_httperror_str",
"tornado/test/web_test.py::RaiseWithReasonTest::test_httperror_str_from_httputil",
"tornado/test/web_test.py::RaiseWithReasonTest::test_raise_with_reason",
"tornado/test/web_test.py::ErrorHandlerXSRFTest::test_404_xsrf",
"tornado/test/web_test.py::ErrorHandlerXSRFTest::test_error_xsrf",
"tornado/test/web_test.py::GzipTestCase::test_gzip",
"tornado/test/web_test.py::GzipTestCase::test_gzip_not_requested",
"tornado/test/web_test.py::GzipTestCase::test_gzip_static",
"tornado/test/web_test.py::GzipTestCase::test_vary_already_present",
"tornado/test/web_test.py::GzipTestCase::test_vary_already_present_multiple",
"tornado/test/web_test.py::PathArgsInPrepareTest::test_kw",
"tornado/test/web_test.py::PathArgsInPrepareTest::test_pos",
"tornado/test/web_test.py::ClearAllCookiesTest::test_clear_all_cookies",
"tornado/test/web_test.py::ExceptionHandlerTest::test_http_error",
"tornado/test/web_test.py::ExceptionHandlerTest::test_known_error",
"tornado/test/web_test.py::ExceptionHandlerTest::test_unknown_error",
"tornado/test/web_test.py::BuggyLoggingTest::test_buggy_log_exception",
"tornado/test/web_test.py::UIMethodUIModuleTest::test_ui_method",
"tornado/test/web_test.py::GetArgumentErrorTest::test_catch_error",
"tornado/test/web_test.py::MultipleExceptionTest::test_multi_exception",
"tornado/test/web_test.py::SetLazyPropertiesTest::test_set_properties",
"tornado/test/web_test.py::GetCurrentUserTest::test_get_current_user_from_ui_module_is_lazy",
"tornado/test/web_test.py::GetCurrentUserTest::test_get_current_user_from_ui_module_works",
"tornado/test/web_test.py::GetCurrentUserTest::test_get_current_user_works",
"tornado/test/web_test.py::UnimplementedHTTPMethodsTest::test_unimplemented_standard_methods",
"tornado/test/web_test.py::UnimplementedNonStandardMethodsTest::test_unimplemented_other",
"tornado/test/web_test.py::UnimplementedNonStandardMethodsTest::test_unimplemented_patch",
"tornado/test/web_test.py::AllHTTPMethodsTest::test_standard_methods",
"tornado/test/web_test.py::PatchMethodTest::test_other",
"tornado/test/web_test.py::PatchMethodTest::test_patch",
"tornado/test/web_test.py::FinishInPrepareTest::test_finish_in_prepare",
"tornado/test/web_test.py::Default404Test::test_404",
"tornado/test/web_test.py::Custom404Test::test_404",
"tornado/test/web_test.py::DefaultHandlerArgumentsTest::test_403",
"tornado/test/web_test.py::HandlerByNameTest::test_handler_by_name",
"tornado/test/web_test.py::StreamingRequestBodyTest::test_close_during_upload",
"tornado/test/web_test.py::StreamingRequestBodyTest::test_early_return",
"tornado/test/web_test.py::StreamingRequestBodyTest::test_early_return_with_data",
"tornado/test/web_test.py::StreamingRequestBodyTest::test_streaming_body",
"tornado/test/web_test.py::DecoratedStreamingRequestFlowControlTest::test_flow_control_chunked_body",
"tornado/test/web_test.py::DecoratedStreamingRequestFlowControlTest::test_flow_control_compressed_body",
"tornado/test/web_test.py::DecoratedStreamingRequestFlowControlTest::test_flow_control_fixed_body",
"tornado/test/web_test.py::NativeStreamingRequestFlowControlTest::test_flow_control_chunked_body",
"tornado/test/web_test.py::NativeStreamingRequestFlowControlTest::test_flow_control_compressed_body",
"tornado/test/web_test.py::NativeStreamingRequestFlowControlTest::test_flow_control_fixed_body",
"tornado/test/web_test.py::IncorrectContentLengthTest::test_content_length_too_high",
"tornado/test/web_test.py::IncorrectContentLengthTest::test_content_length_too_low",
"tornado/test/web_test.py::ClientCloseTest::test_client_close",
"tornado/test/web_test.py::SignedValueTest::test_expired",
"tornado/test/web_test.py::SignedValueTest::test_key_version_retrieval",
"tornado/test/web_test.py::SignedValueTest::test_key_versioning_invalid_key",
"tornado/test/web_test.py::SignedValueTest::test_key_versioning_read_write_default_key",
"tornado/test/web_test.py::SignedValueTest::test_key_versioning_read_write_non_default_key",
"tornado/test/web_test.py::SignedValueTest::test_known_values",
"tornado/test/web_test.py::SignedValueTest::test_name_swap",
"tornado/test/web_test.py::SignedValueTest::test_non_ascii",
"tornado/test/web_test.py::SignedValueTest::test_payload_tampering",
"tornado/test/web_test.py::SignedValueTest::test_signature_tampering",
"tornado/test/web_test.py::XSRFTest::test_cross_user",
"tornado/test/web_test.py::XSRFTest::test_distinct_tokens",
"tornado/test/web_test.py::XSRFTest::test_refresh_token",
"tornado/test/web_test.py::XSRFTest::test_versioning",
"tornado/test/web_test.py::XSRFTest::test_xsrf_fail_argument_invalid_format",
"tornado/test/web_test.py::XSRFTest::test_xsrf_fail_body_no_cookie",
"tornado/test/web_test.py::XSRFTest::test_xsrf_fail_cookie_invalid_format",
"tornado/test/web_test.py::XSRFTest::test_xsrf_fail_cookie_no_body",
"tornado/test/web_test.py::XSRFTest::test_xsrf_fail_no_token",
"tornado/test/web_test.py::XSRFTest::test_xsrf_success_header",
"tornado/test/web_test.py::XSRFTest::test_xsrf_success_non_hex_token",
"tornado/test/web_test.py::XSRFTest::test_xsrf_success_post_body",
"tornado/test/web_test.py::XSRFTest::test_xsrf_success_query_string",
"tornado/test/web_test.py::XSRFTest::test_xsrf_success_short_token",
"tornado/test/web_test.py::XSRFCookieKwargsTest::test_xsrf_httponly",
"tornado/test/web_test.py::FinishExceptionTest::test_finish_exception",
"tornado/test/web_test.py::DecoratorTest::test_addslash",
"tornado/test/web_test.py::DecoratorTest::test_removeslash",
"tornado/test/web_test.py::CacheTest::test_multiple_strong_etag_match",
"tornado/test/web_test.py::CacheTest::test_multiple_strong_etag_not_match",
"tornado/test/web_test.py::CacheTest::test_multiple_weak_etag_match",
"tornado/test/web_test.py::CacheTest::test_multiple_weak_etag_not_match",
"tornado/test/web_test.py::CacheTest::test_strong_etag_match",
"tornado/test/web_test.py::CacheTest::test_strong_etag_not_match",
"tornado/test/web_test.py::CacheTest::test_weak_etag_match",
"tornado/test/web_test.py::CacheTest::test_weak_etag_not_match",
"tornado/test/web_test.py::CacheTest::test_wildcard_etag",
"tornado/test/web_test.py::RequestSummaryTest::test_missing_remote_ip",
"tornado/test/web_test.py::HTTPErrorTest::test_copy",
"tornado/test/web_test.py::ApplicationTest::test_listen",
"tornado/test/web_test.py::URLSpecReverseTest::test_non_reversible",
"tornado/test/web_test.py::URLSpecReverseTest::test_reverse",
"tornado/test/web_test.py::URLSpecReverseTest::test_reverse_arguments",
"tornado/test/web_test.py::RedirectHandlerTest::test_basic_redirect",
"tornado/test/web_test.py::RedirectHandlerTest::test_redirect_pattern"
] |
[] |
Apache License 2.0
| 1,281 |
|
tornadoweb__tornado-2048
|
06be57c11f98b24ce0f6ee2d04f0cfe8bfdb3b4d
|
2017-05-20 17:44:48
|
03f13800e854a6fc9e6efa2168e694d9599348bd
|
diff --git a/tornado/options.py b/tornado/options.py
index 0a72cc65..707fbd35 100644
--- a/tornado/options.py
+++ b/tornado/options.py
@@ -223,9 +223,10 @@ class OptionParser(object):
override options set earlier on the command line, but can be overridden
by later flags.
"""
- if name in self._options:
+ normalized = self._normalize_name(name)
+ if normalized in self._options:
raise Error("Option %r already defined in %s" %
- (name, self._options[name].file_name))
+ (normalized, self._options[normalized].file_name))
frame = sys._getframe(0)
options_file = frame.f_code.co_filename
@@ -247,7 +248,6 @@ class OptionParser(object):
group_name = group
else:
group_name = file_name
- normalized = self._normalize_name(name)
option = _Option(name, file_name=file_name,
default=default, type=type, help=help,
metavar=metavar, multiple=multiple,
diff --git a/tornado/web.py b/tornado/web.py
index 132f42dd..d79889fa 100644
--- a/tornado/web.py
+++ b/tornado/web.py
@@ -319,7 +319,10 @@ class RequestHandler(object):
if reason is not None:
self._reason = escape.native_str(reason)
else:
- self._reason = httputil.responses.get(status_code, "Unknown")
+ try:
+ self._reason = httputil.responses[status_code]
+ except KeyError:
+ raise ValueError("unknown status code %d" % status_code)
def get_status(self):
"""Returns the status code for our response."""
@@ -1558,7 +1561,11 @@ class RequestHandler(object):
# send a response.
return
if isinstance(e, HTTPError):
- self.send_error(e.status_code, exc_info=sys.exc_info())
+ if e.status_code not in httputil.responses and not e.reason:
+ gen_log.error("Bad HTTP status code: %d", e.status_code)
+ self.send_error(500, exc_info=sys.exc_info())
+ else:
+ self.send_error(e.status_code, exc_info=sys.exc_info())
else:
self.send_error(500, exc_info=sys.exc_info())
|
Redefining options that contain an underscore do not raise exceptions, from 4.3.0
From the release notes in 4.3.0: Dashes and underscores are now fully interchangeable in option names.
Discovered issue using Tornado 4.4.1 in Python 2.7 on Mac OS and Linux.
Internally all options with underscores are converted to dashes e.g. genoa_smtp_host is converted to genoa-smtp-host.
looking at the following code one would expect this to raise an exception:
```
options.define("genoa_smtp_host", 'localhost', help="SMTP server address")
options.define("genoa_smtp_host", 'localhost', help="SMTP server address")
```
However it does not, running the next two lines does raise an exception:
```
options.define("genoa_smtp_host", 'localhost', help="SMTP server address")
options.define("genoa-smtp-host", 'localhost', help="SMTP server address")
```
**Proposed solution:**
The first few lines in OptionParser.define() are:
```
if name in self._options:
raise Error("Option %r already defined in %s" %
(name, self._options[name].file_name))
```
I suggest the following:
```
normalized = self._normalize_name(name)
if normalized in self._options:
raise Error("Option %r already defined in %s" %
(name, self._options[normalized].file_name))
```
One consideration for the implementor of the solution to this issue, is the description of the error. It could be confusing to a developer/user of Tornado to see an error description as "Option 'genoa-smtp-host' already defined in my_module.py" when the option name they are using is genoa_smtp_host.
|
tornadoweb/tornado
|
diff --git a/tornado/test/options_test.py b/tornado/test/options_test.py
index bafeea6f..1a0ac8fb 100644
--- a/tornado/test/options_test.py
+++ b/tornado/test/options_test.py
@@ -7,7 +7,7 @@ import sys
from tornado.options import OptionParser, Error
from tornado.util import basestring_type, PY3
-from tornado.test.util import unittest
+from tornado.test.util import unittest, subTest
if PY3:
from io import StringIO
@@ -232,6 +232,24 @@ class OptionsTest(unittest.TestCase):
self.assertRegexpMatches(str(cm.exception),
'Option.*foo.*already defined')
+ def test_error_redefine_underscore(self):
+ # Ensure that the dash/underscore normalization doesn't
+ # interfere with the redefinition error.
+ tests = [
+ ('foo-bar', 'foo-bar'),
+ ('foo_bar', 'foo_bar'),
+ ('foo-bar', 'foo_bar'),
+ ('foo_bar', 'foo-bar'),
+ ]
+ for a, b in tests:
+ with subTest(self, a=a, b=b):
+ options = OptionParser()
+ options.define(a)
+ with self.assertRaises(Error) as cm:
+ options.define(b)
+ self.assertRegexpMatches(str(cm.exception),
+ 'Option.*foo.bar.*already defined')
+
def test_dash_underscore_cli(self):
# Dashes and underscores should be interchangeable.
for defined_name in ['foo-bar', 'foo_bar']:
diff --git a/tornado/test/util.py b/tornado/test/util.py
index 6c032da6..5f534e84 100644
--- a/tornado/test/util.py
+++ b/tornado/test/util.py
@@ -1,5 +1,6 @@
from __future__ import absolute_import, division, print_function
+import contextlib
import os
import platform
import socket
@@ -94,3 +95,15 @@ def is_coverage_running():
except AttributeError:
return False
return mod.startswith('coverage')
+
+
+def subTest(test, *args, **kwargs):
+ """Compatibility shim for unittest.TestCase.subTest.
+
+ Usage: ``with tornado.test.util.subTest(self, x=x):``
+ """
+ try:
+ subTest = test.subTest # py34+
+ except AttributeError:
+ subTest = contextlib.contextmanager(lambda *a, **kw: (yield))
+ return subTest(*args, **kwargs)
diff --git a/tornado/test/web_test.py b/tornado/test/web_test.py
index de26c42e..d79ea52c 100644
--- a/tornado/test/web_test.py
+++ b/tornado/test/web_test.py
@@ -917,10 +917,6 @@ class ErrorResponseTest(WebTestCase):
self.assertEqual(response.code, 503)
self.assertTrue(b"503: Service Unavailable" in response.body)
- response = self.fetch("/default?status=435")
- self.assertEqual(response.code, 435)
- self.assertTrue(b"435: Unknown" in response.body)
-
def test_write_error(self):
with ExpectLog(app_log, "Uncaught exception"):
response = self.fetch("/write_error")
@@ -1493,9 +1489,9 @@ class StatusReasonTest(SimpleHandlerTestCase):
response = self.fetch("/?code=682&reason=Bar")
self.assertEqual(response.code, 682)
self.assertEqual(response.reason, "Bar")
- response = self.fetch("/?code=682")
- self.assertEqual(response.code, 682)
- self.assertEqual(response.reason, "Unknown")
+ with ExpectLog(app_log, 'Uncaught exception'):
+ response = self.fetch("/?code=682")
+ self.assertEqual(response.code, 500)
@wsgi_safe
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 2
}
|
4.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"futures",
"mock",
"monotonic",
"trollius",
"sphinx",
"sphinx_rtd_theme",
"codecov",
"virtualenv",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
coverage==6.2
distlib==0.3.9
docutils==0.18.1
filelock==3.4.1
futures==2.2.0
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
Jinja2==3.0.3
MarkupSafe==2.0.1
mock==5.2.0
monotonic==1.6
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
platformdirs==2.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
Pygments==2.14.0
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytz==2025.2
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
-e git+https://github.com/tornadoweb/tornado.git@06be57c11f98b24ce0f6ee2d04f0cfe8bfdb3b4d#egg=tornado
trollius==2.1.post2
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
virtualenv==20.17.1
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: tornado
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- babel==2.11.0
- charset-normalizer==2.0.12
- codecov==2.1.13
- coverage==6.2
- distlib==0.3.9
- docutils==0.18.1
- filelock==3.4.1
- futures==2.2.0
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- jinja2==3.0.3
- markupsafe==2.0.1
- mock==5.2.0
- monotonic==1.6
- platformdirs==2.4.0
- pygments==2.14.0
- pytz==2025.2
- requests==2.27.1
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==5.3.0
- sphinx-rtd-theme==2.0.0
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- trollius==2.1.post2
- urllib3==1.26.20
- virtualenv==20.17.1
prefix: /opt/conda/envs/tornado
|
[
"tornado/test/options_test.py::OptionsTest::test_error_redefine_underscore",
"tornado/test/web_test.py::StatusReasonTest::test_status"
] |
[] |
[
"tornado/test/options_test.py::OptionsTest::test_as_dict",
"tornado/test/options_test.py::OptionsTest::test_dash_underscore_cli",
"tornado/test/options_test.py::OptionsTest::test_dash_underscore_file",
"tornado/test/options_test.py::OptionsTest::test_dash_underscore_introspection",
"tornado/test/options_test.py::OptionsTest::test_error_redefine",
"tornado/test/options_test.py::OptionsTest::test_getitem",
"tornado/test/options_test.py::OptionsTest::test_group_dict",
"tornado/test/options_test.py::OptionsTest::test_help",
"tornado/test/options_test.py::OptionsTest::test_items",
"tornado/test/options_test.py::OptionsTest::test_iter",
"tornado/test/options_test.py::OptionsTest::test_mock_patch",
"tornado/test/options_test.py::OptionsTest::test_multiple_int",
"tornado/test/options_test.py::OptionsTest::test_multiple_string",
"tornado/test/options_test.py::OptionsTest::test_parse_callbacks",
"tornado/test/options_test.py::OptionsTest::test_parse_command_line",
"tornado/test/options_test.py::OptionsTest::test_parse_config_file",
"tornado/test/options_test.py::OptionsTest::test_setattr",
"tornado/test/options_test.py::OptionsTest::test_setattr_type_check",
"tornado/test/options_test.py::OptionsTest::test_setattr_with_callback",
"tornado/test/options_test.py::OptionsTest::test_setitem",
"tornado/test/options_test.py::OptionsTest::test_subcommand",
"tornado/test/options_test.py::OptionsTest::test_types",
"tornado/test/web_test.py::SecureCookieV1Test::test_arbitrary_bytes",
"tornado/test/web_test.py::SecureCookieV1Test::test_cookie_tampering_future_timestamp",
"tornado/test/web_test.py::SecureCookieV1Test::test_round_trip",
"tornado/test/web_test.py::SecureCookieV2Test::test_key_version_increment_version",
"tornado/test/web_test.py::SecureCookieV2Test::test_key_version_invalidate_version",
"tornado/test/web_test.py::SecureCookieV2Test::test_key_version_roundtrip",
"tornado/test/web_test.py::SecureCookieV2Test::test_key_version_roundtrip_differing_version",
"tornado/test/web_test.py::SecureCookieV2Test::test_round_trip",
"tornado/test/web_test.py::CookieTest::test_cookie_special_char",
"tornado/test/web_test.py::CookieTest::test_get_cookie",
"tornado/test/web_test.py::CookieTest::test_set_cookie",
"tornado/test/web_test.py::CookieTest::test_set_cookie_domain",
"tornado/test/web_test.py::CookieTest::test_set_cookie_expires_days",
"tornado/test/web_test.py::CookieTest::test_set_cookie_false_flags",
"tornado/test/web_test.py::CookieTest::test_set_cookie_max_age",
"tornado/test/web_test.py::CookieTest::test_set_cookie_overwrite",
"tornado/test/web_test.py::AuthRedirectTest::test_absolute_auth_redirect",
"tornado/test/web_test.py::AuthRedirectTest::test_relative_auth_redirect",
"tornado/test/web_test.py::ConnectionCloseTest::test_connection_close",
"tornado/test/web_test.py::RequestEncodingTest::test_error",
"tornado/test/web_test.py::RequestEncodingTest::test_group_encoding",
"tornado/test/web_test.py::RequestEncodingTest::test_group_question_mark",
"tornado/test/web_test.py::RequestEncodingTest::test_slashes",
"tornado/test/web_test.py::WSGISafeWebTest::test_decode_argument",
"tornado/test/web_test.py::WSGISafeWebTest::test_decode_argument_invalid_unicode",
"tornado/test/web_test.py::WSGISafeWebTest::test_decode_argument_plus",
"tornado/test/web_test.py::WSGISafeWebTest::test_get_argument",
"tornado/test/web_test.py::WSGISafeWebTest::test_get_body_arguments",
"tornado/test/web_test.py::WSGISafeWebTest::test_get_query_arguments",
"tornado/test/web_test.py::WSGISafeWebTest::test_header_injection",
"tornado/test/web_test.py::WSGISafeWebTest::test_multi_header",
"tornado/test/web_test.py::WSGISafeWebTest::test_no_gzip",
"tornado/test/web_test.py::WSGISafeWebTest::test_optional_path",
"tornado/test/web_test.py::WSGISafeWebTest::test_redirect",
"tornado/test/web_test.py::WSGISafeWebTest::test_reverse_url",
"tornado/test/web_test.py::WSGISafeWebTest::test_types",
"tornado/test/web_test.py::WSGISafeWebTest::test_uimodule_resources",
"tornado/test/web_test.py::WSGISafeWebTest::test_uimodule_unescaped",
"tornado/test/web_test.py::WSGISafeWebTest::test_web_redirect",
"tornado/test/web_test.py::WSGISafeWebTest::test_web_redirect_double_slash",
"tornado/test/web_test.py::NonWSGIWebTests::test_empty_flush",
"tornado/test/web_test.py::NonWSGIWebTests::test_flow_control",
"tornado/test/web_test.py::ErrorResponseTest::test_default",
"tornado/test/web_test.py::ErrorResponseTest::test_failed_write_error",
"tornado/test/web_test.py::ErrorResponseTest::test_write_error",
"tornado/test/web_test.py::StaticFileTest::test_absolute_static_url",
"tornado/test/web_test.py::StaticFileTest::test_absolute_version_exclusion",
"tornado/test/web_test.py::StaticFileTest::test_include_host_override",
"tornado/test/web_test.py::StaticFileTest::test_path_traversal_protection",
"tornado/test/web_test.py::StaticFileTest::test_relative_version_exclusion",
"tornado/test/web_test.py::StaticFileTest::test_root_static_path",
"tornado/test/web_test.py::StaticFileTest::test_static_304_if_modified_since",
"tornado/test/web_test.py::StaticFileTest::test_static_304_if_none_match",
"tornado/test/web_test.py::StaticFileTest::test_static_404",
"tornado/test/web_test.py::StaticFileTest::test_static_compressed_files",
"tornado/test/web_test.py::StaticFileTest::test_static_etag",
"tornado/test/web_test.py::StaticFileTest::test_static_files",
"tornado/test/web_test.py::StaticFileTest::test_static_head",
"tornado/test/web_test.py::StaticFileTest::test_static_head_range",
"tornado/test/web_test.py::StaticFileTest::test_static_if_modified_since_pre_epoch",
"tornado/test/web_test.py::StaticFileTest::test_static_if_modified_since_time_zone",
"tornado/test/web_test.py::StaticFileTest::test_static_invalid_range",
"tornado/test/web_test.py::StaticFileTest::test_static_range_if_none_match",
"tornado/test/web_test.py::StaticFileTest::test_static_unsatisfiable_range_invalid_start",
"tornado/test/web_test.py::StaticFileTest::test_static_unsatisfiable_range_zero_suffix",
"tornado/test/web_test.py::StaticFileTest::test_static_url",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range_end_edge",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range_full_file",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range_full_past_end",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range_neg_end",
"tornado/test/web_test.py::StaticFileTest::test_static_with_range_partial_past_end",
"tornado/test/web_test.py::StaticDefaultFilenameTest::test_static_default_filename",
"tornado/test/web_test.py::StaticDefaultFilenameTest::test_static_default_redirect",
"tornado/test/web_test.py::StaticFileWithPathTest::test_serve",
"tornado/test/web_test.py::CustomStaticFileTest::test_serve",
"tornado/test/web_test.py::CustomStaticFileTest::test_static_url",
"tornado/test/web_test.py::HostMatchingTest::test_host_matching",
"tornado/test/web_test.py::DefaultHostMatchingTest::test_default_host_matching",
"tornado/test/web_test.py::NamedURLSpecGroupsTest::test_named_urlspec_groups",
"tornado/test/web_test.py::ClearHeaderTest::test_clear_header",
"tornado/test/web_test.py::Header204Test::test_204_headers",
"tornado/test/web_test.py::Header304Test::test_304_headers",
"tornado/test/web_test.py::DateHeaderTest::test_date_header",
"tornado/test/web_test.py::RaiseWithReasonTest::test_httperror_str",
"tornado/test/web_test.py::RaiseWithReasonTest::test_httperror_str_from_httputil",
"tornado/test/web_test.py::RaiseWithReasonTest::test_raise_with_reason",
"tornado/test/web_test.py::ErrorHandlerXSRFTest::test_404_xsrf",
"tornado/test/web_test.py::ErrorHandlerXSRFTest::test_error_xsrf",
"tornado/test/web_test.py::GzipTestCase::test_gzip",
"tornado/test/web_test.py::GzipTestCase::test_gzip_not_requested",
"tornado/test/web_test.py::GzipTestCase::test_gzip_static",
"tornado/test/web_test.py::GzipTestCase::test_vary_already_present",
"tornado/test/web_test.py::GzipTestCase::test_vary_already_present_multiple",
"tornado/test/web_test.py::PathArgsInPrepareTest::test_kw",
"tornado/test/web_test.py::PathArgsInPrepareTest::test_pos",
"tornado/test/web_test.py::ClearAllCookiesTest::test_clear_all_cookies",
"tornado/test/web_test.py::ExceptionHandlerTest::test_http_error",
"tornado/test/web_test.py::ExceptionHandlerTest::test_known_error",
"tornado/test/web_test.py::ExceptionHandlerTest::test_unknown_error",
"tornado/test/web_test.py::BuggyLoggingTest::test_buggy_log_exception",
"tornado/test/web_test.py::UIMethodUIModuleTest::test_ui_method",
"tornado/test/web_test.py::GetArgumentErrorTest::test_catch_error",
"tornado/test/web_test.py::MultipleExceptionTest::test_multi_exception",
"tornado/test/web_test.py::SetLazyPropertiesTest::test_set_properties",
"tornado/test/web_test.py::GetCurrentUserTest::test_get_current_user_from_ui_module_is_lazy",
"tornado/test/web_test.py::GetCurrentUserTest::test_get_current_user_from_ui_module_works",
"tornado/test/web_test.py::GetCurrentUserTest::test_get_current_user_works",
"tornado/test/web_test.py::UnimplementedHTTPMethodsTest::test_unimplemented_standard_methods",
"tornado/test/web_test.py::UnimplementedNonStandardMethodsTest::test_unimplemented_other",
"tornado/test/web_test.py::UnimplementedNonStandardMethodsTest::test_unimplemented_patch",
"tornado/test/web_test.py::AllHTTPMethodsTest::test_standard_methods",
"tornado/test/web_test.py::PatchMethodTest::test_other",
"tornado/test/web_test.py::PatchMethodTest::test_patch",
"tornado/test/web_test.py::FinishInPrepareTest::test_finish_in_prepare",
"tornado/test/web_test.py::Default404Test::test_404",
"tornado/test/web_test.py::Custom404Test::test_404",
"tornado/test/web_test.py::DefaultHandlerArgumentsTest::test_403",
"tornado/test/web_test.py::HandlerByNameTest::test_handler_by_name",
"tornado/test/web_test.py::StreamingRequestBodyTest::test_close_during_upload",
"tornado/test/web_test.py::StreamingRequestBodyTest::test_early_return",
"tornado/test/web_test.py::StreamingRequestBodyTest::test_early_return_with_data",
"tornado/test/web_test.py::StreamingRequestBodyTest::test_streaming_body",
"tornado/test/web_test.py::DecoratedStreamingRequestFlowControlTest::test_flow_control_chunked_body",
"tornado/test/web_test.py::DecoratedStreamingRequestFlowControlTest::test_flow_control_compressed_body",
"tornado/test/web_test.py::DecoratedStreamingRequestFlowControlTest::test_flow_control_fixed_body",
"tornado/test/web_test.py::NativeStreamingRequestFlowControlTest::test_flow_control_chunked_body",
"tornado/test/web_test.py::NativeStreamingRequestFlowControlTest::test_flow_control_compressed_body",
"tornado/test/web_test.py::NativeStreamingRequestFlowControlTest::test_flow_control_fixed_body",
"tornado/test/web_test.py::IncorrectContentLengthTest::test_content_length_too_high",
"tornado/test/web_test.py::IncorrectContentLengthTest::test_content_length_too_low",
"tornado/test/web_test.py::ClientCloseTest::test_client_close",
"tornado/test/web_test.py::SignedValueTest::test_expired",
"tornado/test/web_test.py::SignedValueTest::test_key_version_retrieval",
"tornado/test/web_test.py::SignedValueTest::test_key_versioning_invalid_key",
"tornado/test/web_test.py::SignedValueTest::test_key_versioning_read_write_default_key",
"tornado/test/web_test.py::SignedValueTest::test_key_versioning_read_write_non_default_key",
"tornado/test/web_test.py::SignedValueTest::test_known_values",
"tornado/test/web_test.py::SignedValueTest::test_name_swap",
"tornado/test/web_test.py::SignedValueTest::test_non_ascii",
"tornado/test/web_test.py::SignedValueTest::test_payload_tampering",
"tornado/test/web_test.py::SignedValueTest::test_signature_tampering",
"tornado/test/web_test.py::XSRFTest::test_cross_user",
"tornado/test/web_test.py::XSRFTest::test_distinct_tokens",
"tornado/test/web_test.py::XSRFTest::test_refresh_token",
"tornado/test/web_test.py::XSRFTest::test_versioning",
"tornado/test/web_test.py::XSRFTest::test_xsrf_fail_argument_invalid_format",
"tornado/test/web_test.py::XSRFTest::test_xsrf_fail_body_no_cookie",
"tornado/test/web_test.py::XSRFTest::test_xsrf_fail_cookie_invalid_format",
"tornado/test/web_test.py::XSRFTest::test_xsrf_fail_cookie_no_body",
"tornado/test/web_test.py::XSRFTest::test_xsrf_fail_no_token",
"tornado/test/web_test.py::XSRFTest::test_xsrf_success_header",
"tornado/test/web_test.py::XSRFTest::test_xsrf_success_non_hex_token",
"tornado/test/web_test.py::XSRFTest::test_xsrf_success_post_body",
"tornado/test/web_test.py::XSRFTest::test_xsrf_success_query_string",
"tornado/test/web_test.py::XSRFTest::test_xsrf_success_short_token",
"tornado/test/web_test.py::XSRFCookieKwargsTest::test_xsrf_httponly",
"tornado/test/web_test.py::FinishExceptionTest::test_finish_exception",
"tornado/test/web_test.py::DecoratorTest::test_addslash",
"tornado/test/web_test.py::DecoratorTest::test_removeslash",
"tornado/test/web_test.py::CacheTest::test_multiple_strong_etag_match",
"tornado/test/web_test.py::CacheTest::test_multiple_strong_etag_not_match",
"tornado/test/web_test.py::CacheTest::test_multiple_weak_etag_match",
"tornado/test/web_test.py::CacheTest::test_multiple_weak_etag_not_match",
"tornado/test/web_test.py::CacheTest::test_strong_etag_match",
"tornado/test/web_test.py::CacheTest::test_strong_etag_not_match",
"tornado/test/web_test.py::CacheTest::test_weak_etag_match",
"tornado/test/web_test.py::CacheTest::test_weak_etag_not_match",
"tornado/test/web_test.py::CacheTest::test_wildcard_etag",
"tornado/test/web_test.py::RequestSummaryTest::test_missing_remote_ip",
"tornado/test/web_test.py::HTTPErrorTest::test_copy",
"tornado/test/web_test.py::ApplicationTest::test_listen",
"tornado/test/web_test.py::URLSpecReverseTest::test_non_reversible",
"tornado/test/web_test.py::URLSpecReverseTest::test_reverse",
"tornado/test/web_test.py::URLSpecReverseTest::test_reverse_arguments",
"tornado/test/web_test.py::RedirectHandlerTest::test_basic_redirect",
"tornado/test/web_test.py::RedirectHandlerTest::test_redirect_pattern"
] |
[] |
Apache License 2.0
| 1,282 |
|
jbasko__configmanager-96
|
dbdd2467741f0875fca53d0062f4dca1f307df8a
|
2017-05-21 17:04:57
|
dbdd2467741f0875fca53d0062f4dca1f307df8a
|
diff --git a/configmanager/managers.py b/configmanager/managers.py
index 1b03f33..9679217 100644
--- a/configmanager/managers.py
+++ b/configmanager/managers.py
@@ -46,8 +46,10 @@ class Config(BaseSection):
cm__configparser_factory = configparser.ConfigParser
def __new__(cls, config_declaration=None, item_cls=None, configparser_factory=None):
- instance = super(Config, cls).__new__(cls)
+ if config_declaration and isinstance(config_declaration, cls):
+ return copy.deepcopy(config_declaration)
+ instance = super(Config, cls).__new__(cls)
instance._cm__section = None
instance._cm__section_alias = None
instance._cm__configs = collections.OrderedDict()
|
Allow deep-copying of Config with config2 = Config(config1)
|
jbasko/configmanager
|
diff --git a/tests/test_config.py b/tests/test_config.py
index a51c096..29f62e3 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -460,3 +460,21 @@ def test_config_item_value_can_be_unicode_str(tmpdir):
config2.configparser.load(path)
assert config2.name.value == u'Jānis Bērziņš'
assert config1.to_dict(with_defaults=True) == config2.to_dict(with_defaults=True)
+
+
+def test_config_of_config_is_a_deep_copy_of_original_config():
+ config1 = Config({'uploads': {'enabled': True, 'db': {'user': 'root'}}})
+ config1.uploads.enabled.value = False
+
+ config2 = Config(config1)
+ assert config1 is not config2
+ assert config1.to_dict() == config2.to_dict()
+ assert config1.to_dict(with_defaults=True) == config2.to_dict(with_defaults=True)
+
+ config1.uploads.enabled.value = True
+ config1.uploads.db.read_dict({'user': 'admin'})
+
+ assert config2.to_dict(with_defaults=True) == {'uploads': {'enabled': False, 'db': {'user': 'root'}}}
+
+ config2.uploads.db.user.default = 'default-user'
+ assert config1.uploads.db.user.default == 'root'
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 1
}
|
1.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-random-order"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
-e git+https://github.com/jbasko/configmanager.git@dbdd2467741f0875fca53d0062f4dca1f307df8a#egg=configmanager
configparser==5.2.0
coverage==6.2
distlib==0.3.9
filelock==3.4.1
future==1.0.0
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-random-order==1.1.1
PyYAML==6.0.1
six==1.17.0
toml==0.10.2
tomli==1.2.3
tox==3.28.0
typing_extensions==4.1.1
virtualenv==20.17.1
zipp==3.6.0
|
name: configmanager
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- configparser==5.2.0
- coverage==6.2
- distlib==0.3.9
- filelock==3.4.1
- future==1.0.0
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- iniconfig==1.1.1
- packaging==21.3
- platformdirs==2.4.0
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-random-order==1.1.1
- pyyaml==6.0.1
- six==1.17.0
- toml==0.10.2
- tomli==1.2.3
- tox==3.28.0
- typing-extensions==4.1.1
- virtualenv==20.17.1
- zipp==3.6.0
prefix: /opt/conda/envs/configmanager
|
[
"tests/test_config.py::test_config_of_config_is_a_deep_copy_of_original_config"
] |
[] |
[
"tests/test_config.py::test_items_are_created_using_cm_create_item_method",
"tests/test_config.py::test_reset_resets_values_to_defaults",
"tests/test_config.py::test_repr_of_config",
"tests/test_config.py::test_assigning_nameless_item_directly_to_config_should_set_its_name",
"tests/test_config.py::test_assigning_item_with_name_directly_to_config_should_preserve_its_name",
"tests/test_config.py::test_item_name_and_alias_must_be_a_string",
"tests/test_config.py::test_section_name_must_be_a_string",
"tests/test_config.py::test_to_dict_should_not_include_items_with_no_usable_value",
"tests/test_config.py::test_read_dict_recursively_loads_values_from_a_dictionary",
"tests/test_config.py::test_read_dict_as_defaults_loads_default_values_from_a_dictionary",
"tests/test_config.py::test_declaration_parser_does_not_modify_config",
"tests/test_config.py::test_allows_iteration_over_all_items",
"tests/test_config.py::test_forbids_accidental_item_overwrite_via_setitem",
"tests/test_config.py::test_allows_iteration_over_sections",
"tests/test_config.py::test_attribute_read_access",
"tests/test_config.py::test_attribute_write_access",
"tests/test_config.py::test_forbids_accidental_item_overwrite_via_setattr",
"tests/test_config.py::test_to_dict",
"tests/test_config.py::test_can_inspect_config_contents",
"tests/test_config.py::test_can_have_a_dict_as_a_config_value_if_wrapped_inside_item",
"tests/test_config.py::test_len_of_config_returns_number_of_items_in_it",
"tests/test_config.py::test__getitem__handles_paths_to_sections_and_items_and_so_does__contains__",
"tests/test_config.py::test_can_use__setitem__to_create_new_deep_paths",
"tests/test_config.py::test_section_knows_its_alias",
"tests/test_config.py::test_config_item_value_can_be_unicode_str"
] |
[] |
MIT License
| 1,285 |
|
zopefoundation__zope.publisher-19
|
4021bcdecb998b1b45ca32222eaa1126925de794
|
2017-05-22 14:04:02
|
dc4f23e4b71835bdc858c338a1ca230cf4178feb
|
diff --git a/CHANGES.rst b/CHANGES.rst
index 608b131..747afad 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,7 +4,10 @@ Changes
4.3.2 (unreleased)
------------------
-- Nothing changed yet.
+- Fix instances of ``BaseRequest`` (including ``BrowserRequest``)
+ being unexpectedly ``False`` on Python 3 by defining ``__bool__``.
+ Such instances were always ``True`` on Python 2. See `issue 18
+ <https://github.com/zopefoundation/zope.publisher/issues/18>`_.
4.3.1 (2017-04-24)
diff --git a/src/zope/publisher/base.py b/src/zope/publisher/base.py
index 4c6a0a2..ee6de47 100644
--- a/src/zope/publisher/base.py
+++ b/src/zope/publisher/base.py
@@ -353,9 +353,11 @@ class BaseRequest(object):
# Should be overridden by subclasses
return BaseResponse()
- def __nonzero__(self):
+ def __bool__(self):
# This is here to avoid calling __len__ for boolean tests
- return 1
+ return True
+
+ __nonzero__ = __bool__ # Python 2
def __str__(self):
L1 = self.items()
|
`BaseRequest` needs to define `__bool__` for Python 3
It defines `__nonzero__` to always be True for Python 2, but it doesn't define `__bool__` for Python 3. So it falls back to `__len__` and you get different behaviour (requests seem false when they shouldn't be).
Found testing zc.resourcelibrary with Python 3. https://github.com/zopefoundation/zc.resourcelibrary/pull/2
|
zopefoundation/zope.publisher
|
diff --git a/src/zope/publisher/tests/test_baserequest.py b/src/zope/publisher/tests/test_baserequest.py
index eff4d0d..9e1824b 100644
--- a/src/zope/publisher/tests/test_baserequest.py
+++ b/src/zope/publisher/tests/test_baserequest.py
@@ -40,6 +40,9 @@ class TestBaseRequest(BaseTestIPublicationRequest,
def _Test__expectedViewType(self):
return None # we don't expect
+ def test_bool_empty(self):
+ self.assertTrue(self._Test__new())
+
def test_IApplicationRequest_bodyStream(self):
from zope.publisher.base import BaseRequest
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 2
}
|
4.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[test]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
python-gettext==4.1
pytz==2025.2
six==1.17.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
zope.browser==2.4
zope.component==5.1.0
zope.configuration==4.4.1
zope.contenttype==4.6
zope.deprecation==4.4.0
zope.event==4.6
zope.exceptions==4.6
zope.hookable==5.4
zope.i18n==4.9.0
zope.i18nmessageid==5.1.1
zope.interface==5.5.2
zope.location==4.3
zope.proxy==4.6.1
-e git+https://github.com/zopefoundation/zope.publisher.git@4021bcdecb998b1b45ca32222eaa1126925de794#egg=zope.publisher
zope.schema==6.2.1
zope.security==5.8
zope.testing==5.0.1
zope.testrunner==5.6
|
name: zope.publisher
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- python-gettext==4.1
- pytz==2025.2
- six==1.17.0
- zope-browser==2.4
- zope-component==5.1.0
- zope-configuration==4.4.1
- zope-contenttype==4.6
- zope-deprecation==4.4.0
- zope-event==4.6
- zope-exceptions==4.6
- zope-hookable==5.4
- zope-i18n==4.9.0
- zope-i18nmessageid==5.1.1
- zope-interface==5.5.2
- zope-location==4.3
- zope-proxy==4.6.1
- zope-schema==6.2.1
- zope-security==5.8
- zope-testing==5.0.1
- zope-testrunner==5.6
prefix: /opt/conda/envs/zope.publisher
|
[
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::test_bool_empty"
] |
[] |
[
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::testEnvironment",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::testGetAndDefaultInMapping",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::testHaveCustomTestsForIApplicationRequest",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::testHaveCustomTestsForIPublicationRequest",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::testHaveCustomTestsForIPublisherRequest",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::testHoldCloseAndGetResponse",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::testIReadMapping",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::testPublicationManagement",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::testSkinManagement",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::testTraversalStack",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::testVerifyIApplicationRequest",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::testVerifyIPublicationRequest",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::testVerifyIPublisherRequest",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::test_AnnotationsExist",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::test_IApplicationRequest_bodyStream",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::test_IPublicationRequest_getPositionalArguments",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::test_IPublisherRequest_processInputs",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::test_IPublisherRequest_retry",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::test_IPublisherRequest_traverse",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::test_SetRequestInResponse",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::test___len__",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::test_items",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::test_keys",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::test_retry_keeps_everything",
"src/zope/publisher/tests/test_baserequest.py::TestBaseRequest::test_values",
"src/zope/publisher/tests/test_baserequest.py::test_suite"
] |
[] |
Zope Public License 2.1
| 1,287 |
|
sciunto-org__python-bibtexparser-162
|
19051fdaeb3eea869aef1f7534d0a678f12f1b8c
|
2017-05-22 14:53:54
|
19051fdaeb3eea869aef1f7534d0a678f12f1b8c
|
coveralls:
[](https://coveralls.io/builds/11631371)
Coverage increased (+0.6%) to 96.411% when pulling **6ede2250c3fe812408bbfa9c4b94379facf985c6 on Phyks:dev** into **8679713d01972ef173b88657395456e0fe3f2c95 on sciunto-org:master**.
coveralls:
[](https://coveralls.io/builds/11631371)
Coverage increased (+0.6%) to 96.411% when pulling **6ede2250c3fe812408bbfa9c4b94379facf985c6 on Phyks:dev** into **8679713d01972ef173b88657395456e0fe3f2c95 on sciunto-org:master**.
coveralls:
[](https://coveralls.io/builds/11631371)
Coverage increased (+0.6%) to 96.411% when pulling **6ede2250c3fe812408bbfa9c4b94379facf985c6 on Phyks:dev** into **8679713d01972ef173b88657395456e0fe3f2c95 on sciunto-org:master**.
sciunto: The failure seems to be related to this: https://github.com/travis-ci/travis-ci/issues/7771
sciunto: Could you rebase please?
|
diff --git a/bibtexparser/latexenc.py b/bibtexparser/latexenc.py
index e225de4..b4ac36d 100644
--- a/bibtexparser/latexenc.py
+++ b/bibtexparser/latexenc.py
@@ -85,6 +85,9 @@ def latex_to_unicode(string):
# to normalize to the latter.
cleaned_string = unicodedata.normalize("NFC", "".join(cleaned_string))
+ # Remove any left braces
+ cleaned_string = cleaned_string.replace("{", "").replace("}", "")
+
return cleaned_string
|
Inconsistent results using `bibtexparser.latex_to_unicode`
Thanks for writing and maintaining this package!
I found that using `bibtexparser.latex_to_unicode` yields inconsistent results:
>>> latex_to_unicode(r"p\^{a}t\'{e}")
'pâté'
>>> latex_to_unicode(r"\^{i}le")
'{î}le'
Why are there braces around i-circumflex but not around a-circumflex or e-acut?
|
sciunto-org/python-bibtexparser
|
diff --git a/bibtexparser/tests/test_customization.py b/bibtexparser/tests/test_customization.py
index e38c078..d6d42b5 100644
--- a/bibtexparser/tests/test_customization.py
+++ b/bibtexparser/tests/test_customization.py
@@ -89,7 +89,16 @@ class TestBibtexParserMethod(unittest.TestCase):
# From issue 121
record = {'title': '{Two Gedenk\\"uberlieferung der Angelsachsen}'}
result = convert_to_unicode(record)
- expected = {'title': '{Two Gedenküberlieferung der Angelsachsen}'}
+ expected = {'title': 'Two Gedenküberlieferung der Angelsachsen'}
+ self.assertEqual(result, expected)
+ # From issue 161
+ record = {'title': r"p\^{a}t\'{e}"}
+ result = convert_to_unicode(record)
+ expected = {'title': "pâté"}
+ self.assertEqual(result, expected)
+ record = {'title': r"\^{i}le"}
+ result = convert_to_unicode(record)
+ expected = {'title': "île"}
self.assertEqual(result, expected)
###########
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 1
}
|
0.6
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"nose",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/sciunto-org/python-bibtexparser.git@19051fdaeb3eea869aef1f7534d0a678f12f1b8c#egg=bibtexparser
exceptiongroup==1.2.2
future==1.0.0
iniconfig==2.1.0
nose==1.3.7
packaging==24.2
pluggy==1.5.0
pyparsing==3.2.3
pytest==8.3.5
tomli==2.2.1
|
name: python-bibtexparser
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- exceptiongroup==1.2.2
- future==1.0.0
- iniconfig==2.1.0
- nose==1.3.7
- packaging==24.2
- pluggy==1.5.0
- pyparsing==3.2.3
- pytest==8.3.5
- tomli==2.2.1
prefix: /opt/conda/envs/python-bibtexparser
|
[
"bibtexparser/tests/test_customization.py::TestBibtexParserMethod::test_convert_to_unicode"
] |
[] |
[
"bibtexparser/tests/test_customization.py::TestBibtexParserMethod::test_add_plaintext_fields",
"bibtexparser/tests/test_customization.py::TestBibtexParserMethod::test_getnames",
"bibtexparser/tests/test_customization.py::TestBibtexParserMethod::test_homogenize",
"bibtexparser/tests/test_customization.py::TestBibtexParserMethod::test_keywords",
"bibtexparser/tests/test_customization.py::TestBibtexParserMethod::test_page_double_hyphen_alreadyOK",
"bibtexparser/tests/test_customization.py::TestBibtexParserMethod::test_page_double_hyphen_nothing",
"bibtexparser/tests/test_customization.py::TestBibtexParserMethod::test_page_double_hyphen_simple",
"bibtexparser/tests/test_customization.py::TestBibtexParserMethod::test_page_double_hyphen_space"
] |
[] |
MIT License
| 1,288 |
borgbackup__borg-2555
|
5a667d6f6aad54ba1246fee4dbf54a67f75b80f4
|
2017-05-23 00:25:08
|
a439fa3e720c8bb2a82496768ffcce282fb7f7b7
|
diff --git a/src/borg/helpers.py b/src/borg/helpers.py
index a93ba710..3fc22e7c 100644
--- a/src/borg/helpers.py
+++ b/src/borg/helpers.py
@@ -769,7 +769,7 @@ def bin_to_hex(binary):
class Location:
"""Object representing a repository / archive location
"""
- proto = user = host = port = path = archive = None
+ proto = user = _host = port = path = archive = None
# user must not contain "@", ":" or "/".
# Quoting adduser error message:
@@ -814,7 +814,7 @@ class Location:
ssh_re = re.compile(r"""
(?P<proto>ssh):// # ssh://
""" + optional_user_re + r""" # user@ (optional)
- (?P<host>[^:/]+)(?::(?P<port>\d+))? # host or host:port
+ (?P<host>([^:/]+|\[[0-9a-fA-F:.]+\]))(?::(?P<port>\d+))? # host or host:port or [ipv6] or [ipv6]:port
""" + abs_path_re + optional_archive_re, re.VERBOSE) # path or path::archive
file_re = re.compile(r"""
@@ -825,7 +825,7 @@ class Location:
scp_re = re.compile(r"""
(
""" + optional_user_re + r""" # user@ (optional)
- (?P<host>[^:/]+): # host: (don't match / in host to disambiguate from file:)
+ (?P<host>([^:/]+|\[[0-9a-fA-F:.]+\])): # host: (don't match / or [ipv6] in host to disambiguate from file:)
)? # user@host: part is optional
""" + scp_path_re + optional_archive_re, re.VERBOSE) # path with optional archive
@@ -841,7 +841,7 @@ class Location:
def __init__(self, text=''):
self.orig = text
if not self.parse(self.orig):
- raise ValueError
+ raise ValueError('Location: parse failed: %s' % self.orig)
def parse(self, text):
text = replace_placeholders(text)
@@ -871,7 +871,7 @@ def normpath_special(p):
if m:
self.proto = m.group('proto')
self.user = m.group('user')
- self.host = m.group('host')
+ self._host = m.group('host')
self.port = m.group('port') and int(m.group('port')) or None
self.path = normpath_special(m.group('path'))
self.archive = m.group('archive')
@@ -885,10 +885,10 @@ def normpath_special(p):
m = self.scp_re.match(text)
if m:
self.user = m.group('user')
- self.host = m.group('host')
+ self._host = m.group('host')
self.path = normpath_special(m.group('path'))
self.archive = m.group('archive')
- self.proto = self.host and 'ssh' or 'file'
+ self.proto = self._host and 'ssh' or 'file'
return True
return False
@@ -912,6 +912,12 @@ def to_key_filename(self):
def __repr__(self):
return "Location(%s)" % self
+ @property
+ def host(self):
+ # strip square brackets used for IPv6 addrs
+ if self._host is not None:
+ return self._host.lstrip('[').rstrip(']')
+
def canonical_path(self):
if self.proto == 'file':
return self.path
@@ -923,7 +929,7 @@ def canonical_path(self):
else:
path = self.path
return 'ssh://{}{}{}{}'.format('{}@'.format(self.user) if self.user else '',
- self.host,
+ self._host, # needed for ipv6 addrs
':{}'.format(self.port) if self.port else '',
path)
|
Please enable IPv6 addresses for remote repositories
Hello,
I was trying to specify a remote borg repo as something like that
ssh://user@[ipv6_address_string]:/path/to/repo
(and tried with leaving out the ssh:// in front, as well)
borg then somehow tried to read the ipv6 address as a hostname, and the hostname lookup naturally failed.
ssh supports ipv6 address string, by putting the address into a square bracket.
I have a use case where I want to backup to a remote repository via ssh onto a machine by ipv6. However, I do not want to expose machines IPv6 address to DNS, that's why I would like to use an address literal instead of a dns domain name in the remote repo url.
Regards,
wararjey
|
borgbackup/borg
|
diff --git a/src/borg/testsuite/helpers.py b/src/borg/testsuite/helpers.py
index ff6b5efe..7ce22dc2 100644
--- a/src/borg/testsuite/helpers.py
+++ b/src/borg/testsuite/helpers.py
@@ -58,6 +58,30 @@ def test_ssh(self, monkeypatch):
"Location(proto='ssh', user='user', host='host', port=1234, path='/some/path', archive=None)"
assert repr(Location('ssh://user@host/some/path')) == \
"Location(proto='ssh', user='user', host='host', port=None, path='/some/path', archive=None)"
+ assert repr(Location('ssh://user@[::]:1234/some/path::archive')) == \
+ "Location(proto='ssh', user='user', host='::', port=1234, path='/some/path', archive='archive')"
+ assert repr(Location('ssh://user@[::]:1234/some/path')) == \
+ "Location(proto='ssh', user='user', host='::', port=1234, path='/some/path', archive=None)"
+ assert repr(Location('ssh://user@[::]/some/path')) == \
+ "Location(proto='ssh', user='user', host='::', port=None, path='/some/path', archive=None)"
+ assert repr(Location('ssh://user@[2001:db8::]:1234/some/path::archive')) == \
+ "Location(proto='ssh', user='user', host='2001:db8::', port=1234, path='/some/path', archive='archive')"
+ assert repr(Location('ssh://user@[2001:db8::]:1234/some/path')) == \
+ "Location(proto='ssh', user='user', host='2001:db8::', port=1234, path='/some/path', archive=None)"
+ assert repr(Location('ssh://user@[2001:db8::]/some/path')) == \
+ "Location(proto='ssh', user='user', host='2001:db8::', port=None, path='/some/path', archive=None)"
+ assert repr(Location('ssh://user@[2001:db8::c0:ffee]:1234/some/path::archive')) == \
+ "Location(proto='ssh', user='user', host='2001:db8::c0:ffee', port=1234, path='/some/path', archive='archive')"
+ assert repr(Location('ssh://user@[2001:db8::c0:ffee]:1234/some/path')) == \
+ "Location(proto='ssh', user='user', host='2001:db8::c0:ffee', port=1234, path='/some/path', archive=None)"
+ assert repr(Location('ssh://user@[2001:db8::c0:ffee]/some/path')) == \
+ "Location(proto='ssh', user='user', host='2001:db8::c0:ffee', port=None, path='/some/path', archive=None)"
+ assert repr(Location('ssh://user@[2001:db8::192.0.2.1]:1234/some/path::archive')) == \
+ "Location(proto='ssh', user='user', host='2001:db8::192.0.2.1', port=1234, path='/some/path', archive='archive')"
+ assert repr(Location('ssh://user@[2001:db8::192.0.2.1]:1234/some/path')) == \
+ "Location(proto='ssh', user='user', host='2001:db8::192.0.2.1', port=1234, path='/some/path', archive=None)"
+ assert repr(Location('ssh://user@[2001:db8::192.0.2.1]/some/path')) == \
+ "Location(proto='ssh', user='user', host='2001:db8::192.0.2.1', port=None, path='/some/path', archive=None)"
def test_file(self, monkeypatch):
monkeypatch.delenv('BORG_REPO', raising=False)
@@ -72,6 +96,22 @@ def test_scp(self, monkeypatch):
"Location(proto='ssh', user='user', host='host', port=None, path='/some/path', archive='archive')"
assert repr(Location('user@host:/some/path')) == \
"Location(proto='ssh', user='user', host='host', port=None, path='/some/path', archive=None)"
+ assert repr(Location('user@[::]:/some/path::archive')) == \
+ "Location(proto='ssh', user='user', host='::', port=None, path='/some/path', archive='archive')"
+ assert repr(Location('user@[::]:/some/path')) == \
+ "Location(proto='ssh', user='user', host='::', port=None, path='/some/path', archive=None)"
+ assert repr(Location('user@[2001:db8::]:/some/path::archive')) == \
+ "Location(proto='ssh', user='user', host='2001:db8::', port=None, path='/some/path', archive='archive')"
+ assert repr(Location('user@[2001:db8::]:/some/path')) == \
+ "Location(proto='ssh', user='user', host='2001:db8::', port=None, path='/some/path', archive=None)"
+ assert repr(Location('user@[2001:db8::c0:ffee]:/some/path::archive')) == \
+ "Location(proto='ssh', user='user', host='2001:db8::c0:ffee', port=None, path='/some/path', archive='archive')"
+ assert repr(Location('user@[2001:db8::c0:ffee]:/some/path')) == \
+ "Location(proto='ssh', user='user', host='2001:db8::c0:ffee', port=None, path='/some/path', archive=None)"
+ assert repr(Location('user@[2001:db8::192.0.2.1]:/some/path::archive')) == \
+ "Location(proto='ssh', user='user', host='2001:db8::192.0.2.1', port=None, path='/some/path', archive='archive')"
+ assert repr(Location('user@[2001:db8::192.0.2.1]:/some/path')) == \
+ "Location(proto='ssh', user='user', host='2001:db8::192.0.2.1', port=None, path='/some/path', archive=None)"
def test_smb(self, monkeypatch):
monkeypatch.delenv('BORG_REPO', raising=False)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 1
}
|
1.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-xdist pytest-cov pytest-benchmark"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc libssl-dev liblz4-dev libacl1-dev libfuse-dev"
],
"python": "3.9",
"reqs_path": [
"requirements.d/development.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/borgbackup/borg.git@5a667d6f6aad54ba1246fee4dbf54a67f75b80f4#egg=borgbackup
cachetools==5.5.2
chardet==5.2.0
colorama==0.4.6
coverage==7.8.0
Cython==3.0.12
distlib==0.3.9
exceptiongroup==1.2.2
execnet==2.1.1
filelock==3.18.0
iniconfig==2.1.0
msgpack-python==0.5.6
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
py-cpuinfo==9.0.0
pyproject-api==1.9.0
pytest==8.3.5
pytest-benchmark==5.1.0
pytest-cov==6.0.0
pytest-xdist==3.6.1
setuptools-scm==8.2.0
tomli==2.2.1
tox==4.25.0
typing_extensions==4.13.0
virtualenv==20.29.3
|
name: borg
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- cachetools==5.5.2
- chardet==5.2.0
- colorama==0.4.6
- coverage==7.8.0
- cython==3.0.12
- distlib==0.3.9
- exceptiongroup==1.2.2
- execnet==2.1.1
- filelock==3.18.0
- iniconfig==2.1.0
- msgpack-python==0.5.6
- packaging==24.2
- platformdirs==4.3.7
- pluggy==1.5.0
- py-cpuinfo==9.0.0
- pyproject-api==1.9.0
- pytest==8.3.5
- pytest-benchmark==5.1.0
- pytest-cov==6.0.0
- pytest-xdist==3.6.1
- setuptools-scm==8.2.0
- tomli==2.2.1
- tox==4.25.0
- typing-extensions==4.13.0
- virtualenv==20.29.3
prefix: /opt/conda/envs/borg
|
[
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_ssh",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_scp"
] |
[
"src/borg/testsuite/helpers.py::test_is_slow_msgpack"
] |
[
"src/borg/testsuite/helpers.py::BigIntTestCase::test_bigint",
"src/borg/testsuite/helpers.py::test_bin_to_hex",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_file",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_smb",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_folder",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_abspath",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_relpath",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_with_colons",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_user_parsing",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_underspecified",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_no_slashes",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_canonical_path",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_format_path",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_bad_syntax",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_ssh",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_file",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_scp",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_folder",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_abspath",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_relpath",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_with_colons",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_no_slashes",
"src/borg/testsuite/helpers.py::FormatTimedeltaTestCase::test",
"src/borg/testsuite/helpers.py::test_chunkerparams",
"src/borg/testsuite/helpers.py::MakePathSafeTestCase::test",
"src/borg/testsuite/helpers.py::PruneSplitTestCase::test",
"src/borg/testsuite/helpers.py::PruneWithinTestCase::test",
"src/borg/testsuite/helpers.py::StableDictTestCase::test",
"src/borg/testsuite/helpers.py::TestParseTimestamp::test",
"src/borg/testsuite/helpers.py::test_get_cache_dir",
"src/borg/testsuite/helpers.py::test_get_keys_dir",
"src/borg/testsuite/helpers.py::test_get_security_dir",
"src/borg/testsuite/helpers.py::test_file_size",
"src/borg/testsuite/helpers.py::test_file_size_precision",
"src/borg/testsuite/helpers.py::test_file_size_sign",
"src/borg/testsuite/helpers.py::test_parse_file_size[1-1]",
"src/borg/testsuite/helpers.py::test_parse_file_size[20-20]",
"src/borg/testsuite/helpers.py::test_parse_file_size[5K-5000]",
"src/borg/testsuite/helpers.py::test_parse_file_size[1.75M-1750000]",
"src/borg/testsuite/helpers.py::test_parse_file_size[1e+9-1000000000.0]",
"src/borg/testsuite/helpers.py::test_parse_file_size[-1T--1000000000000.0]",
"src/borg/testsuite/helpers.py::test_parse_file_size_invalid[]",
"src/borg/testsuite/helpers.py::test_parse_file_size_invalid[5",
"src/borg/testsuite/helpers.py::test_parse_file_size_invalid[4E]",
"src/borg/testsuite/helpers.py::test_parse_file_size_invalid[2229",
"src/borg/testsuite/helpers.py::test_parse_file_size_invalid[1B]",
"src/borg/testsuite/helpers.py::TestBuffer::test_type",
"src/borg/testsuite/helpers.py::TestBuffer::test_len",
"src/borg/testsuite/helpers.py::TestBuffer::test_resize",
"src/borg/testsuite/helpers.py::TestBuffer::test_limit",
"src/borg/testsuite/helpers.py::TestBuffer::test_get",
"src/borg/testsuite/helpers.py::test_yes_input",
"src/borg/testsuite/helpers.py::test_yes_input_defaults",
"src/borg/testsuite/helpers.py::test_yes_input_custom",
"src/borg/testsuite/helpers.py::test_yes_env",
"src/borg/testsuite/helpers.py::test_yes_env_default",
"src/borg/testsuite/helpers.py::test_yes_defaults",
"src/borg/testsuite/helpers.py::test_yes_retry",
"src/borg/testsuite/helpers.py::test_yes_no_retry",
"src/borg/testsuite/helpers.py::test_yes_output",
"src/borg/testsuite/helpers.py::test_yes_env_output",
"src/borg/testsuite/helpers.py::test_progress_percentage_sameline",
"src/borg/testsuite/helpers.py::test_progress_percentage_step",
"src/borg/testsuite/helpers.py::test_progress_percentage_quiet",
"src/borg/testsuite/helpers.py::test_progress_endless",
"src/borg/testsuite/helpers.py::test_progress_endless_step",
"src/borg/testsuite/helpers.py::test_partial_format",
"src/borg/testsuite/helpers.py::test_chunk_file_wrapper",
"src/borg/testsuite/helpers.py::test_chunkit",
"src/borg/testsuite/helpers.py::test_clean_lines",
"src/borg/testsuite/helpers.py::test_format_line",
"src/borg/testsuite/helpers.py::test_format_line_erroneous",
"src/borg/testsuite/helpers.py::test_replace_placeholders",
"src/borg/testsuite/helpers.py::test_swidth_slice",
"src/borg/testsuite/helpers.py::test_swidth_slice_mixed_characters",
"src/borg/testsuite/helpers.py::test_safe_timestamps",
"src/borg/testsuite/helpers.py::TestPopenWithErrorHandling::test_simple",
"src/borg/testsuite/helpers.py::TestPopenWithErrorHandling::test_not_found",
"src/borg/testsuite/helpers.py::TestPopenWithErrorHandling::test_bad_syntax[mismatched",
"src/borg/testsuite/helpers.py::TestPopenWithErrorHandling::test_bad_syntax[foo",
"src/borg/testsuite/helpers.py::TestPopenWithErrorHandling::test_bad_syntax[]",
"src/borg/testsuite/helpers.py::TestPopenWithErrorHandling::test_shell"
] |
[] |
BSD License
| 1,290 |
|
zopefoundation__zope.mkzeoinstance-7
|
7ed33bb183929e5645a71950f5032018acbbda51
|
2017-05-23 09:43:28
|
7ed33bb183929e5645a71950f5032018acbbda51
|
diff --git a/CHANGES.rst b/CHANGES.rst
index 607054e..f794d66 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,7 +4,7 @@ Changelog
4.1 (unreleased)
----------------
-- Nothing changed yet.
+- Fix generated ``runzeo`` and ``zeoctl`` scripts to run with ZEO 5.
4.0 (2017-02-28)
diff --git a/src/zope/mkzeoinstance/__init__.py b/src/zope/mkzeoinstance/__init__.py
index 9b6fe44..8053e92 100644
--- a/src/zope/mkzeoinstance/__init__.py
+++ b/src/zope/mkzeoinstance/__init__.py
@@ -116,9 +116,7 @@ CONFIG_FILE="%(instance_home)s/etc/%(package)s.conf"
PYTHONPATH="$ZODB3_HOME"
export PYTHONPATH INSTANCE_HOME
-ZEOCTL="$ZODB3_HOME/ZEO/zeoctl.py"
-
-exec "$PYTHON" "$ZEOCTL" -C "$CONFIG_FILE" ${1+"$@"}
+exec "$PYTHON" -m ZEO.zeoctl -C "$CONFIG_FILE" ${1+"$@"}
"""
@@ -135,9 +133,7 @@ CONFIG_FILE="%(instance_home)s/etc/%(package)s.conf"
PYTHONPATH="$ZODB3_HOME"
export PYTHONPATH INSTANCE_HOME
-RUNZEO="$ZODB3_HOME/ZEO/runzeo.py"
-
-exec "$PYTHON" "$RUNZEO" -C "$CONFIG_FILE" ${1+"$@"}
+exec "$PYTHON" -m ZEO.runzeo -C "$CONFIG_FILE" ${1+"$@"}
"""
@@ -197,7 +193,7 @@ class ZEOInstanceBuilder:
if k in ('-h', '--help'):
usage(rc=2)
- if len(args) < 1 or len(args) > 2:
+ if len(args) < 1 or len(args) > 2:
usage(rc=1)
instance_home = os.path.abspath(args[0])
|
Broken with ZEO 5.1.1: runzeo and zeoctl fails.
While investigating zopefoundation/ZEO#87 I figured out, that the scripts running zeoctl and runzeo are no longer working due to usage of relative imports in ZEO.runzeo and ZEO.zeoctl.
It looks like the clean way is to not call the files as scripts, but execute them as modules.
|
zopefoundation/zope.mkzeoinstance
|
diff --git a/src/zope/mkzeoinstance/tests/test_unix.py b/src/zope/mkzeoinstance/tests/test_unix.py
index 68c4a2a..89c5c07 100644
--- a/src/zope/mkzeoinstance/tests/test_unix.py
+++ b/src/zope/mkzeoinstance/tests/test_unix.py
@@ -271,9 +271,7 @@ class ZEOInstanceBuilderTests(_WithTempdir, unittest.TestCase):
'PYTHONPATH="$ZODB3_HOME"',
'export PYTHONPATH INSTANCE_HOME',
'',
- 'ZEOCTL="$ZODB3_HOME/ZEO/zeoctl.py"',
- '',
- 'exec "$PYTHON" "$ZEOCTL" -C "$CONFIG_FILE" ${1+"$@"}',
+ 'exec "$PYTHON" -m ZEO.zeoctl -C "$CONFIG_FILE" ${1+"$@"}',
'',
]) % params
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 2
}
|
4.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[test]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"coverage"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
BTrees==6.1
cffi==1.17.1
coverage==7.8.0
exceptiongroup==1.2.2
iniconfig==2.1.0
packaging==24.2
persistent==6.1.1
pluggy==1.5.0
pycparser==2.22
pytest==8.3.5
tomli==2.2.1
transaction==5.0
zc.lockfile==3.0.post1
ZConfig==4.2
zdaemon==5.1
ZEO==6.0.0
ZODB==6.0
zodbpickle==4.2
zope.deferredimport==5.0
zope.interface==7.2
-e git+https://github.com/zopefoundation/zope.mkzeoinstance.git@7ed33bb183929e5645a71950f5032018acbbda51#egg=zope.mkzeoinstance
zope.proxy==6.1
|
name: zope.mkzeoinstance
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- btrees==6.1
- cffi==1.17.1
- coverage==7.8.0
- exceptiongroup==1.2.2
- iniconfig==2.1.0
- packaging==24.2
- persistent==6.1.1
- pluggy==1.5.0
- pycparser==2.22
- pytest==8.3.5
- tomli==2.2.1
- transaction==5.0
- zc-lockfile==3.0.post1
- zconfig==4.2
- zdaemon==5.1
- zeo==6.0.0
- zodb==6.0
- zodbpickle==4.2
- zope-deferredimport==5.0
- zope-interface==7.2
- zope-proxy==6.1
prefix: /opt/conda/envs/zope.mkzeoinstance
|
[
"src/zope/mkzeoinstance/tests/test_unix.py::ZEOInstanceBuilderTests::test_zeoctl_content"
] |
[] |
[
"src/zope/mkzeoinstance/tests/test_unix.py::Test_print_::test_print__no_args_no_kw",
"src/zope/mkzeoinstance/tests/test_unix.py::Test_print_::test_print__w_args",
"src/zope/mkzeoinstance/tests/test_unix.py::Test_print_::test_print__w_kw",
"src/zope/mkzeoinstance/tests/test_unix.py::Test_usage::test_defaults",
"src/zope/mkzeoinstance/tests/test_unix.py::Test_usage::test_explicit",
"src/zope/mkzeoinstance/tests/test_unix.py::Test_usage::test_w_non_str_message",
"src/zope/mkzeoinstance/tests/test_unix.py::ZEOInstanceBuilderTests::test_create_folders_and_files",
"src/zope/mkzeoinstance/tests/test_unix.py::ZEOInstanceBuilderTests::test_get_params",
"src/zope/mkzeoinstance/tests/test_unix.py::ZEOInstanceBuilderTests::test_run_w_help",
"src/zope/mkzeoinstance/tests/test_unix.py::ZEOInstanceBuilderTests::test_run_w_invalid_opt",
"src/zope/mkzeoinstance/tests/test_unix.py::ZEOInstanceBuilderTests::test_run_w_too_many_arguments",
"src/zope/mkzeoinstance/tests/test_unix.py::ZEOInstanceBuilderTests::test_run_wo_arguments",
"src/zope/mkzeoinstance/tests/test_unix.py::ZEOInstanceBuilderTests::test_run_wo_single_arg_non_absolute",
"src/zope/mkzeoinstance/tests/test_unix.py::ZEOInstanceBuilderTests::test_run_wo_two_args_no_host",
"src/zope/mkzeoinstance/tests/test_unix.py::ZEOInstanceBuilderTests::test_run_wo_two_args_w_host",
"src/zope/mkzeoinstance/tests/test_unix.py::ZEOInstanceBuilderTests::test_zeo_conf_content",
"src/zope/mkzeoinstance/tests/test_unix.py::UtilityFunctionsTest::test_makedir",
"src/zope/mkzeoinstance/tests/test_unix.py::UtilityFunctionsTest::test_makefile",
"src/zope/mkzeoinstance/tests/test_unix.py::UtilityFunctionsTest::test_makefile_existing_different_content",
"src/zope/mkzeoinstance/tests/test_unix.py::UtilityFunctionsTest::test_makefile_existing_same_content",
"src/zope/mkzeoinstance/tests/test_unix.py::UtilityFunctionsTest::test_makexfile",
"src/zope/mkzeoinstance/tests/test_unix.py::UtilityFunctionsTest::test_mkdirs",
"src/zope/mkzeoinstance/tests/test_unix.py::UtilityFunctionsTest::test_mkdirs_nested"
] |
[] | null | 1,293 |
|
borgbackup__borg-2566
|
2dcbe02e5ae2c5674b350866b145c028966e1664
|
2017-05-25 10:37:50
|
a439fa3e720c8bb2a82496768ffcce282fb7f7b7
|
diff --git a/src/borg/helpers.py b/src/borg/helpers.py
index 15f56437..db66b822 100644
--- a/src/borg/helpers.py
+++ b/src/borg/helpers.py
@@ -916,7 +916,12 @@ def __str__(self):
def to_key_filename(self):
name = re.sub('[^\w]', '_', self.path).strip('_')
if self.proto != 'file':
- name = self.host + '__' + name
+ name = re.sub('[^\w]', '_', self.host) + '__' + name
+ if len(name) > 100:
+ # Limit file names to some reasonable length. Most file systems
+ # limit them to 255 [unit of choice]; due to variations in unicode
+ # handling we truncate to 100 *characters*.
+ name = name[:100]
return os.path.join(get_keys_dir(), name)
def __repr__(self):
|
Restrict file names generated by Location.to_keyfile_name
The generated file can currently include special characters like those mentioned in #2290, which should be stripped for compatibility reasons.
From #2555
|
borgbackup/borg
|
diff --git a/src/borg/testsuite/helpers.py b/src/borg/testsuite/helpers.py
index 7ce22dc2..b23e277b 100644
--- a/src/borg/testsuite/helpers.py
+++ b/src/borg/testsuite/helpers.py
@@ -50,10 +50,19 @@ def test_bin_to_hex():
class TestLocationWithoutEnv:
- def test_ssh(self, monkeypatch):
+ @pytest.fixture
+ def keys_dir(self, tmpdir, monkeypatch):
+ tmpdir = str(tmpdir)
+ monkeypatch.setenv('BORG_KEYS_DIR', tmpdir)
+ if not tmpdir.endswith(os.path.sep):
+ tmpdir += os.path.sep
+ return tmpdir
+
+ def test_ssh(self, monkeypatch, keys_dir):
monkeypatch.delenv('BORG_REPO', raising=False)
assert repr(Location('ssh://user@host:1234/some/path::archive')) == \
"Location(proto='ssh', user='user', host='host', port=1234, path='/some/path', archive='archive')"
+ assert Location('ssh://user@host:1234/some/path::archive').to_key_filename() == keys_dir + 'host__some_path'
assert repr(Location('ssh://user@host:1234/some/path')) == \
"Location(proto='ssh', user='user', host='host', port=1234, path='/some/path', archive=None)"
assert repr(Location('ssh://user@host/some/path')) == \
@@ -62,12 +71,14 @@ def test_ssh(self, monkeypatch):
"Location(proto='ssh', user='user', host='::', port=1234, path='/some/path', archive='archive')"
assert repr(Location('ssh://user@[::]:1234/some/path')) == \
"Location(proto='ssh', user='user', host='::', port=1234, path='/some/path', archive=None)"
+ assert Location('ssh://user@[::]:1234/some/path').to_key_filename() == keys_dir + '____some_path'
assert repr(Location('ssh://user@[::]/some/path')) == \
"Location(proto='ssh', user='user', host='::', port=None, path='/some/path', archive=None)"
assert repr(Location('ssh://user@[2001:db8::]:1234/some/path::archive')) == \
"Location(proto='ssh', user='user', host='2001:db8::', port=1234, path='/some/path', archive='archive')"
assert repr(Location('ssh://user@[2001:db8::]:1234/some/path')) == \
"Location(proto='ssh', user='user', host='2001:db8::', port=1234, path='/some/path', archive=None)"
+ assert Location('ssh://user@[2001:db8::]:1234/some/path').to_key_filename() == keys_dir + '2001_db8____some_path'
assert repr(Location('ssh://user@[2001:db8::]/some/path')) == \
"Location(proto='ssh', user='user', host='2001:db8::', port=None, path='/some/path', archive=None)"
assert repr(Location('ssh://user@[2001:db8::c0:ffee]:1234/some/path::archive')) == \
@@ -82,15 +93,17 @@ def test_ssh(self, monkeypatch):
"Location(proto='ssh', user='user', host='2001:db8::192.0.2.1', port=1234, path='/some/path', archive=None)"
assert repr(Location('ssh://user@[2001:db8::192.0.2.1]/some/path')) == \
"Location(proto='ssh', user='user', host='2001:db8::192.0.2.1', port=None, path='/some/path', archive=None)"
+ assert Location('ssh://user@[2001:db8::192.0.2.1]/some/path').to_key_filename() == keys_dir + '2001_db8__192_0_2_1__some_path'
- def test_file(self, monkeypatch):
+ def test_file(self, monkeypatch, keys_dir):
monkeypatch.delenv('BORG_REPO', raising=False)
assert repr(Location('file:///some/path::archive')) == \
"Location(proto='file', user=None, host=None, port=None, path='/some/path', archive='archive')"
assert repr(Location('file:///some/path')) == \
"Location(proto='file', user=None, host=None, port=None, path='/some/path', archive=None)"
+ assert Location('file:///some/path').to_key_filename() == keys_dir + 'some_path'
- def test_scp(self, monkeypatch):
+ def test_scp(self, monkeypatch, keys_dir):
monkeypatch.delenv('BORG_REPO', raising=False)
assert repr(Location('user@host:/some/path::archive')) == \
"Location(proto='ssh', user='user', host='host', port=None, path='/some/path', archive='archive')"
@@ -112,42 +125,55 @@ def test_scp(self, monkeypatch):
"Location(proto='ssh', user='user', host='2001:db8::192.0.2.1', port=None, path='/some/path', archive='archive')"
assert repr(Location('user@[2001:db8::192.0.2.1]:/some/path')) == \
"Location(proto='ssh', user='user', host='2001:db8::192.0.2.1', port=None, path='/some/path', archive=None)"
+ assert Location('user@[2001:db8::192.0.2.1]:/some/path').to_key_filename() == keys_dir + '2001_db8__192_0_2_1__some_path'
- def test_smb(self, monkeypatch):
+ def test_smb(self, monkeypatch, keys_dir):
monkeypatch.delenv('BORG_REPO', raising=False)
assert repr(Location('file:////server/share/path::archive')) == \
"Location(proto='file', user=None, host=None, port=None, path='//server/share/path', archive='archive')"
+ assert Location('file:////server/share/path::archive').to_key_filename() == keys_dir + 'server_share_path'
- def test_folder(self, monkeypatch):
+ def test_folder(self, monkeypatch, keys_dir):
monkeypatch.delenv('BORG_REPO', raising=False)
assert repr(Location('path::archive')) == \
"Location(proto='file', user=None, host=None, port=None, path='path', archive='archive')"
assert repr(Location('path')) == \
"Location(proto='file', user=None, host=None, port=None, path='path', archive=None)"
+ assert Location('path').to_key_filename() == keys_dir + 'path'
- def test_abspath(self, monkeypatch):
+ def test_long_path(self, monkeypatch, keys_dir):
+ monkeypatch.delenv('BORG_REPO', raising=False)
+ assert Location(os.path.join(*(40 * ['path']))).to_key_filename() == keys_dir + '_'.join(20 * ['path']) + '_'
+
+ def test_abspath(self, monkeypatch, keys_dir):
monkeypatch.delenv('BORG_REPO', raising=False)
assert repr(Location('/some/absolute/path::archive')) == \
"Location(proto='file', user=None, host=None, port=None, path='/some/absolute/path', archive='archive')"
assert repr(Location('/some/absolute/path')) == \
"Location(proto='file', user=None, host=None, port=None, path='/some/absolute/path', archive=None)"
+ assert Location('/some/absolute/path').to_key_filename() == keys_dir + 'some_absolute_path'
assert repr(Location('ssh://user@host/some/path')) == \
"Location(proto='ssh', user='user', host='host', port=None, path='/some/path', archive=None)"
+ assert Location('ssh://user@host/some/path').to_key_filename() == keys_dir + 'host__some_path'
- def test_relpath(self, monkeypatch):
+ def test_relpath(self, monkeypatch, keys_dir):
monkeypatch.delenv('BORG_REPO', raising=False)
assert repr(Location('some/relative/path::archive')) == \
"Location(proto='file', user=None, host=None, port=None, path='some/relative/path', archive='archive')"
assert repr(Location('some/relative/path')) == \
"Location(proto='file', user=None, host=None, port=None, path='some/relative/path', archive=None)"
+ assert Location('some/relative/path').to_key_filename() == keys_dir + 'some_relative_path'
assert repr(Location('ssh://user@host/./some/path')) == \
"Location(proto='ssh', user='user', host='host', port=None, path='/./some/path', archive=None)"
+ assert Location('ssh://user@host/./some/path').to_key_filename() == keys_dir + 'host__some_path'
assert repr(Location('ssh://user@host/~/some/path')) == \
"Location(proto='ssh', user='user', host='host', port=None, path='/~/some/path', archive=None)"
+ assert Location('ssh://user@host/~/some/path').to_key_filename() == keys_dir + 'host__some_path'
assert repr(Location('ssh://user@host/~user/some/path')) == \
"Location(proto='ssh', user='user', host='host', port=None, path='/~user/some/path', archive=None)"
+ assert Location('ssh://user@host/~user/some/path').to_key_filename() == keys_dir + 'host__user_some_path'
- def test_with_colons(self, monkeypatch):
+ def test_with_colons(self, monkeypatch, keys_dir):
monkeypatch.delenv('BORG_REPO', raising=False)
assert repr(Location('/abs/path:w:cols::arch:col')) == \
"Location(proto='file', user=None, host=None, port=None, path='/abs/path:w:cols', archive='arch:col')"
@@ -155,6 +181,7 @@ def test_with_colons(self, monkeypatch):
"Location(proto='file', user=None, host=None, port=None, path='/abs/path:with:colons', archive='archive')"
assert repr(Location('/abs/path:with:colons')) == \
"Location(proto='file', user=None, host=None, port=None, path='/abs/path:with:colons', archive=None)"
+ assert Location('/abs/path:with:colons').to_key_filename() == keys_dir + 'abs_path_with_colons'
def test_user_parsing(self):
# see issue #1930
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_issue_reference"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 1
},
"num_modified_files": 1
}
|
1.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[fuse]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc libssl-dev libacl1-dev liblz4-dev libfuse-dev pkg-config"
],
"python": "3.9",
"reqs_path": [
"requirements.d/development.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/borgbackup/borg.git@2dcbe02e5ae2c5674b350866b145c028966e1664#egg=borgbackup
cachetools==5.5.2
chardet==5.2.0
colorama==0.4.6
coverage==7.8.0
Cython==3.0.12
distlib==0.3.9
exceptiongroup==1.2.2
execnet==2.1.1
filelock==3.18.0
iniconfig==2.1.0
llfuse==1.5.1
msgpack-python==0.5.6
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
py-cpuinfo==9.0.0
pyproject-api==1.9.0
pytest==8.3.5
pytest-benchmark==5.1.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
setuptools-scm==8.2.0
tomli==2.2.1
tox==4.25.0
typing_extensions==4.13.0
virtualenv==20.29.3
|
name: borg
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- cachetools==5.5.2
- chardet==5.2.0
- colorama==0.4.6
- coverage==7.8.0
- cython==3.0.12
- distlib==0.3.9
- exceptiongroup==1.2.2
- execnet==2.1.1
- filelock==3.18.0
- iniconfig==2.1.0
- llfuse==1.5.1
- msgpack-python==0.5.6
- packaging==24.2
- platformdirs==4.3.7
- pluggy==1.5.0
- py-cpuinfo==9.0.0
- pyproject-api==1.9.0
- pytest==8.3.5
- pytest-benchmark==5.1.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- setuptools-scm==8.2.0
- tomli==2.2.1
- tox==4.25.0
- typing-extensions==4.13.0
- virtualenv==20.29.3
prefix: /opt/conda/envs/borg
|
[
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_ssh",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_scp",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_long_path"
] |
[
"src/borg/testsuite/helpers.py::test_is_slow_msgpack"
] |
[
"src/borg/testsuite/helpers.py::BigIntTestCase::test_bigint",
"src/borg/testsuite/helpers.py::test_bin_to_hex",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_file",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_smb",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_folder",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_abspath",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_relpath",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_with_colons",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_user_parsing",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_underspecified",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_no_slashes",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_canonical_path",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_format_path",
"src/borg/testsuite/helpers.py::TestLocationWithoutEnv::test_bad_syntax",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_ssh",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_file",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_scp",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_folder",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_abspath",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_relpath",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_with_colons",
"src/borg/testsuite/helpers.py::TestLocationWithEnv::test_no_slashes",
"src/borg/testsuite/helpers.py::FormatTimedeltaTestCase::test",
"src/borg/testsuite/helpers.py::test_chunkerparams",
"src/borg/testsuite/helpers.py::MakePathSafeTestCase::test",
"src/borg/testsuite/helpers.py::PruneSplitTestCase::test",
"src/borg/testsuite/helpers.py::PruneWithinTestCase::test",
"src/borg/testsuite/helpers.py::StableDictTestCase::test",
"src/borg/testsuite/helpers.py::TestParseTimestamp::test",
"src/borg/testsuite/helpers.py::test_get_cache_dir",
"src/borg/testsuite/helpers.py::test_get_keys_dir",
"src/borg/testsuite/helpers.py::test_get_security_dir",
"src/borg/testsuite/helpers.py::test_file_size",
"src/borg/testsuite/helpers.py::test_file_size_precision",
"src/borg/testsuite/helpers.py::test_file_size_sign",
"src/borg/testsuite/helpers.py::test_parse_file_size[1-1]",
"src/borg/testsuite/helpers.py::test_parse_file_size[20-20]",
"src/borg/testsuite/helpers.py::test_parse_file_size[5K-5000]",
"src/borg/testsuite/helpers.py::test_parse_file_size[1.75M-1750000]",
"src/borg/testsuite/helpers.py::test_parse_file_size[1e+9-1000000000.0]",
"src/borg/testsuite/helpers.py::test_parse_file_size[-1T--1000000000000.0]",
"src/borg/testsuite/helpers.py::test_parse_file_size_invalid[]",
"src/borg/testsuite/helpers.py::test_parse_file_size_invalid[5",
"src/borg/testsuite/helpers.py::test_parse_file_size_invalid[4E]",
"src/borg/testsuite/helpers.py::test_parse_file_size_invalid[2229",
"src/borg/testsuite/helpers.py::test_parse_file_size_invalid[1B]",
"src/borg/testsuite/helpers.py::TestBuffer::test_type",
"src/borg/testsuite/helpers.py::TestBuffer::test_len",
"src/borg/testsuite/helpers.py::TestBuffer::test_resize",
"src/borg/testsuite/helpers.py::TestBuffer::test_limit",
"src/borg/testsuite/helpers.py::TestBuffer::test_get",
"src/borg/testsuite/helpers.py::test_yes_input",
"src/borg/testsuite/helpers.py::test_yes_input_defaults",
"src/borg/testsuite/helpers.py::test_yes_input_custom",
"src/borg/testsuite/helpers.py::test_yes_env",
"src/borg/testsuite/helpers.py::test_yes_env_default",
"src/borg/testsuite/helpers.py::test_yes_defaults",
"src/borg/testsuite/helpers.py::test_yes_retry",
"src/borg/testsuite/helpers.py::test_yes_no_retry",
"src/borg/testsuite/helpers.py::test_yes_output",
"src/borg/testsuite/helpers.py::test_yes_env_output",
"src/borg/testsuite/helpers.py::test_progress_percentage_sameline",
"src/borg/testsuite/helpers.py::test_progress_percentage_step",
"src/borg/testsuite/helpers.py::test_progress_percentage_quiet",
"src/borg/testsuite/helpers.py::test_progress_endless",
"src/borg/testsuite/helpers.py::test_progress_endless_step",
"src/borg/testsuite/helpers.py::test_partial_format",
"src/borg/testsuite/helpers.py::test_chunk_file_wrapper",
"src/borg/testsuite/helpers.py::test_chunkit",
"src/borg/testsuite/helpers.py::test_clean_lines",
"src/borg/testsuite/helpers.py::test_format_line",
"src/borg/testsuite/helpers.py::test_format_line_erroneous",
"src/borg/testsuite/helpers.py::test_replace_placeholders",
"src/borg/testsuite/helpers.py::test_swidth_slice",
"src/borg/testsuite/helpers.py::test_swidth_slice_mixed_characters",
"src/borg/testsuite/helpers.py::test_safe_timestamps",
"src/borg/testsuite/helpers.py::TestPopenWithErrorHandling::test_simple",
"src/borg/testsuite/helpers.py::TestPopenWithErrorHandling::test_not_found",
"src/borg/testsuite/helpers.py::TestPopenWithErrorHandling::test_bad_syntax[mismatched",
"src/borg/testsuite/helpers.py::TestPopenWithErrorHandling::test_bad_syntax[foo",
"src/borg/testsuite/helpers.py::TestPopenWithErrorHandling::test_bad_syntax[]",
"src/borg/testsuite/helpers.py::TestPopenWithErrorHandling::test_shell"
] |
[] |
BSD License
| 1,300 |
|
tornadoweb__tornado-2058
|
09e255779dc1db78a0c76e720660f802d7dc9cab
|
2017-05-26 13:21:43
|
03f13800e854a6fc9e6efa2168e694d9599348bd
|
jehiah: RFR @bdarnell
I've also done some preliminary validation that this solves the original issue I ran into.
jehiah: 🤦♂️ w/r/t executable bit. It seems my editor was doing that because those files begin with `#!/usr/bin/env python`. Is there a reason for/value in that if they should not be executable?
bdarnell: Thanks, just one more thing to figure out: the large-body chunked test cases are failing for some reason on windows (the fact that this happens on 2 of the 4 configurations on appveyor doesn't mean anything - we only run the full test suite on 2 configurations because tornado on windows is so slow). The `ExpectLog` is passing so the correct exception is getting raised. Maybe closing immediately after `yield stream.write` is not actually waiting for the outgoing data to be sent on windows because there is also unread data in the incoming socket buffer. This isn't too important so maybe these tests should just accept both 400 and 599 response codes.
There's no reason for the `#!/usr/bin/env python` line to be present in files that are not executable; this line could just be removed.
jehiah: @bdarnell updated to address flaky tests; if this looks good i'll squash/cleanup commits.
|
diff --git a/tornado/http1connection.py b/tornado/http1connection.py
index c6d3e336..6069e027 100644
--- a/tornado/http1connection.py
+++ b/tornado/http1connection.py
@@ -250,6 +250,8 @@ class HTTP1Connection(httputil.HTTPConnection):
except httputil.HTTPInputError as e:
gen_log.info("Malformed HTTP message from %s: %s",
self.context, e)
+ if not self.is_client:
+ yield self.stream.write(b'HTTP/1.1 400 Bad Request\r\n\r\n')
self.close()
raise gen.Return(False)
finally:
diff --git a/tornado/httputil.py b/tornado/httputil.py
old mode 100644
new mode 100755
index 818ea914..5b87ce61
--- a/tornado/httputil.py
+++ b/tornado/httputil.py
@@ -829,6 +829,8 @@ def parse_request_start_line(line):
try:
method, path, version = line.split(" ")
except ValueError:
+ # https://tools.ietf.org/html/rfc7230#section-3.1.1
+ # invalid request-line SHOULD respond with a 400 (Bad Request)
raise HTTPInputError("Malformed HTTP request line")
if not re.match(r"^HTTP/1\.[0-9]$", version):
raise HTTPInputError(
|
Empty reply on malformed HTTP request
When an incorrect HTTP request is performed, tornado makes no reply (log + return in code). I suggest returning an 400 error code.
For example, when working behind an nginx proxy-server, it causes a 502 error code to the end-user and a record in nginx's error log, which is incorrect (should be 400 and a warning).
|
tornadoweb/tornado
|
diff --git a/tornado/test/httpserver_test.py b/tornado/test/httpserver_test.py
index f5f91a9d..4169a43a 100644
--- a/tornado/test/httpserver_test.py
+++ b/tornado/test/httpserver_test.py
@@ -29,18 +29,19 @@ from io import BytesIO
def read_stream_body(stream, callback):
"""Reads an HTTP response from `stream` and runs callback with its
- headers and body."""
+ start_line, headers and body."""
chunks = []
class Delegate(HTTPMessageDelegate):
def headers_received(self, start_line, headers):
self.headers = headers
+ self.start_line = start_line
def data_received(self, chunk):
chunks.append(chunk)
def finish(self):
- callback((self.headers, b''.join(chunks)))
+ callback((self.start_line, self.headers, b''.join(chunks)))
conn = HTTP1Connection(stream, True)
conn.read_response(Delegate())
@@ -217,7 +218,7 @@ class HTTPConnectionTest(AsyncHTTPTestCase):
[utf8("Content-Length: %d" % len(body))]) +
newline + newline + body)
read_stream_body(stream, self.stop)
- headers, body = self.wait()
+ start_line, headers, body = self.wait()
return body
def test_multipart_form(self):
@@ -406,7 +407,15 @@ class HTTPServerRawTest(AsyncHTTPTestCase):
self.io_loop.add_timeout(datetime.timedelta(seconds=0.001), self.stop)
self.wait()
- def test_malformed_first_line(self):
+ def test_malformed_first_line_response(self):
+ self.stream.write(b'asdf\r\n\r\n')
+ read_stream_body(self.stream, self.stop)
+ start_line, headers, response = self.wait()
+ self.assertEqual('HTTP/1.1', start_line.version)
+ self.assertEqual(400, start_line.code)
+ self.assertEqual('Bad Request', start_line.reason)
+
+ def test_malformed_first_line_log(self):
with ExpectLog(gen_log, '.*Malformed HTTP request line'):
self.stream.write(b'asdf\r\n\r\n')
# TODO: need an async version of ExpectLog so we don't need
@@ -438,7 +447,7 @@ bar
""".replace(b"\n", b"\r\n"))
read_stream_body(self.stream, self.stop)
- headers, response = self.wait()
+ start_line, headers, response = self.wait()
self.assertEqual(json_decode(response), {u'foo': [u'bar']})
def test_chunked_request_uppercase(self):
@@ -457,7 +466,7 @@ bar
""".replace(b"\n", b"\r\n"))
read_stream_body(self.stream, self.stop)
- headers, response = self.wait()
+ start_line, headers, response = self.wait()
self.assertEqual(json_decode(response), {u'foo': [u'bar']})
def test_invalid_content_length(self):
@@ -627,7 +636,7 @@ class UnixSocketTest(AsyncTestCase):
self.stream.write(b"garbage\r\n\r\n")
self.stream.read_until_close(self.stop)
response = self.wait()
- self.assertEqual(response, b"")
+ self.assertEqual(response, b"HTTP/1.1 400 Bad Request\r\n\r\n")
class KeepAliveTest(AsyncHTTPTestCase):
@@ -1036,24 +1045,26 @@ class BodyLimitsTest(AsyncHTTPTestCase):
def test_large_body_buffered(self):
with ExpectLog(gen_log, '.*Content-Length too long'):
response = self.fetch('/buffered', method='PUT', body=b'a' * 10240)
- self.assertEqual(response.code, 599)
+ self.assertEqual(response.code, 400)
def test_large_body_buffered_chunked(self):
with ExpectLog(gen_log, '.*chunked body too large'):
response = self.fetch('/buffered', method='PUT',
body_producer=lambda write: write(b'a' * 10240))
- self.assertEqual(response.code, 599)
+ # this test is flaky on windows; accept 400 (expected) or 599
+ self.assertIn(response.code, [400, 599])
def test_large_body_streaming(self):
with ExpectLog(gen_log, '.*Content-Length too long'):
response = self.fetch('/streaming', method='PUT', body=b'a' * 10240)
- self.assertEqual(response.code, 599)
+ self.assertEqual(response.code, 400)
def test_large_body_streaming_chunked(self):
with ExpectLog(gen_log, '.*chunked body too large'):
response = self.fetch('/streaming', method='PUT',
body_producer=lambda write: write(b'a' * 10240))
- self.assertEqual(response.code, 599)
+ # this test is flaky on windows; accept 400 (expected) or 599
+ self.assertIn(response.code, [400, 599])
def test_large_body_streaming_override(self):
response = self.fetch('/streaming?expected_size=10240', method='PUT',
@@ -1090,14 +1101,14 @@ class BodyLimitsTest(AsyncHTTPTestCase):
stream.write(b'PUT /streaming?expected_size=10240 HTTP/1.1\r\n'
b'Content-Length: 10240\r\n\r\n')
stream.write(b'a' * 10240)
- headers, response = yield gen.Task(read_stream_body, stream)
+ start_line, headers, response = yield gen.Task(read_stream_body, stream)
self.assertEqual(response, b'10240')
# Without the ?expected_size parameter, we get the old default value
stream.write(b'PUT /streaming HTTP/1.1\r\n'
b'Content-Length: 10240\r\n\r\n')
with ExpectLog(gen_log, '.*Content-Length too long'):
data = yield stream.read_until_close()
- self.assertEqual(data, b'')
+ self.assertEqual(data, b'HTTP/1.1 400 Bad Request\r\n\r\n')
finally:
stream.close()
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 2
}
|
4.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"futures",
"mock",
"monotonic",
"trollius",
"sphinx",
"sphinx_rtd_theme",
"codecov",
"virtualenv",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
coverage==6.2
distlib==0.3.9
docutils==0.18.1
filelock==3.4.1
futures==2.2.0
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
Jinja2==3.0.3
MarkupSafe==2.0.1
mock==5.2.0
monotonic==1.6
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
platformdirs==2.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
Pygments==2.14.0
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytz==2025.2
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
-e git+https://github.com/tornadoweb/tornado.git@09e255779dc1db78a0c76e720660f802d7dc9cab#egg=tornado
trollius==2.1.post2
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
virtualenv==20.17.1
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: tornado
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- babel==2.11.0
- charset-normalizer==2.0.12
- codecov==2.1.13
- coverage==6.2
- distlib==0.3.9
- docutils==0.18.1
- filelock==3.4.1
- futures==2.2.0
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- jinja2==3.0.3
- markupsafe==2.0.1
- mock==5.2.0
- monotonic==1.6
- platformdirs==2.4.0
- pygments==2.14.0
- pytz==2025.2
- requests==2.27.1
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==5.3.0
- sphinx-rtd-theme==2.0.0
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- trollius==2.1.post2
- urllib3==1.26.20
- virtualenv==20.17.1
prefix: /opt/conda/envs/tornado
|
[
"tornado/test/httpserver_test.py::HTTPServerRawTest::test_malformed_first_line_response"
] |
[
"tornado/test/httpserver_test.py::HTTPServerRawTest::test_invalid_content_length",
"tornado/test/httpserver_test.py::HTTPServerRawTest::test_malformed_first_line_log",
"tornado/test/httpserver_test.py::HTTPServerRawTest::test_malformed_headers",
"tornado/test/httpserver_test.py::UnixSocketTest::test_unix_socket_bad_request",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_body_size_override_reset",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_large_body_buffered",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_large_body_buffered_chunked",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_large_body_streaming",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_large_body_streaming_chunked",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_timeout"
] |
[
"tornado/test/httpserver_test.py::SSLv23Test::test_error_logging",
"tornado/test/httpserver_test.py::SSLv23Test::test_large_post",
"tornado/test/httpserver_test.py::SSLv23Test::test_non_ssl_request",
"tornado/test/httpserver_test.py::SSLv23Test::test_ssl",
"tornado/test/httpserver_test.py::SSLv3Test::test_error_logging",
"tornado/test/httpserver_test.py::SSLv3Test::test_large_post",
"tornado/test/httpserver_test.py::SSLv3Test::test_non_ssl_request",
"tornado/test/httpserver_test.py::SSLv3Test::test_ssl",
"tornado/test/httpserver_test.py::TLSv1Test::test_error_logging",
"tornado/test/httpserver_test.py::TLSv1Test::test_large_post",
"tornado/test/httpserver_test.py::TLSv1Test::test_non_ssl_request",
"tornado/test/httpserver_test.py::TLSv1Test::test_ssl",
"tornado/test/httpserver_test.py::SSLContextTest::test_error_logging",
"tornado/test/httpserver_test.py::SSLContextTest::test_large_post",
"tornado/test/httpserver_test.py::SSLContextTest::test_non_ssl_request",
"tornado/test/httpserver_test.py::SSLContextTest::test_ssl",
"tornado/test/httpserver_test.py::BadSSLOptionsTest::test_missing_arguments",
"tornado/test/httpserver_test.py::BadSSLOptionsTest::test_missing_key",
"tornado/test/httpserver_test.py::HTTPConnectionTest::test_100_continue",
"tornado/test/httpserver_test.py::HTTPConnectionTest::test_multipart_form",
"tornado/test/httpserver_test.py::HTTPConnectionTest::test_newlines",
"tornado/test/httpserver_test.py::HTTPServerTest::test_double_slash",
"tornado/test/httpserver_test.py::HTTPServerTest::test_empty_post_parameters",
"tornado/test/httpserver_test.py::HTTPServerTest::test_empty_query_string",
"tornado/test/httpserver_test.py::HTTPServerTest::test_malformed_body",
"tornado/test/httpserver_test.py::HTTPServerTest::test_query_string_encoding",
"tornado/test/httpserver_test.py::HTTPServerTest::test_types",
"tornado/test/httpserver_test.py::HTTPServerRawTest::test_chunked_request_body",
"tornado/test/httpserver_test.py::HTTPServerRawTest::test_chunked_request_uppercase",
"tornado/test/httpserver_test.py::HTTPServerRawTest::test_empty_request",
"tornado/test/httpserver_test.py::XHeaderTest::test_ip_headers",
"tornado/test/httpserver_test.py::XHeaderTest::test_scheme_headers",
"tornado/test/httpserver_test.py::XHeaderTest::test_trusted_downstream",
"tornado/test/httpserver_test.py::SSLXHeaderTest::test_request_without_xprotocol",
"tornado/test/httpserver_test.py::ManualProtocolTest::test_manual_protocol",
"tornado/test/httpserver_test.py::UnixSocketTest::test_unix_socket",
"tornado/test/httpserver_test.py::KeepAliveTest::test_cancel_during_download",
"tornado/test/httpserver_test.py::KeepAliveTest::test_finish_while_closed",
"tornado/test/httpserver_test.py::KeepAliveTest::test_http10",
"tornado/test/httpserver_test.py::KeepAliveTest::test_http10_keepalive",
"tornado/test/httpserver_test.py::KeepAliveTest::test_http10_keepalive_extra_crlf",
"tornado/test/httpserver_test.py::KeepAliveTest::test_keepalive_chunked",
"tornado/test/httpserver_test.py::KeepAliveTest::test_pipelined_cancel",
"tornado/test/httpserver_test.py::KeepAliveTest::test_pipelined_requests",
"tornado/test/httpserver_test.py::KeepAliveTest::test_request_close",
"tornado/test/httpserver_test.py::KeepAliveTest::test_two_requests",
"tornado/test/httpserver_test.py::GzipTest::test_gzip",
"tornado/test/httpserver_test.py::GzipTest::test_uncompressed",
"tornado/test/httpserver_test.py::GzipUnsupportedTest::test_gzip_unsupported",
"tornado/test/httpserver_test.py::GzipUnsupportedTest::test_uncompressed",
"tornado/test/httpserver_test.py::StreamingChunkSizeTest::test_chunked_body",
"tornado/test/httpserver_test.py::StreamingChunkSizeTest::test_chunked_compressed",
"tornado/test/httpserver_test.py::StreamingChunkSizeTest::test_compressed_body",
"tornado/test/httpserver_test.py::StreamingChunkSizeTest::test_regular_body",
"tornado/test/httpserver_test.py::MaxHeaderSizeTest::test_large_headers",
"tornado/test/httpserver_test.py::MaxHeaderSizeTest::test_small_headers",
"tornado/test/httpserver_test.py::IdleTimeoutTest::test_idle_after_use",
"tornado/test/httpserver_test.py::IdleTimeoutTest::test_unused_connection",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_large_body_streaming_chunked_override",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_large_body_streaming_override",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_small_body",
"tornado/test/httpserver_test.py::LegacyInterfaceTest::test_legacy_interface"
] |
[] |
Apache License 2.0
| 1,304 |
tobgu__pyrsistent-107
|
decc5bbb11a3c795ad7553760f1bfc29f370162e
|
2017-05-26 13:39:19
|
decc5bbb11a3c795ad7553760f1bfc29f370162e
|
diff --git a/pyrsistent/_checked_types.py b/pyrsistent/_checked_types.py
index 492a862..8c768aa 100644
--- a/pyrsistent/_checked_types.py
+++ b/pyrsistent/_checked_types.py
@@ -83,15 +83,36 @@ def wrap_invariant(invariant):
return f
+def _all_dicts(bases, seen=None):
+ """
+ Yield each class in ``bases`` and each of their base classes.
+ """
+ if seen is None:
+ seen = set()
+ for cls in bases:
+ if cls in seen:
+ continue
+ seen.add(cls)
+ yield cls.__dict__
+ for b in _all_dicts(cls.__bases__, seen):
+ yield b
+
+
def store_invariants(dct, bases, destination_name, source_name):
# Invariants are inherited
- invariants = [dct[source_name]] if source_name in dct else []
- invariants += [b.__dict__[source_name] for b in bases if source_name in b.__dict__]
+ invariants = []
+ for ns in [dct] + list(_all_dicts(bases)):
+ try:
+ invariant = ns[source_name]
+ except KeyError:
+ continue
+ invariants.append(invariant)
+
if not all(callable(invariant) for invariant in invariants):
raise TypeError('Invariants must be callable')
-
dct[destination_name] = tuple(wrap_invariant(inv) for inv in invariants)
+
class _CheckedTypeMeta(type):
def __new__(mcs, name, bases, dct):
_store_types(dct, bases, '_checked_types', '__type__')
|
Not all inherited `__invariant__` definitions are discovered by PClassMeta / store_invariants
Consider this class hierarchy:
```
from pyrsistent import PClass
class W(object):
def __invariant__(self):
return [(False, "W")]
class Y(W, PClass):
pass
```
Attempting to instantiate this `Y` results in a failure as expected (at least by me):
```
pyrsistent._checked_types.InvariantException:
Global invariant failed, invariant_errors=[('W',)], missing_fields=[]
```
Now compare to this class hierarchy:
```
from pyrsistent import PClass
class W(object):
def __invariant__(self):
return [(False, "W")]
class X(W):
pass
class Y(X, PClass):
pass
```
Attempting to instantiate *this* `Y` succeeds.
|
tobgu/pyrsistent
|
diff --git a/tests/class_test.py b/tests/class_test.py
index d029e38..8320e97 100644
--- a/tests/class_test.py
+++ b/tests/class_test.py
@@ -283,6 +283,49 @@ def test_multiple_global_invariants():
assert e.invariant_errors == (('x', 'y'),)
+def test_inherited_global_invariants():
+ class Distant(object):
+ def __invariant__(self):
+ return [(self.distant, "distant")]
+
+ class Nearby(Distant):
+ def __invariant__(self):
+ return [(self.nearby, "nearby")]
+
+ class MultipleInvariantGlobal(Nearby, PClass):
+ distant = field()
+ nearby = field()
+
+ try:
+ MultipleInvariantGlobal(distant=False, nearby=False)
+ assert False
+ except InvariantException as e:
+ assert e.invariant_errors == (("nearby",), ("distant",),)
+
+
+def test_diamond_inherited_global_invariants():
+ counter = []
+ class Base(object):
+ def __invariant__(self):
+ counter.append(None)
+ return [(False, "base")]
+
+ class Left(Base):
+ pass
+
+ class Right(Base):
+ pass
+
+ class SingleInvariantGlobal(Left, Right, PClass):
+ pass
+
+ try:
+ SingleInvariantGlobal()
+ assert False
+ except InvariantException as e:
+ assert e.invariant_errors == (("base",),)
+ assert counter == [None]
+
def test_supports_weakref():
import weakref
weakref.ref(Point(x=1, y=2))
@@ -357,4 +400,4 @@ def test_enum_key_type():
class MyClass2(PClass):
f = pmap_field(key_type=(Foo,), value_type=int)
- MyClass2()
\ No newline at end of file
+ MyClass2()
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 1
}
|
0.12
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.16
babel==2.17.0
cachetools==5.5.2
certifi==2025.1.31
chardet==5.2.0
charset-normalizer==3.4.1
colorama==0.4.6
coverage==7.8.0
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
filelock==3.18.0
hypothesis==2.0.0
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
iniconfig==2.1.0
Jinja2==3.1.6
MarkupSafe==3.0.2
memory_profiler==0.31
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
psutil==2.1.1
py==1.11.0
Pygments==2.19.1
pyperform==1.86
pyproject-api==1.9.0
-e git+https://github.com/tobgu/pyrsistent.git@decc5bbb11a3c795ad7553760f1bfc29f370162e#egg=pyrsistent
pytest==8.3.5
pytest-cov==6.0.0
requests==2.32.3
six==1.17.0
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinx_rtd_theme==0.1.5
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
tomli==2.2.1
tox==4.25.0
typing_extensions==4.13.0
urllib3==2.3.0
virtualenv==20.29.3
zipp==3.21.0
|
name: pyrsistent
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.16
- babel==2.17.0
- cachetools==5.5.2
- certifi==2025.1.31
- chardet==5.2.0
- charset-normalizer==3.4.1
- colorama==0.4.6
- coverage==7.8.0
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- filelock==3.18.0
- hypothesis==2.0.0
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- jinja2==3.1.6
- markupsafe==3.0.2
- memory-profiler==0.31
- packaging==24.2
- platformdirs==4.3.7
- pluggy==1.5.0
- psutil==2.1.1
- py==1.11.0
- pygments==2.19.1
- pyperform==1.86
- pyproject-api==1.9.0
- pytest==8.3.5
- pytest-cov==6.0.0
- requests==2.32.3
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==7.4.7
- sphinx-rtd-theme==0.1.5
- sphinxcontrib-applehelp==2.0.0
- sphinxcontrib-devhelp==2.0.0
- sphinxcontrib-htmlhelp==2.1.0
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==2.0.0
- sphinxcontrib-serializinghtml==2.0.0
- tomli==2.2.1
- tox==4.25.0
- typing-extensions==4.13.0
- urllib3==2.3.0
- virtualenv==20.29.3
- zipp==3.21.0
prefix: /opt/conda/envs/pyrsistent
|
[
"tests/class_test.py::test_inherited_global_invariants",
"tests/class_test.py::test_diamond_inherited_global_invariants"
] |
[] |
[
"tests/class_test.py::test_evolve_pclass_instance",
"tests/class_test.py::test_direct_assignment_not_possible",
"tests/class_test.py::test_direct_delete_not_possible",
"tests/class_test.py::test_cannot_construct_with_undeclared_fields",
"tests/class_test.py::test_cannot_construct_with_wrong_type",
"tests/class_test.py::test_cannot_construct_without_mandatory_fields",
"tests/class_test.py::test_field_invariant_must_hold",
"tests/class_test.py::test_initial_value_set_when_not_present_in_arguments",
"tests/class_test.py::test_can_create_nested_structures_from_dict_and_serialize_back_to_dict",
"tests/class_test.py::test_can_serialize_with_custom_serializer",
"tests/class_test.py::test_implements_proper_equality_based_on_equality_of_fields",
"tests/class_test.py::test_is_hashable",
"tests/class_test.py::test_supports_nested_transformation",
"tests/class_test.py::test_repr",
"tests/class_test.py::test_global_invariant_check",
"tests/class_test.py::test_supports_pickling",
"tests/class_test.py::test_supports_pickling_with_typed_container_fields",
"tests/class_test.py::test_can_remove_optional_member",
"tests/class_test.py::test_cannot_remove_mandatory_member",
"tests/class_test.py::test_cannot_remove_non_existing_member",
"tests/class_test.py::test_evolver_without_evolution_returns_original_instance",
"tests/class_test.py::test_evolver_with_evolution_to_same_element_returns_original_instance",
"tests/class_test.py::test_evolver_supports_chained_set_and_remove",
"tests/class_test.py::test_evolver_supports_dot_notation_for_setting_and_getting_elements",
"tests/class_test.py::test_string_as_type_specifier",
"tests/class_test.py::test_multiple_invariants_on_field",
"tests/class_test.py::test_multiple_global_invariants",
"tests/class_test.py::test_supports_weakref",
"tests/class_test.py::test_supports_weakref_with_multi_level_inheritance",
"tests/class_test.py::test_supports_lazy_initial_value_for_field",
"tests/class_test.py::test_type_checks_lazy_initial_value_for_field",
"tests/class_test.py::test_invariant_checks_lazy_initial_value_for_field",
"tests/class_test.py::test_invariant_checks_static_initial_value",
"tests/class_test.py::test_lazy_invariant_message"
] |
[] |
MIT License
| 1,305 |
|
tobgu__pyrsistent-108
|
decc5bbb11a3c795ad7553760f1bfc29f370162e
|
2017-05-29 13:15:00
|
decc5bbb11a3c795ad7553760f1bfc29f370162e
|
diff --git a/README.rst b/README.rst
index ccbd38a..2fb4135 100644
--- a/README.rst
+++ b/README.rst
@@ -444,6 +444,8 @@ treated as matchers. If the matcher returns True for a specific key it is consid
pvector([1, 2, 4, 4, 5])
>>> v1.transform([lambda ix: 0 < ix < 4], 8)
pvector([1, 8, 8, 8, 5])
+ >>> v1.transform([lambda ix, v: ix == 0 or v == 5], 0)
+ pvector([0, 2, 3, 4, 0])
# The (a)ny matcher can be used to match anything
>>> v1.transform([ny], 8)
diff --git a/pyrsistent/_transformations.py b/pyrsistent/_transformations.py
index c4c7e10..6fe31cf 100644
--- a/pyrsistent/_transformations.py
+++ b/pyrsistent/_transformations.py
@@ -1,5 +1,13 @@
import re
import six
+try:
+ from inspect import Parameter, signature
+except ImportError:
+ signature = None
+ try:
+ from inspect import getfullargspec as getargspec
+ except ImportError:
+ from inspect import getargspec
def inc(x):
@@ -74,11 +82,40 @@ def _get(structure, key, default):
def _get_keys_and_values(structure, key_spec):
from pyrsistent._pmap import pmap
if callable(key_spec):
- return [(k, v) for k, v in _items(structure) if key_spec(k)]
-
+ # Support predicates as callable objects in the path
+ arity = _get_arity(key_spec)
+ if arity == 1:
+ # Unary predicates are called with the "key" of the path
+ # - eg a key in a mapping, an index in a sequence.
+ return [(k, v) for k, v in _items(structure) if key_spec(k)]
+ elif arity == 2:
+ # Binary predicates are called with the key and the corresponding
+ # value.
+ return [(k, v) for k, v in _items(structure) if key_spec(k, v)]
+ else:
+ # Other arities are an error.
+ raise ValueError(
+ "callable in transform path must take 1 or 2 arguments"
+ )
+
+ # Non-callables are used as-is as a key.
return [(key_spec, _get(structure, key_spec, pmap()))]
+if signature is None:
+ def _get_arity(f):
+ argspec = getargspec(f)
+ return len(argspec.args) - len(argspec.defaults or ())
+else:
+ def _get_arity(f):
+ return sum(
+ 1
+ for p
+ in signature(f).parameters.values()
+ if p.default is Parameter.empty
+ and p.kind in (Parameter.POSITIONAL_ONLY, Parameter.POSITIONAL_OR_KEYWORD)
+ )
+
def _update_structure(structure, kvs, path, command):
e = structure.evolver()
if not path and command is discard:
|
Allow predicates on values in transform paths for pvectors and pmaps
I often want to write transformations like:
```
# Double even elements of the list
xs = pvector([1, 3, 2, 4])
assert xs.transform(lambda x: x % 2 == 0, lambda x: x * 2) == pvector([1, 3, 4, 8])
```
Particular with more complex paths:
```
xs = pmap({"foo": pvector([1, 3, 2, 4]), "bar": pvector([1, 2, 3, 4])})
assert xs.transform(
["foo", lambda x: x % 2 == 0],
lambda x: x * 2,
) == pmap({"foo": pvector([1, 3, 4, 8]), "bar": pvector([1, 2, 3, 4])})
```
I can often cobble together something that deals with the above two scenarios. It usually involves duplicating some information from the path but it's kind of manageable.
Where I really have trouble is when I want to use this missing feature twice or more within a single path:
```
xs = pmap({"foo": pvector([1, 3, 2, 4]), "bar": pvector([1, 2])})
assert xs.transform(
[lambda (k, v): len(v) == 4, lambda x: x % 2 == 0],
lambda x: x * 2,
) == pmap({"foo": pvector([1, 3, 4, 8]), "bar": pvector([1, 2])})
```
|
tobgu/pyrsistent
|
diff --git a/tests/transform_test.py b/tests/transform_test.py
index 490ce9b..32e1772 100644
--- a/tests/transform_test.py
+++ b/tests/transform_test.py
@@ -3,7 +3,7 @@ from pyrsistent import freeze, inc, discard, rex, ny, field, PClass
def test_callable_command():
m = freeze({'foo': {'bar': {'baz': 1}}})
- m.transform(['foo', 'bar', 'baz'], inc) == {'foo': {'bar': {'baz': 2}}}
+ assert m.transform(['foo', 'bar', 'baz'], inc) == {'foo': {'bar': {'baz': 2}}}
def test_predicate():
@@ -11,6 +11,32 @@ def test_predicate():
assert m.transform(['foo', lambda x: x.startswith('b'), 'baz'], inc) == {'foo': {'bar': {'baz': 2}, 'qux': {'baz': 1}}}
+def test_broken_predicate():
+ broken_predicates = [
+ lambda: None,
+ lambda a, b, c: None,
+ lambda a, b, c, d=None: None,
+ lambda *args: None,
+ lambda **kwargs: None,
+ ]
+ for pred in broken_predicates:
+ try:
+ freeze({}).transform([pred], None)
+ assert False
+ except ValueError as e:
+ assert str(e) == "callable in transform path must take 1 or 2 arguments"
+
+
+def test_key_value_predicate():
+ m = freeze({
+ 'foo': 1,
+ 'bar': 2,
+ })
+ assert m.transform([
+ lambda k, v: (k, v) == ('foo', 1),
+ ], lambda v: v * 3) == {"foo": 3, "bar": 2}
+
+
def test_remove():
m = freeze({'foo': {'bar': {'baz': 1}}})
assert m.transform(['foo', 'bar', 'baz'], discard) == {'foo': {'bar': {}}}
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 2
}
|
0.12
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.16
babel==2.17.0
cachetools==5.5.2
certifi==2025.1.31
chardet==5.2.0
charset-normalizer==3.4.1
colorama==0.4.6
coverage==7.8.0
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
filelock==3.18.0
hypothesis==2.0.0
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
iniconfig==2.1.0
Jinja2==3.1.6
MarkupSafe==3.0.2
memory_profiler==0.31
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
psutil==2.1.1
py==1.11.0
Pygments==2.19.1
pyperform==1.86
pyproject-api==1.9.0
-e git+https://github.com/tobgu/pyrsistent.git@decc5bbb11a3c795ad7553760f1bfc29f370162e#egg=pyrsistent
pytest==8.3.5
pytest-cov==6.0.0
requests==2.32.3
six==1.17.0
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinx_rtd_theme==0.1.5
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
tomli==2.2.1
tox==4.25.0
typing_extensions==4.13.0
urllib3==2.3.0
virtualenv==20.29.3
zipp==3.21.0
|
name: pyrsistent
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.16
- babel==2.17.0
- cachetools==5.5.2
- certifi==2025.1.31
- chardet==5.2.0
- charset-normalizer==3.4.1
- colorama==0.4.6
- coverage==7.8.0
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- filelock==3.18.0
- hypothesis==2.0.0
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- jinja2==3.1.6
- markupsafe==3.0.2
- memory-profiler==0.31
- packaging==24.2
- platformdirs==4.3.7
- pluggy==1.5.0
- psutil==2.1.1
- py==1.11.0
- pygments==2.19.1
- pyperform==1.86
- pyproject-api==1.9.0
- pytest==8.3.5
- pytest-cov==6.0.0
- requests==2.32.3
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==7.4.7
- sphinx-rtd-theme==0.1.5
- sphinxcontrib-applehelp==2.0.0
- sphinxcontrib-devhelp==2.0.0
- sphinxcontrib-htmlhelp==2.1.0
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==2.0.0
- sphinxcontrib-serializinghtml==2.0.0
- tomli==2.2.1
- tox==4.25.0
- typing-extensions==4.13.0
- urllib3==2.3.0
- virtualenv==20.29.3
- zipp==3.21.0
prefix: /opt/conda/envs/pyrsistent
|
[
"tests/transform_test.py::test_broken_predicate",
"tests/transform_test.py::test_key_value_predicate"
] |
[] |
[
"tests/transform_test.py::test_callable_command",
"tests/transform_test.py::test_predicate",
"tests/transform_test.py::test_remove",
"tests/transform_test.py::test_remove_pvector",
"tests/transform_test.py::test_remove_pclass",
"tests/transform_test.py::test_predicate_no_match",
"tests/transform_test.py::test_rex_predicate",
"tests/transform_test.py::test_rex_with_non_string_key",
"tests/transform_test.py::test_ny_predicated_matches_any_key",
"tests/transform_test.py::test_new_elements_created_when_missing",
"tests/transform_test.py::test_mixed_vector_and_map",
"tests/transform_test.py::test_vector_predicate_callable_command",
"tests/transform_test.py::test_vector_insert_map_one_step_beyond_end",
"tests/transform_test.py::test_multiple_transformations",
"tests/transform_test.py::test_no_transformation_returns_the_same_structure",
"tests/transform_test.py::test_discard_multiple_elements_in_pvector"
] |
[] |
MIT License
| 1,310 |
|
rthalley__dnspython-255
|
6b11f2677fe6d4da653a85512ab73fa31c27214f
|
2017-05-30 08:08:04
|
1bb88cfecacb18fb406466e38a5b9c185cb5373e
|
diff --git a/LICENSE b/LICENSE
index 2896ca9..c0382e1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,7 @@
ISC License
Copyright (C) 2001-2003 Nominum, Inc.
+Copyright (C) Google Inc.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose with or without fee is hereby granted,
diff --git a/dns/zone.py b/dns/zone.py
index 468618f..0cf2682 100644
--- a/dns/zone.py
+++ b/dns/zone.py
@@ -28,6 +28,7 @@ import dns.node
import dns.rdataclass
import dns.rdatatype
import dns.rdata
+import dns.rdtypes.ANY.SOA
import dns.rrset
import dns.tokenizer
import dns.ttl
@@ -589,8 +590,14 @@ class _MasterReader(object):
@ivar tok: The tokenizer
@type tok: dns.tokenizer.Tokenizer object
- @ivar ttl: The default TTL
- @type ttl: int
+ @ivar last_ttl: The last seen explicit TTL for an RR
+ @type last_ttl: int
+ @ivar last_ttl_known: Has last TTL been detected
+ @type last_ttl_known: bool
+ @ivar default_ttl: The default TTL from a $TTL directive or SOA RR
+ @type default_ttl: int
+ @ivar default_ttl_known: Has default TTL been detected
+ @type default_ttl_known: bool
@ivar last_name: The last name read
@type last_name: dns.name.Name object
@ivar current_origin: The current origin
@@ -600,8 +607,8 @@ class _MasterReader(object):
@ivar zone: the zone
@type zone: dns.zone.Zone object
@ivar saved_state: saved reader state (used when processing $INCLUDE)
- @type saved_state: list of (tokenizer, current_origin, last_name, file)
- tuples.
+ @type saved_state: list of (tokenizer, current_origin, last_name, file,
+ last_ttl, last_ttl_known, default_ttl, default_ttl_known) tuples.
@ivar current_file: the file object of the $INCLUDed file being parsed
(None if no $INCLUDE is active).
@ivar allow_include: is $INCLUDE allowed?
@@ -618,7 +625,10 @@ class _MasterReader(object):
self.tok = tok
self.current_origin = origin
self.relativize = relativize
- self.ttl = 0
+ self.last_ttl = 0
+ self.last_ttl_known = False
+ self.default_ttl = 0
+ self.default_ttl_known = False
self.last_name = self.current_origin
self.zone = zone_factory(origin, rdclass, relativize=relativize)
self.saved_state = []
@@ -659,11 +669,18 @@ class _MasterReader(object):
# TTL
try:
ttl = dns.ttl.from_text(token.value)
+ self.last_ttl = ttl
+ self.last_ttl_known = True
token = self.tok.get()
if not token.is_identifier():
raise dns.exception.SyntaxError
except dns.ttl.BadTTL:
- ttl = self.ttl
+ if not (self.last_ttl_known or self.default_ttl_known):
+ raise dns.exception.SyntaxError("Missing default TTL value")
+ if self.default_ttl_known:
+ ttl = self.default_ttl
+ else:
+ ttl = self.last_ttl
# Class
try:
rdclass = dns.rdataclass.from_text(token.value)
@@ -703,6 +720,13 @@ class _MasterReader(object):
raise dns.exception.SyntaxError(
"caught exception %s: %s" % (str(ty), str(va)))
+ if not self.default_ttl_known and isinstance(rd, dns.rdtypes.ANY.SOA.SOA):
+ # The pre-RFC2308 and pre-BIND9 behavior inherits the zone default
+ # TTL from the SOA minttl if no $TTL statement is present before the
+ # SOA is parsed.
+ self.default_ttl = rd.minimum
+ self.default_ttl_known = True
+
rd.choose_relativity(self.zone.origin, self.relativize)
covers = rd.covers()
rds = n.find_rdataset(rdclass, rdtype, covers, True)
@@ -778,11 +802,18 @@ class _MasterReader(object):
# TTL
try:
ttl = dns.ttl.from_text(token.value)
+ self.last_ttl = ttl
+ self.last_ttl_known = True
token = self.tok.get()
if not token.is_identifier():
raise dns.exception.SyntaxError
except dns.ttl.BadTTL:
- ttl = self.ttl
+ if not (self.last_ttl_known or self.default_ttl_known):
+ raise dns.exception.SyntaxError("Missing default TTL value")
+ if self.default_ttl_known:
+ ttl = self.default_ttl
+ else:
+ ttl = self.last_ttl
# Class
try:
rdclass = dns.rdataclass.from_text(token.value)
@@ -884,7 +915,10 @@ class _MasterReader(object):
self.current_origin,
self.last_name,
self.current_file,
- self.ttl) = self.saved_state.pop(-1)
+ self.last_ttl,
+ self.last_ttl_known,
+ self.default_ttl,
+ self.default_ttl_known) = self.saved_state.pop(-1)
continue
break
elif token.is_eol():
@@ -898,7 +932,8 @@ class _MasterReader(object):
token = self.tok.get()
if not token.is_identifier():
raise dns.exception.SyntaxError("bad $TTL")
- self.ttl = dns.ttl.from_text(token.value)
+ self.default_ttl = dns.ttl.from_text(token.value)
+ self.default_ttl_known = True
self.tok.get_eol()
elif c == u'$ORIGIN':
self.current_origin = self.tok.get_name()
@@ -923,7 +958,10 @@ class _MasterReader(object):
self.current_origin,
self.last_name,
self.current_file,
- self.ttl))
+ self.last_ttl,
+ self.last_ttl_known,
+ self.default_ttl,
+ self.default_ttl_known))
self.current_file = open(filename, 'r')
self.tok = dns.tokenizer.Tokenizer(self.current_file,
filename)
|
Inherited TTL when parsing zone master files defaults to zero
When parsing a master zone file which has neither a $TTL directive nor an SOA RR, the default TTL applied to any RRs which don't specify one explicitly is zero.
This is not only surprising given the differing implementations of ttl=0, but also because [BIND](https://github.com/mirroring/bind9/blob/5125df6753f4b648a61502b261d2706a452e07d0/lib/dns/master.c#L1845-L1874) seemingly treats this as a syntax error and rejects the zone.
Example:
```
$ORIGIN example.
localhost IN A 127.0.0.1
```
Currently this parses as a localhost.example. RR with TTL=0.
|
rthalley/dnspython
|
diff --git a/tests/test_zone.py b/tests/test_zone.py
index 3c497a6..ce7caf0 100644
--- a/tests/test_zone.py
+++ b/tests/test_zone.py
@@ -76,6 +76,33 @@ ns1 1d1s a 10.0.0.1
ns2 1w1D1h1m1S a 10.0.0.2
"""
+# No $TTL so default TTL for RRs should be inherited from SOA minimum TTL (
+# not from the last explicit RR TTL).
+ttl_from_soa_text = """$ORIGIN example.
+@ 1h soa foo bar 1 2 3 4 5
+@ 1h ns ns1
+@ 1h ns ns2
+ns1 1w1D1h1m1S a 10.0.0.2
+ns2 a 10.0.0.1
+"""
+
+# No $TTL and no SOA, so default TTL for RRs should be inherited from last
+# explicit RR TTL.
+ttl_from_last_text = """$ORIGIN example.
+@ 1h ns ns1
+@ 1h ns ns2
+ns1 a 10.0.0.1
+ns2 1w1D1h1m1S a 10.0.0.2
+"""
+
+# No $TTL and no SOA should raise SyntaxError as no TTL can be determined.
+no_ttl_text = """$ORIGIN example.
+@ ns ns1
+@ ns ns2
+ns1 a 10.0.0.1
+ns2 a 10.0.0.2
+"""
+
no_soa_text = """$TTL 1h
$ORIGIN example.
@ ns ns1
@@ -442,6 +469,36 @@ class ZoneTestCase(unittest.TestCase):
rds = n.get_rdataset(dns.rdataclass.IN, dns.rdatatype.A)
self.failUnless(rds.ttl == 694861)
+ def testTTLFromSOA(self):
+ z = dns.zone.from_text(ttl_from_soa_text, 'example.', relativize=True)
+ n = z['@']
+ rds = n.get_rdataset(dns.rdataclass.IN, dns.rdatatype.SOA)
+ self.failUnless(rds.ttl == 3600)
+ soa_rd = rds[0]
+ n = z['ns1']
+ rds = n.get_rdataset(dns.rdataclass.IN, dns.rdatatype.A)
+ self.failUnless(rds.ttl == 694861)
+ n = z['ns2']
+ rds = n.get_rdataset(dns.rdataclass.IN, dns.rdatatype.A)
+ self.failUnless(rds.ttl == soa_rd.minimum)
+
+ def testTTLFromLast(self):
+ z = dns.zone.from_text(ttl_from_last_text, 'example.', check_origin=False)
+ n = z['@']
+ rds = n.get_rdataset(dns.rdataclass.IN, dns.rdatatype.NS)
+ self.failUnless(rds.ttl == 3600)
+ n = z['ns1']
+ rds = n.get_rdataset(dns.rdataclass.IN, dns.rdatatype.A)
+ self.failUnless(rds.ttl == 3600)
+ n = z['ns2']
+ rds = n.get_rdataset(dns.rdataclass.IN, dns.rdatatype.A)
+ self.failUnless(rds.ttl == 694861)
+
+ def testNoTTL(self):
+ def bad():
+ dns.zone.from_text(no_ttl_text, 'example.', check_origin=False)
+ self.failUnlessRaises(dns.exception.SyntaxError, bad)
+
def testNoSOA(self):
def bad():
dns.zone.from_text(no_soa_text, 'example.', relativize=True)
@@ -465,12 +522,11 @@ class ZoneTestCase(unittest.TestCase):
def testFirstRRStartsWithWhitespace(self):
# no name is specified, so default to the initial origin
- # no ttl is specified, so default to the initial TTL of 0
- z = dns.zone.from_text(' IN A 10.0.0.1', origin='example.',
+ z = dns.zone.from_text(' 300 IN A 10.0.0.1', origin='example.',
check_origin=False)
n = z['@']
rds = n.get_rdataset(dns.rdataclass.IN, dns.rdatatype.A)
- self.failUnless(rds.ttl == 0)
+ self.failUnless(rds.ttl == 300)
def testZoneOrigin(self):
z = dns.zone.Zone('example.')
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 2
}
|
1.15
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"coverage",
"pylint",
"flake8",
"idna>=2.1",
"pycrypto>=2.6.1",
"ecdsa>=0.13"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
astroid==3.3.9
coverage==7.8.0
dill==0.3.9
-e git+https://github.com/rthalley/dnspython.git@6b11f2677fe6d4da653a85512ab73fa31c27214f#egg=dnspython
ecdsa==0.19.1
exceptiongroup==1.2.2
flake8==7.2.0
idna==3.10
iniconfig==2.1.0
isort==6.0.1
mccabe==0.7.0
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
pycodestyle==2.13.0
pycrypto==2.6.1
pyflakes==3.3.1
pylint==3.3.6
pytest==8.3.5
six==1.17.0
tomli==2.2.1
tomlkit==0.13.2
typing_extensions==4.13.0
|
name: dnspython
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- astroid==3.3.9
- coverage==7.8.0
- dill==0.3.9
- ecdsa==0.19.1
- exceptiongroup==1.2.2
- flake8==7.2.0
- idna==3.10
- iniconfig==2.1.0
- isort==6.0.1
- mccabe==0.7.0
- packaging==24.2
- platformdirs==4.3.7
- pluggy==1.5.0
- pycodestyle==2.13.0
- pycrypto==2.6.1
- pyflakes==3.3.1
- pylint==3.3.6
- pytest==8.3.5
- six==1.17.0
- tomli==2.2.1
- tomlkit==0.13.2
- typing-extensions==4.13.0
prefix: /opt/conda/envs/dnspython
|
[
"tests/test_zone.py::ZoneTestCase::testNoTTL",
"tests/test_zone.py::ZoneTestCase::testTTLFromLast",
"tests/test_zone.py::ZoneTestCase::testTTLFromSOA"
] |
[
"tests/test_zone.py::ZoneTestCase::testFromFile1",
"tests/test_zone.py::ZoneTestCase::testFromFile2",
"tests/test_zone.py::ZoneTestCase::testInclude",
"tests/test_zone.py::ZoneTestCase::testToFileBinary",
"tests/test_zone.py::ZoneTestCase::testToFileFilename",
"tests/test_zone.py::ZoneTestCase::testToFileTextual",
"tests/test_zone.py::ZoneTestCase::testToText",
"tests/test_zone.py::ZoneTestCase::testTorture1"
] |
[
"tests/test_zone.py::ZoneTestCase::testBadDirective",
"tests/test_zone.py::ZoneTestCase::testDeleteRdataset1",
"tests/test_zone.py::ZoneTestCase::testDeleteRdataset2",
"tests/test_zone.py::ZoneTestCase::testEqual",
"tests/test_zone.py::ZoneTestCase::testFindRRset1",
"tests/test_zone.py::ZoneTestCase::testFindRRset2",
"tests/test_zone.py::ZoneTestCase::testFindRdataset1",
"tests/test_zone.py::ZoneTestCase::testFindRdataset2",
"tests/test_zone.py::ZoneTestCase::testFirstRRStartsWithWhitespace",
"tests/test_zone.py::ZoneTestCase::testFromText",
"tests/test_zone.py::ZoneTestCase::testGetRRset1",
"tests/test_zone.py::ZoneTestCase::testGetRRset2",
"tests/test_zone.py::ZoneTestCase::testGetRdataset1",
"tests/test_zone.py::ZoneTestCase::testGetRdataset2",
"tests/test_zone.py::ZoneTestCase::testIterateAllRdatas",
"tests/test_zone.py::ZoneTestCase::testIterateAllRdatasets",
"tests/test_zone.py::ZoneTestCase::testIterateRdatas",
"tests/test_zone.py::ZoneTestCase::testIterateRdatasets",
"tests/test_zone.py::ZoneTestCase::testNoNS",
"tests/test_zone.py::ZoneTestCase::testNoSOA",
"tests/test_zone.py::ZoneTestCase::testNodeDeleteRdataset1",
"tests/test_zone.py::ZoneTestCase::testNodeDeleteRdataset2",
"tests/test_zone.py::ZoneTestCase::testNodeFindRdataset1",
"tests/test_zone.py::ZoneTestCase::testNodeFindRdataset2",
"tests/test_zone.py::ZoneTestCase::testNodeGetRdataset1",
"tests/test_zone.py::ZoneTestCase::testNodeGetRdataset2",
"tests/test_zone.py::ZoneTestCase::testNotEqual1",
"tests/test_zone.py::ZoneTestCase::testNotEqual2",
"tests/test_zone.py::ZoneTestCase::testNotEqual3",
"tests/test_zone.py::ZoneTestCase::testReplaceRdataset1",
"tests/test_zone.py::ZoneTestCase::testReplaceRdataset2",
"tests/test_zone.py::ZoneTestCase::testTTLs",
"tests/test_zone.py::ZoneTestCase::testToFileBinaryStream",
"tests/test_zone.py::ZoneTestCase::testToFileTextualStream",
"tests/test_zone.py::ZoneTestCase::testZoneOrigin",
"tests/test_zone.py::ZoneTestCase::testZoneOriginNone"
] |
[] |
ISC License
| 1,313 |
|
PyCQA__pyflakes-275
|
1af4f14ad4675bf5c61c47bbb7c2421b50d1cba4
|
2017-05-31 03:24:45
|
1af4f14ad4675bf5c61c47bbb7c2421b50d1cba4
|
diff --git a/README.rst b/README.rst
index e84d334..aeb15f9 100644
--- a/README.rst
+++ b/README.rst
@@ -72,7 +72,7 @@ rebase your commits for you.
All changes should include tests and pass flake8_.
-.. image:: https://api.travis-ci.org/PyCQA/pyflakes.svg
+.. image:: https://api.travis-ci.org/PyCQA/pyflakes.svg?branch=master
:target: https://travis-ci.org/PyCQA/pyflakes
:alt: Build status
diff --git a/pyflakes/api.py b/pyflakes/api.py
index a535bff..e30f920 100644
--- a/pyflakes/api.py
+++ b/pyflakes/api.py
@@ -5,6 +5,7 @@ from __future__ import with_statement
import sys
import os
+import re
import _ast
from pyflakes import checker, __version__
@@ -13,6 +14,9 @@ from pyflakes import reporter as modReporter
__all__ = ['check', 'checkPath', 'checkRecursive', 'iterSourceCode', 'main']
+PYTHON_SHEBANG_REGEX = re.compile(br'^#!.*\bpython[23]?\b\s*$')
+
+
def check(codeString, filename, reporter=None):
"""
Check the Python source given by C{codeString} for flakes.
@@ -108,6 +112,25 @@ def checkPath(filename, reporter=None):
return check(codestr, filename, reporter)
+def isPythonFile(filename):
+ """Return True if filename points to a Python file."""
+ if filename.endswith('.py'):
+ return True
+
+ max_bytes = 128
+
+ try:
+ with open(filename, 'rb') as f:
+ text = f.read(max_bytes)
+ if not text:
+ return False
+ except IOError:
+ return False
+
+ first_line = text.splitlines()[0]
+ return PYTHON_SHEBANG_REGEX.match(first_line)
+
+
def iterSourceCode(paths):
"""
Iterate over all Python source files in C{paths}.
@@ -120,8 +143,9 @@ def iterSourceCode(paths):
if os.path.isdir(path):
for dirpath, dirnames, filenames in os.walk(path):
for filename in filenames:
- if filename.endswith('.py'):
- yield os.path.join(dirpath, filename)
+ full_path = os.path.join(dirpath, filename)
+ if isPythonFile(full_path):
+ yield full_path
else:
yield path
|
Please also check python scripts that are not named *.py
*Original report by [morph-debian](https://launchpad.net/~morph-debian) on [Launchpad](https://bugs.launchpad.net/bugs/970465):*
------------------------------------
Hello,
as reported on Debian at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653890:
"""
It would be great if pyflakes could detect files that are python scripts
but are not named *.py. It would have to read the first two bytes of
each file to check for scripts and then read the rest of the line to
determine if it is a python script. It would need to process stuff like:
#!/usr/bin/python
#!/usr/local/bin/python
#!/usr/bin/env python
#!/usr/bin/python2.6
#!/usr/bin/python3.2
"""
Regards,
Sandro
|
PyCQA/pyflakes
|
diff --git a/pyflakes/test/test_api.py b/pyflakes/test/test_api.py
index 51b0027..a1e0be2 100644
--- a/pyflakes/test/test_api.py
+++ b/pyflakes/test/test_api.py
@@ -187,6 +187,22 @@ class TestIterSourceCode(TestCase):
sorted(iterSourceCode([self.tempdir])),
sorted([apath, bpath, cpath]))
+ def test_shebang(self):
+ """
+ Find Python files that don't end with `.py`, but contain a Python
+ shebang.
+ """
+ apath = os.path.join(self.tempdir, 'a')
+ fd = open(apath, 'w')
+ fd.write('#!/usr/bin/env python\n')
+ fd.close()
+
+ self.makeEmptyFile('b')
+
+ self.assertEqual(
+ list(iterSourceCode([self.tempdir])),
+ list([apath]))
+
def test_multipleDirectories(self):
"""
L{iterSourceCode} can be given multiple directories. It will recurse
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 2
}
|
1.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"flake8",
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
flake8==5.0.4
importlib-metadata==4.2.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
mccabe==0.7.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pycodestyle==2.9.1
-e git+https://github.com/PyCQA/pyflakes.git@1af4f14ad4675bf5c61c47bbb7c2421b50d1cba4#egg=pyflakes
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: pyflakes
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- flake8==5.0.4
- importlib-metadata==4.2.0
- mccabe==0.7.0
- pycodestyle==2.9.1
prefix: /opt/conda/envs/pyflakes
|
[
"pyflakes/test/test_api.py::TestIterSourceCode::test_shebang"
] |
[] |
[
"pyflakes/test/test_api.py::TestIterSourceCode::test_emptyDirectory",
"pyflakes/test/test_api.py::TestIterSourceCode::test_explicitFiles",
"pyflakes/test/test_api.py::TestIterSourceCode::test_multipleDirectories",
"pyflakes/test/test_api.py::TestIterSourceCode::test_onlyPythonSource",
"pyflakes/test/test_api.py::TestIterSourceCode::test_recurses",
"pyflakes/test/test_api.py::TestIterSourceCode::test_singleFile",
"pyflakes/test/test_api.py::TestReporter::test_flake",
"pyflakes/test/test_api.py::TestReporter::test_multiLineSyntaxError",
"pyflakes/test/test_api.py::TestReporter::test_syntaxError",
"pyflakes/test/test_api.py::TestReporter::test_syntaxErrorNoOffset",
"pyflakes/test/test_api.py::TestReporter::test_unexpectedError",
"pyflakes/test/test_api.py::CheckTests::test_CRLFLineEndings",
"pyflakes/test/test_api.py::CheckTests::test_checkPathNonExisting",
"pyflakes/test/test_api.py::CheckTests::test_checkRecursive",
"pyflakes/test/test_api.py::CheckTests::test_encodedFileUTF8",
"pyflakes/test/test_api.py::CheckTests::test_eofSyntaxError",
"pyflakes/test/test_api.py::CheckTests::test_eofSyntaxErrorWithTab",
"pyflakes/test/test_api.py::CheckTests::test_invalidEscape",
"pyflakes/test/test_api.py::CheckTests::test_legacyScript",
"pyflakes/test/test_api.py::CheckTests::test_misencodedFileUTF16",
"pyflakes/test/test_api.py::CheckTests::test_misencodedFileUTF8",
"pyflakes/test/test_api.py::CheckTests::test_missingTrailingNewline",
"pyflakes/test/test_api.py::CheckTests::test_multilineSyntaxError",
"pyflakes/test/test_api.py::CheckTests::test_nonDefaultFollowsDefaultSyntaxError",
"pyflakes/test/test_api.py::CheckTests::test_nonKeywordAfterKeywordSyntaxError",
"pyflakes/test/test_api.py::CheckTests::test_pyflakesWarning",
"pyflakes/test/test_api.py::IntegrationTests::test_errors_io",
"pyflakes/test/test_api.py::IntegrationTests::test_errors_syntax",
"pyflakes/test/test_api.py::IntegrationTests::test_fileWithFlakes",
"pyflakes/test/test_api.py::IntegrationTests::test_goodFile",
"pyflakes/test/test_api.py::IntegrationTests::test_readFromStdin",
"pyflakes/test/test_api.py::TestMain::test_errors_io",
"pyflakes/test/test_api.py::TestMain::test_errors_syntax",
"pyflakes/test/test_api.py::TestMain::test_fileWithFlakes",
"pyflakes/test/test_api.py::TestMain::test_goodFile",
"pyflakes/test/test_api.py::TestMain::test_readFromStdin"
] |
[] |
MIT License
| 1,316 |
|
frictionlessdata__goodtables-py-195
|
faf5dddc7c99c4ea9581fe7565150a49c0e4bdd9
|
2017-05-31 09:28:22
|
faf5dddc7c99c4ea9581fe7565150a49c0e4bdd9
|
roll: @brew
Could you please review
roll: Thanks Brook!
|
diff --git a/data/empty.csv b/data/empty.csv
new file mode 100644
index 0000000..e69de29
diff --git a/data/invalid_no_headers.csv b/data/invalid_no_headers.csv
new file mode 100644
index 0000000..090c676
--- /dev/null
+++ b/data/invalid_no_headers.csv
@@ -0,0 +1,3 @@
+1,english
+2,中国人
+3,german,extra
diff --git a/goodtables/inspector.py b/goodtables/inspector.py
index dce6a06..ca64eea 100644
--- a/goodtables/inspector.py
+++ b/goodtables/inspector.py
@@ -4,6 +4,7 @@ from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
+import six
import inspect
import datetime
import operator
@@ -133,7 +134,7 @@ class Inspector(object):
# Prepare vars
errors = []
warnings = []
- headers = None
+ headers = []
row_number = 0
fatal_error = False
checks = copy(self.__checks)
@@ -147,6 +148,8 @@ class Inspector(object):
stream.open()
sample = stream.sample
headers = stream.headers
+ if headers is None:
+ headers = [None] * len(sample[0]) if sample else []
if _filter_checks(checks, type='schema'):
if schema is None and self.__infer_schema:
schema = Schema(infer(headers, sample))
@@ -174,13 +177,14 @@ class Inspector(object):
# Head checks
if not fatal_error:
- head_checks = _filter_checks(checks, context='head')
- for check in head_checks:
- if not columns:
- break
- check['func'](errors, columns, sample)
- for error in errors:
- error['row'] = None
+ if None not in headers:
+ head_checks = _filter_checks(checks, context='head')
+ for check in head_checks:
+ if not columns:
+ break
+ check['func'](errors, columns, sample)
+ for error in errors:
+ error['row'] = None
# Body checks
if not fatal_error:
@@ -191,7 +195,7 @@ class Inspector(object):
extended_rows = stream.iter(extended=True)
while True:
try:
- row_number, headers, row = next(extended_rows)
+ row_number, _, row = next(extended_rows)
except StopIteration:
break
except Exception as exception:
@@ -235,6 +239,7 @@ class Inspector(object):
stop = datetime.datetime.now()
# Compose report
+ headers = headers if None not in headers else None
errors = errors[:self.__error_limit]
errors = _sort_errors(errors)
report = copy(extra)
@@ -319,10 +324,13 @@ def _prepare_checks(setup, custom, order_fields, infer_fields):
# Bind options
for check in checks:
- args, _, _, _ = inspect.getargspec(check['func'])
- if 'order_fields' in args:
+ if six.PY2:
+ parameters, _, _, _ = inspect.getargspec(check['func'])
+ else:
+ parameters = inspect.signature(check['func']).parameters
+ if 'order_fields' in parameters:
check['func'] = partial(check['func'], order_fields=order_fields)
- if 'infer_fields' in args:
+ if 'infer_fields' in parameters:
check['func'] = partial(check['func'], infer_fields=infer_fields)
return checks
|
Ability to check table without headers?
(This would obviously not run checks related to headers.)
```
(pilot-dm4t) legend:refit-dirty dan (master)$ head archive/House1.csv
1381323977,523,74,0,69,0,0,0,0,0,1
1381323990,526,75,0,69,0,0,0,0,0,1
1381324005,540,74,0,68,0,0,0,0,0,1
1381324020,532,74,0,68,0,0,0,0,0,1
1381324035,540,74,0,69,0,0,0,0,0,1
```
Adding a `"dialect": {"header": False}` to resource has no effect.
`datapackage.json`:
```
...
"resources": [
{
"name": "house_1.csv",
"path": "archive/House1.csv",
"dialect": {
"header": false
},
...
```
I would opt to just skip the header-related checks on command line, but can't see how (#175)
---
# Tasks
- [x] support inspection for tables without headers
- [x] support inspection for data package resources without headers (now it's possible with supported CSV dialect `header` option- https://github.com/frictionlessdata/datapackage-py/blob/master/tests/test_resource.py#L517-L528) - MOVED #174
|
frictionlessdata/goodtables-py
|
diff --git a/tests/test_inspector.py b/tests/test_inspector.py
index 82d4626..aedb14a 100644
--- a/tests/test_inspector.py
+++ b/tests/test_inspector.py
@@ -4,6 +4,7 @@ from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
+import pytest
from goodtables import Inspector
@@ -179,3 +180,22 @@ def test_inspector_warnings_table_and_error_limit():
assert len(report['warnings']) == 2
assert 'table(s) limit' in report['warnings'][0]
assert 'error(s) limit' in report['warnings'][1]
+
+
+# Empty source
+
+def test_inspector_empty_source():
+ inspector = Inspector()
+ report = inspector.inspect('data/empty.csv')
+ assert report['tables'][0]['row-count'] == 0
+ assert report['tables'][0]['error-count'] == 0
+
+
+# No headers source
+
+def test_inspector_no_headers():
+ inspector = Inspector()
+ report = inspector.inspect('data/invalid_no_headers.csv', headers=None)
+ assert report['tables'][0]['row-count'] == 3
+ assert report['tables'][0]['error-count'] == 1
+ assert report['tables'][0]['errors'][0]['code'] == 'extra-value'
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_issue_reference",
"has_added_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 1
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[develop,ods]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-mock",
"mock",
"pyyaml"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
boto3==1.23.10
botocore==1.26.10
certifi==2021.5.30
chardet==5.0.0
charset-normalizer==2.0.12
click==6.7
coverage==6.2
datapackage==0.8.9
distlib==0.3.9
et-xmlfile==1.1.0
ezodf==0.3.2
filelock==3.4.1
future==0.18.3
-e git+https://github.com/frictionlessdata/goodtables-py.git@faf5dddc7c99c4ea9581fe7565150a49c0e4bdd9#egg=goodtables
greenlet==2.0.2
idna==3.10
ijson==3.3.0
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
isodate==0.6.1
jmespath==0.10.0
jsonlines==3.1.0
jsonschema==2.6.0
jsontableschema==0.10.1
linear-tsv==1.1.0
lxml==3.8.0
mccabe==0.7.0
mock==5.2.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
openpyxl==3.1.3
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
platformdirs==2.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pycodestyle==2.10.0
pydocstyle==6.3.0
pyflakes==3.0.1
pylama==7.7.1
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytest-cov==4.0.0
pytest-mock==3.6.1
python-dateutil==2.9.0.post0
PyYAML==6.0.1
requests==2.27.1
rfc3986==0.4.1
s3transfer==0.5.2
six==1.17.0
snowballstemmer==2.2.0
SQLAlchemy==1.4.54
tabulator==1.53.5
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tomli==1.2.3
tox==3.28.0
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
unicodecsv==0.14.1
urllib3==1.26.20
virtualenv==20.17.1
xlrd==2.0.1
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: goodtables-py
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- boto3==1.23.10
- botocore==1.26.10
- chardet==5.0.0
- charset-normalizer==2.0.12
- click==6.7
- coverage==6.2
- datapackage==0.8.9
- distlib==0.3.9
- et-xmlfile==1.1.0
- ezodf==0.3.2
- filelock==3.4.1
- future==0.18.3
- greenlet==2.0.2
- idna==3.10
- ijson==3.3.0
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- isodate==0.6.1
- jmespath==0.10.0
- jsonlines==3.1.0
- jsonschema==2.6.0
- jsontableschema==0.10.1
- linear-tsv==1.1.0
- lxml==3.8.0
- mccabe==0.7.0
- mock==5.2.0
- openpyxl==3.1.3
- platformdirs==2.4.0
- pycodestyle==2.10.0
- pydocstyle==6.3.0
- pyflakes==3.0.1
- pylama==7.7.1
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- python-dateutil==2.9.0.post0
- pyyaml==6.0.1
- requests==2.27.1
- rfc3986==0.4.1
- s3transfer==0.5.2
- six==1.17.0
- snowballstemmer==2.2.0
- sqlalchemy==1.4.54
- tabulator==1.53.5
- tomli==1.2.3
- tox==3.28.0
- unicodecsv==0.14.1
- urllib3==1.26.20
- virtualenv==20.17.1
- xlrd==2.0.1
prefix: /opt/conda/envs/goodtables-py
|
[
"tests/test_inspector.py::test_inspector_empty_source",
"tests/test_inspector.py::test_inspector_no_headers"
] |
[
"tests/test_inspector.py::test_inspector_catch_all_open_exceptions"
] |
[
"tests/test_inspector.py::test_inspector_table_valid",
"tests/test_inspector.py::test_inspector_table_invalid",
"tests/test_inspector.py::test_inspector_table_invalid_error_limit",
"tests/test_inspector.py::test_inspector_table_invalid_row_limit",
"tests/test_inspector.py::test_inspector_datapackage_valid",
"tests/test_inspector.py::test_inspector_datapackage_invalid",
"tests/test_inspector.py::test_inspector_datapackage_invalid_table_limit",
"tests/test_inspector.py::test_inspector_tables_invalid",
"tests/test_inspector.py::test_inspector_catch_all_iter_exceptions",
"tests/test_inspector.py::test_inspector_warnings_no",
"tests/test_inspector.py::test_inspector_warnings_bad_datapackage_json",
"tests/test_inspector.py::test_inspector_warnings_table_limit",
"tests/test_inspector.py::test_inspector_warnings_row_limit",
"tests/test_inspector.py::test_inspector_warnings_error_limit",
"tests/test_inspector.py::test_inspector_warnings_table_and_row_limit",
"tests/test_inspector.py::test_inspector_warnings_table_and_error_limit"
] |
[] |
MIT License
| 1,317 |
FlorianLudwig__rueckenwind-9
|
a9856bf3b640562310eda0953c921054b7a050ef
|
2017-06-01 07:16:21
|
a9856bf3b640562310eda0953c921054b7a050ef
|
diff --git a/rw/event.py b/rw/event.py
index 103a14b..4cf69f3 100644
--- a/rw/event.py
+++ b/rw/event.py
@@ -20,22 +20,16 @@ Signal
"""
from __future__ import absolute_import, division, print_function, with_statement
-import traceback
-
from tornado import gen
-import rw.scope
-
-
-class EventException(Exception):
- def __init__(self, exceptions):
- self.exceptions = exceptions
- message = '{} exceptions encountered:\n'.format(len(exceptions))
- for func, e in exceptions:
- message += '{}:\n{}'.format(func, e)
- Exception.__init__(self, ''.join(message))
class Event(set):
+ """
+ A simple within-process pub/sub event system.
+
+ If multiple callbacks are provided and raise exceptions,
+ the first detected exception is re-raised and all successive exceptions are ignored.
+ """
def __init__(self, name, accumulator=None):
super(Event, self).__init__()
self.name = name
@@ -43,38 +37,24 @@ class Event(set):
@gen.coroutine
def __call__(self, *args, **kwargs):
- scope = rw.scope.get_current_scope()
- rw_tracing = scope.get('rw_trace', None) if scope else None
-
re = []
- exceptions = []
futures = []
for func in self:
- try:
- result = func(*args, **kwargs)
- if isinstance(result, gen.Future):
- # we are not waiting for future objects result here
- # so they evaluate in parallel
- futures.append((func, result))
- else:
- re.append(result)
- except Exception:
- exceptions.append((func, traceback.format_exc()))
+ result = func(*args, **kwargs)
+ if isinstance(result, gen.Future):
+ # we are not waiting for future objects result here
+ # so they evaluate in parallel
+ futures.append((func, result))
+ else:
+ re.append(result)
# wait for results
for func, future in futures:
- try:
- if not future.done():
- yield future
- re.append(future.result())
-
- except Exception:
- exceptions.append((func, traceback.format_exc()))
-
- if exceptions:
- raise EventException(exceptions)
+ if not future.done():
+ yield future
+ re.append(future.result())
- # apply accumolator
+ # apply accumulator
if self.accumulator:
re = self.accumulator(re)
|
exceptions thrown in events
Exceptions thrown in events are caught and wrapped into an EventException (https://github.com/FlorianLudwig/rueckenwind/blob/master/rw/event.py#L75). As the EventException is not an HTTPError, it results in tornado not responding at all to the request.
Example:
```python
@plugin.init
def init():
rw.httpbase.PRE_REQUEST.add(do_stuff)
@rw.gen.corouting
def do_stuff():
raise HTTPError(401)
```
Expected behavior: the request is responded with a statuscode 401
Actual behavior: the request ist not responded at all
As there may be multiple exceptions in https://github.com/FlorianLudwig/rueckenwind/blob/master/rw/event.py#L75 common behavior would be to raise the first and log the rest.
|
FlorianLudwig/rueckenwind
|
diff --git a/test/test_event.py b/test/test_event.py
index 93abd6e..379487f 100644
--- a/test/test_event.py
+++ b/test/test_event.py
@@ -23,18 +23,9 @@ class MyTestCase(tornado.testing.AsyncTestCase):
def fail():
1 / 0
- with pytest.raises(rw.event.EventException):
+ with pytest.raises(ZeroDivisionError):
yield MY_EVENT()
- try:
- yield MY_EVENT()
- assert False # this line should never be reached
- except rw.event.EventException as e:
- # the original traceback should be get printed
- assert 'in fail' in str(e) # function name of the actual exception
- assert '1 / 0' in str(e) # the source line of the exception
- assert 'ZeroDivisionError' in str(e)
-
@tornado.testing.gen_test
def test_event_listener(self):
MY_EVENT = rw.event.Event('MY_EVENT')
@@ -87,14 +78,5 @@ class MyTestCase(tornado.testing.AsyncTestCase):
MY_EVENT = rw.event.Event('MY_EVENT')
MY_EVENT.add(something_lazy_failing)
- with pytest.raises(rw.event.EventException):
- yield MY_EVENT()
-
- try:
+ with pytest.raises(ZeroDivisionError):
yield MY_EVENT()
- assert False # this line should never be reached
- except rw.event.EventException as e:
- # the original traceback should be get printed
- assert 'in something_lazy_failing' in str(e) # function name of the actual exception
- assert '1 / 0' in str(e) # the source line of the exception
- assert 'ZeroDivisionError' in str(e)
\ No newline at end of file
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 1
}
|
0.4
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.4",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
argcomplete==0.9.0
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
Babel==2.11.0
certifi==2021.5.30
chardet==5.0.0
configobj==5.0.8
future==1.0.0
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
Jinja2==3.0.3
MarkupSafe==2.0.1
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytz==2025.2
PyYAML==6.0.1
-e git+https://github.com/FlorianLudwig/rueckenwind.git@a9856bf3b640562310eda0953c921054b7a050ef#egg=rueckenwind
six==1.17.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tornado==4.5.3
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: rueckenwind
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- argcomplete==0.9.0
- babel==2.11.0
- chardet==5.0.0
- configobj==5.0.8
- future==1.0.0
- jinja2==3.0.3
- markupsafe==2.0.1
- pytz==2025.2
- pyyaml==6.0.1
- six==1.17.0
- tornado==4.5.3
prefix: /opt/conda/envs/rueckenwind
|
[
"test/test_event.py::MyTestCase::test_exception_handling",
"test/test_event.py::MyTestCase::test_futures_fail"
] |
[] |
[
"test/test_event.py::MyTestCase::test_accumulator",
"test/test_event.py::MyTestCase::test_decorator",
"test/test_event.py::MyTestCase::test_event_listener",
"test/test_event.py::MyTestCase::test_futures"
] |
[] |
Apache License 2.0
| 1,320 |
|
python-cmd2__cmd2-114
|
bfd50611a7647af8b56fe34babf0b634708aaae9
|
2017-06-02 01:40:52
|
ddfd3d9a400ae81468e9abcc89fe690c30b7ec7f
|
diff --git a/cmd2.py b/cmd2.py
index 34b17e94..4befe019 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -576,7 +576,6 @@ class Cmd(cmd.Cmd):
Line-oriented command interpreters are often useful for test harnesses, internal tools, and rapid prototypes.
"""
# Attributes which are NOT dynamically settable at runtime
-
allow_cli_args = True # Should arguments passed on the command-line be processed as commands?
allow_redirection = True # Should output redirection and pipes be allowed
blankLinesAllowed = False
@@ -588,6 +587,7 @@ class Cmd(cmd.Cmd):
default_to_shell = False # Attempt to run unrecognized commands as shell commands
defaultExtension = 'txt' # For ``save``, ``load``, etc.
excludeFromHistory = '''run r list l history hi ed edit li eof'''.split()
+ exclude_from_help = ['do_eof'] # Commands to exclude from the help menu
# make sure your terminators are not in legalChars!
legalChars = u'!#$%.:?@_-' + pyparsing.alphanums + pyparsing.alphas8bit
@@ -666,11 +666,13 @@ class Cmd(cmd.Cmd):
# noinspection PyUnresolvedReferences
self.keywords = self.reserved_words + [fname[3:] for fname in dir(self)
if fname.startswith('do_')]
- self.parser_manager = ParserManager(redirector=self.redirector, terminators=self.terminators, multilineCommands=self.multilineCommands,
- legalChars=self.legalChars, commentGrammars=self.commentGrammars,
- commentInProgress=self.commentInProgress, case_insensitive=self.case_insensitive,
- blankLinesAllowed=self.blankLinesAllowed, prefixParser=self.prefixParser,
- preparse=self.preparse, postparse=self.postparse, shortcuts=self.shortcuts)
+ self.parser_manager = ParserManager(redirector=self.redirector, terminators=self.terminators,
+ multilineCommands=self.multilineCommands,
+ legalChars=self.legalChars, commentGrammars=self.commentGrammars,
+ commentInProgress=self.commentInProgress,
+ case_insensitive=self.case_insensitive,
+ blankLinesAllowed=self.blankLinesAllowed, prefixParser=self.prefixParser,
+ preparse=self.preparse, postparse=self.postparse, shortcuts=self.shortcuts)
self._transcript_files = transcript_files
# Used to enable the ability for a Python script to quit the application
@@ -1126,19 +1128,60 @@ class Cmd(cmd.Cmd):
def do_help(self, arg):
"""List available commands with "help" or detailed help with "help cmd"."""
if arg:
+ # Getting help for a specific command
funcname = self._func_named(arg)
if funcname:
fn = getattr(self, funcname)
try:
+ # Use Optparse help for @options commands
fn.optionParser.print_help(file=self.stdout)
except AttributeError:
+ # No special behavior needed, delegate to cmd base class do_help()
cmd.Cmd.do_help(self, funcname[3:])
else:
- cmd.Cmd.do_help(self, arg)
+ # Show a menu of what commands help can be gotten for
+ self._help_menu()
+
+ def _help_menu(self):
+ """Show a list of commands which help can be displayed for.
+ """
+ # Get a list of all method names
+ names = self.get_names()
+
+ # Remove any command names which are explicitly excluded from the help menu
+ for name in self.exclude_from_help:
+ names.remove(name)
+
+ cmds_doc = []
+ cmds_undoc = []
+ help_dict = {}
+ for name in names:
+ if name[:5] == 'help_':
+ help_dict[name[5:]] = 1
+ names.sort()
+ # There can be duplicates if routines overridden
+ prevname = ''
+ for name in names:
+ if name[:3] == 'do_':
+ if name == prevname:
+ continue
+ prevname = name
+ command = name[3:]
+ if command in help_dict:
+ cmds_doc.append(command)
+ del help_dict[command]
+ elif getattr(self, name).__doc__:
+ cmds_doc.append(command)
+ else:
+ cmds_undoc.append(command)
+ self.stdout.write("%s\n" % str(self.doc_leader))
+ self.print_topics(self.doc_header, cmds_doc, 15, 80)
+ self.print_topics(self.misc_header, list(help_dict.keys()), 15, 80)
+ self.print_topics(self.undoc_header, cmds_undoc, 15, 80)
# noinspection PyUnusedLocal
def do_shortcuts(self, args):
- """Lists single-key shortcuts available."""
+ """Lists shortcuts (aliases) available."""
result = "\n".join('%s: %s' % (sc[0], sc[1]) for sc in sorted(self.shortcuts))
self.stdout.write("Single-key shortcuts for other commands:\n{}\n".format(result))
@@ -1466,7 +1509,7 @@ class Cmd(cmd.Cmd):
py: Enters interactive Python mode.
End with ``Ctrl-D`` (Unix) / ``Ctrl-Z`` (Windows), ``quit()``, '`exit()``.
Non-python commands can be issued with ``cmd("your command")``.
- Run python code from external files with ``run("filename.py")``
+ Run python code from external script files with ``run("filename.py")``
"""
if self._in_py:
self.perror("Recursively entering interactive Python consoles is not allowed.", traceback_war=False)
@@ -1759,7 +1802,7 @@ Edited files are run on close if the `autorun_on_edit` settable parameter is Tru
def do__relative_load(self, arg=None):
"""Runs commands in script at file or URL.
- Usage: load [file_path]
+ Usage: _relative_load [file_path]
optional argument:
file_path a file path or URL pointing to a script
@@ -1769,6 +1812,8 @@ Script should contain one command per line, just like command would be typed in
If this is called from within an already-running script, the filename will be interpreted
relative to the already-running script's directory.
+
+NOTE: This command is intended to only be used within text file scripts.
"""
if arg:
arg = arg.split(None, 1)
@@ -1922,28 +1967,31 @@ Script should contain one command per line, just like command would be typed in
self.postloop()
+# noinspection PyPep8Naming
class ParserManager:
-
- def __init__(self, redirector, terminators, multilineCommands, legalChars, commentGrammars,
- commentInProgress, case_insensitive, blankLinesAllowed, prefixParser,
- preparse, postparse, shortcuts):
- "Creates and uses parsers for user input according to app's paramters."
+ """
+ Class which encapsulates all of the pyparsing parser functionality for cmd2 in a single location.
+ """
+ def __init__(self, redirector, terminators, multilineCommands, legalChars, commentGrammars, commentInProgress,
+ case_insensitive, blankLinesAllowed, prefixParser, preparse, postparse, shortcuts):
+ """Creates and uses parsers for user input according to app's paramters."""
self.commentGrammars = commentGrammars
self.preparse = preparse
self.postparse = postparse
self.shortcuts = shortcuts
- self.main_parser = self._build_main_parser(
- redirector=redirector, terminators=terminators, multilineCommands=multilineCommands,
- legalChars=legalChars,
- commentInProgress=commentInProgress, case_insensitive=case_insensitive,
- blankLinesAllowed=blankLinesAllowed, prefixParser=prefixParser)
- self.input_source_parser = self._build_input_source_parser(legalChars=legalChars, commentInProgress=commentInProgress)
+ self.main_parser = self._build_main_parser(redirector=redirector, terminators=terminators,
+ multilineCommands=multilineCommands, legalChars=legalChars,
+ commentInProgress=commentInProgress,
+ case_insensitive=case_insensitive,
+ blankLinesAllowed=blankLinesAllowed, prefixParser=prefixParser)
+ self.input_source_parser = self._build_input_source_parser(legalChars=legalChars,
+ commentInProgress=commentInProgress)
def _build_main_parser(self, redirector, terminators, multilineCommands, legalChars,
commentInProgress, case_insensitive, blankLinesAllowed, prefixParser):
- "Builds a PyParsing parser for interpreting user commands."
+ """Builds a PyParsing parser for interpreting user commands."""
# Build several parsing components that are eventually compiled into overall parser
output_destination_parser = (pyparsing.Literal(redirector * 2) |
@@ -1959,7 +2007,8 @@ class ParserManager:
pipe = pyparsing.Keyword('|', identChars='|')
do_not_parse = self.commentGrammars | commentInProgress | pyparsing.quotedString
after_elements = \
- pyparsing.Optional(pipe + pyparsing.SkipTo(output_destination_parser ^ string_end, ignore=do_not_parse)('pipeTo')) + \
+ pyparsing.Optional(pipe + pyparsing.SkipTo(output_destination_parser ^ string_end,
+ ignore=do_not_parse)('pipeTo')) + \
pyparsing.Optional(output_destination_parser +
pyparsing.SkipTo(string_end,
ignore=do_not_parse).setParseAction(lambda x: x[0].strip())('outputTo'))
@@ -1972,24 +2021,23 @@ class ParserManager:
blankLineTerminator = (pyparsing.lineEnd + pyparsing.lineEnd)('terminator')
blankLineTerminator.setResultsName('terminator')
blankLineTerminationParser = ((multilineCommand ^ oneline_command) +
- pyparsing.SkipTo(blankLineTerminator,
- ignore=do_not_parse).setParseAction(
- lambda x: x[0].strip())('args') +
- blankLineTerminator)('statement')
+ pyparsing.SkipTo(blankLineTerminator, ignore=do_not_parse).setParseAction(
+ lambda x: x[0].strip())('args') + blankLineTerminator)('statement')
multilineParser = (((multilineCommand ^ oneline_command) +
- pyparsing.SkipTo(terminator_parser,
- ignore=do_not_parse).setParseAction(
- lambda x: x[0].strip())('args') + terminator_parser)('statement') +
- pyparsing.SkipTo(output_destination_parser ^ pipe ^ string_end, ignore=do_not_parse).setParseAction(
- lambda x: x[0].strip())('suffix') + after_elements)
+ pyparsing.SkipTo(terminator_parser,
+ ignore=do_not_parse).setParseAction(lambda x: x[0].strip())('args') +
+ terminator_parser)('statement') +
+ pyparsing.SkipTo(output_destination_parser ^ pipe ^ string_end,
+ ignore=do_not_parse).setParseAction(lambda x: x[0].strip())('suffix') +
+ after_elements)
multilineParser.ignore(commentInProgress)
singleLineParser = ((oneline_command +
- pyparsing.SkipTo(terminator_parser ^ string_end ^ pipe ^ output_destination_parser,
- ignore=do_not_parse).setParseAction(
- lambda x: x[0].strip())('args'))('statement') +
- pyparsing.Optional(terminator_parser) + after_elements)
+ pyparsing.SkipTo(terminator_parser ^ string_end ^ pipe ^ output_destination_parser,
+ ignore=do_not_parse).setParseAction(
+ lambda x: x[0].strip())('args'))('statement') +
+ pyparsing.Optional(terminator_parser) + after_elements)
blankLineTerminationParser = blankLineTerminationParser.setResultsName('statement')
@@ -2003,8 +2051,9 @@ class ParserManager:
parser.ignore(self.commentGrammars)
return parser
- def _build_input_source_parser(self, legalChars, commentInProgress):
- "Builds a PyParsing parser for alternate user input sources (from file, pipe, etc.)"
+ @staticmethod
+ def _build_input_source_parser(legalChars, commentInProgress):
+ """Builds a PyParsing parser for alternate user input sources (from file, pipe, etc.)"""
input_mark = pyparsing.Literal('<')
input_mark.setParseAction(lambda x: '')
@@ -2049,8 +2098,6 @@ class ParserManager:
return p
-
-
class HistoryItem(str):
"""Class used to represent an item in the History list.
|
Add ability to exclude some commands from help menu
It would be nice to be able to explicitly exclude certain commands from being included in the help menu.
For example, the **eof** "command" shouldn't ever show up in the help menu. This isn't something an end user would ever really want to manually enter as a command, but is something that will be encountered while running a script or when <Ctrl>-d is pressed.
It would be nice to include a member variable which is a list of commands to exclude from the help menu. By default, "do_eof" should be in there and it is debatable whether or not "do__relative_load" should be there as well.
|
python-cmd2/cmd2
|
diff --git a/tests/conftest.py b/tests/conftest.py
index b036943d..3977de5f 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -15,8 +15,8 @@ import cmd2
# Help text for base cmd2.Cmd application
BASE_HELP = """Documented commands (type help <topic>):
========================================
-_relative_load edit help list pause quit save shell show
-cmdenvironment eof history load py run set shortcuts
+_relative_load edit history load py run set shortcuts
+cmdenvironment help list pause quit save shell show
"""
# Help text for the history command
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index 6049119f..c31b519d 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -106,8 +106,9 @@ def test_base_with_transcript(_cmdline_app):
Documented commands (type help <topic>):
========================================
-_relative_load edit help list orate py run say shell show
-cmdenvironment eof history load pause quit save set shortcuts speak
+_relative_load help load py save shell speak
+cmdenvironment history orate quit say shortcuts
+edit list pause run set show
(Cmd) help say
Repeats what you tell me to.
diff --git a/tests/transcript.txt b/tests/transcript.txt
index 1e10ee31..013e2d0f 100644
--- a/tests/transcript.txt
+++ b/tests/transcript.txt
@@ -2,8 +2,9 @@
Documented commands (type help <topic>):
========================================
-_relative_load edit help list orate py run say shell show
-cmdenvironment eof history load pause quit save set shortcuts speak
+_relative_load help load py save shell speak
+cmdenvironment history orate quit say shortcuts
+edit list pause run set show
(Cmd) help say
Repeats what you tell me to.
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 1
}
|
0.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pyparsing>=2.0.1 six",
"pip_packages": [
"pytest",
"mock",
"sphinx",
"sphinx-rtd-theme"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.16
babel==2.17.0
certifi==2025.1.31
charset-normalizer==3.4.1
-e git+https://github.com/python-cmd2/cmd2.git@bfd50611a7647af8b56fe34babf0b634708aaae9#egg=cmd2
docutils==0.21.2
exceptiongroup==1.2.2
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
iniconfig==2.1.0
Jinja2==3.1.6
MarkupSafe==3.0.2
mock==5.2.0
packaging==24.2
pluggy==1.5.0
Pygments==2.19.1
pyparsing @ file:///croot/pyparsing_1731445506121/work
pytest==8.3.5
requests==2.32.3
six @ file:///tmp/build/80754af9/six_1644875935023/work
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinx-rtd-theme==3.0.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
tomli==2.2.1
urllib3==2.3.0
zipp==3.21.0
|
name: cmd2
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- pyparsing=3.2.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- six=1.16.0=pyhd3eb1b0_1
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.16
- babel==2.17.0
- certifi==2025.1.31
- charset-normalizer==3.4.1
- docutils==0.21.2
- exceptiongroup==1.2.2
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- jinja2==3.1.6
- markupsafe==3.0.2
- mock==5.2.0
- packaging==24.2
- pluggy==1.5.0
- pygments==2.19.1
- pytest==8.3.5
- requests==2.32.3
- snowballstemmer==2.2.0
- sphinx==7.4.7
- sphinx-rtd-theme==3.0.2
- sphinxcontrib-applehelp==2.0.0
- sphinxcontrib-devhelp==2.0.0
- sphinxcontrib-htmlhelp==2.1.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==2.0.0
- sphinxcontrib-serializinghtml==2.0.0
- tomli==2.2.1
- urllib3==2.3.0
- zipp==3.21.0
prefix: /opt/conda/envs/cmd2
|
[
"tests/test_transcript.py::test_base_with_transcript",
"tests/test_transcript.py::test_transcript_from_cmdloop"
] |
[] |
[
"tests/test_transcript.py::Cmd2TestCase::runTest",
"tests/test_transcript.py::TestMyAppCase::runTest",
"tests/test_transcript.py::test_optparser",
"tests/test_transcript.py::test_optparser_nosuchoption",
"tests/test_transcript.py::test_comment_stripping",
"tests/test_transcript.py::test_optarser_correct_args_with_quotes_and_midline_options",
"tests/test_transcript.py::test_optarser_options_with_spaces_in_quotes",
"tests/test_transcript.py::test_commands_at_invocation",
"tests/test_transcript.py::test_select_options",
"tests/test_transcript.py::test_multiline_command_transcript_with_comments_at_beginning",
"tests/test_transcript.py::test_invalid_syntax",
"tests/test_transcript.py::test_regex_transcript"
] |
[] |
MIT License
| 1,322 |
|
aio-libs__aiosmtpd-106
|
2ec2b40aab6288baf2153672aae51800d3e73765
|
2017-06-02 08:59:24
|
b87538bc1fc0137b5d188db938c9b386c71683a3
|
diff --git a/aiosmtpd/smtp.py b/aiosmtpd/smtp.py
index f123514..287875b 100644
--- a/aiosmtpd/smtp.py
+++ b/aiosmtpd/smtp.py
@@ -284,10 +284,6 @@ class SMTP(asyncio.StreamReaderProtocol):
if not hostname:
await self.push('501 Syntax: HELO hostname')
return
- # See issue #21783 for a discussion of this behavior.
- if self.session.host_name:
- await self.push('503 Duplicate HELO/EHLO')
- return
self._set_rset_state()
self.session.extended_smtp = False
status = await self._call_handler_hook('HELO', hostname)
@@ -300,11 +296,6 @@ class SMTP(asyncio.StreamReaderProtocol):
if not hostname:
await self.push('501 Syntax: EHLO hostname')
return
- # See https://bugs.python.org/issue21783 for a discussion of this
- # behavior.
- if self.session.host_name:
- await self.push('503 Duplicate HELO/EHLO')
- return
self._set_rset_state()
self.session.extended_smtp = True
await self.push('250-%s' % self.hostname)
|
Duplicated HELO/EHLO
As already mentioned in source code (https://github.com/aio-libs/aiosmtpd/blob/c25b878473b086150d32fcd21c35c58099947e5f/aiosmtpd/smtp.py#L264, also in original smtpd's code) a second HELO/EHLO is rejected but the standart says it should be handled as a RSET command.
Is there any special reason to not allow duplicated HELO/EHLO? I think the best way is to do the same other SMTP servers do: Allowing a duplicated HELO/EHLO.
Another option is to have a configuration option.
|
aio-libs/aiosmtpd
|
diff --git a/aiosmtpd/tests/test_smtp.py b/aiosmtpd/tests/test_smtp.py
index 8e61021..9f78c16 100644
--- a/aiosmtpd/tests/test_smtp.py
+++ b/aiosmtpd/tests/test_smtp.py
@@ -38,6 +38,15 @@ class ReceivingHandler:
return '250 OK'
+class StoreEnvelopeOnVRFYHandler:
+ """Saves envelope for later inspection when handling VRFY."""
+ envelope = None
+
+ async def handle_VRFY(self, server, session, envelope, addr):
+ self.envelope = envelope
+ return '250 OK'
+
+
class SizedController(Controller):
def __init__(self, handler, size):
self.size = size
@@ -201,8 +210,7 @@ class TestSMTP(unittest.TestCase):
code, response = client.helo('example.com')
self.assertEqual(code, 250)
code, response = client.helo('example.org')
- self.assertEqual(code, 503)
- self.assertEqual(response, b'Duplicate HELO/EHLO')
+ self.assertEqual(code, 250)
def test_ehlo(self):
with SMTP(*self.address) as client:
@@ -219,8 +227,7 @@ class TestSMTP(unittest.TestCase):
code, response = client.ehlo('example.com')
self.assertEqual(code, 250)
code, response = client.ehlo('example.org')
- self.assertEqual(code, 503)
- self.assertEqual(response, b'Duplicate HELO/EHLO')
+ self.assertEqual(code, 250)
def test_ehlo_no_hostname(self):
with SMTP(*self.address) as client:
@@ -235,16 +242,14 @@ class TestSMTP(unittest.TestCase):
code, response = client.helo('example.com')
self.assertEqual(code, 250)
code, response = client.ehlo('example.org')
- self.assertEqual(code, 503)
- self.assertEqual(response, b'Duplicate HELO/EHLO')
+ self.assertEqual(code, 250)
def test_ehlo_then_helo(self):
with SMTP(*self.address) as client:
code, response = client.ehlo('example.com')
self.assertEqual(code, 250)
code, response = client.helo('example.org')
- self.assertEqual(code, 503)
- self.assertEqual(response, b'Duplicate HELO/EHLO')
+ self.assertEqual(code, 250)
def test_noop(self):
with SMTP(*self.address) as client:
@@ -665,6 +670,80 @@ class TestSMTP(unittest.TestCase):
b'Error: command "FOOBAR" not recognized')
+class TestResetCommands(unittest.TestCase):
+ """Test that sender and recipients are reset on RSET, HELO, and EHLO.
+
+ The tests below issue each command twice with different addresses and
+ verify that mail_from and rcpt_tos have been replacecd.
+ """
+
+ expected_envelope_data = [{
+ 'mail_from': '[email protected]',
+ 'rcpt_tos': ['[email protected]',
+ '[email protected]']}, {
+ 'mail_from': '[email protected]',
+ 'rcpt_tos': ['[email protected]',
+ '[email protected]']}]
+
+ def send_envolope_data(self, client, mail_from, rcpt_tos):
+ client.mail(mail_from)
+ for rcpt in rcpt_tos:
+ client.rcpt(rcpt)
+
+ def test_helo(self):
+ handler = StoreEnvelopeOnVRFYHandler()
+ controller = DecodingController(handler)
+ controller.start()
+ self.addCleanup(controller.stop)
+
+ with SMTP(controller.hostname, controller.port) as client:
+ for data in self.expected_envelope_data:
+ client.helo('example.com')
+ client.vrfy('[email protected]') # Save envelope in handler
+ self.assertIsNone(handler.envelope.mail_from)
+ self.assertEqual(len(handler.envelope.rcpt_tos), 0)
+ self.send_envolope_data(client, **data)
+ client.vrfy('[email protected]') # Save envelope in handler
+ self.assertEqual(handler.envelope.mail_from, data['mail_from'])
+ self.assertEqual(handler.envelope.rcpt_tos, data['rcpt_tos'])
+
+ def test_ehlo(self):
+ handler = StoreEnvelopeOnVRFYHandler()
+ controller = DecodingController(handler)
+ controller.start()
+ self.addCleanup(controller.stop)
+
+ with SMTP(controller.hostname, controller.port) as client:
+ for data in self.expected_envelope_data:
+ client.ehlo('example.com')
+ client.vrfy('[email protected]') # Save envelope in handler
+ self.assertIsNone(handler.envelope.mail_from)
+ self.assertEqual(len(handler.envelope.rcpt_tos), 0)
+ self.send_envolope_data(client, **data)
+ client.vrfy('[email protected]') # Save envelope in handler
+ self.assertEqual(handler.envelope.mail_from, data['mail_from'])
+ self.assertEqual(handler.envelope.rcpt_tos, data['rcpt_tos'])
+
+ def test_rset(self):
+ handler = StoreEnvelopeOnVRFYHandler()
+ controller = DecodingController(handler)
+ controller.start()
+ self.addCleanup(controller.stop)
+
+ with SMTP(controller.hostname, controller.port) as client:
+ client.helo('example.com')
+
+ for data in self.expected_envelope_data:
+ self.send_envolope_data(client, **data)
+ client.vrfy('[email protected]') # Save envelope in handler
+ self.assertEqual(handler.envelope.mail_from, data['mail_from'])
+ self.assertEqual(handler.envelope.rcpt_tos, data['rcpt_tos'])
+ client.rset()
+ client.vrfy('[email protected]') # Save envelope in handler
+ self.assertIsNone(handler.envelope.mail_from)
+ self.assertEqual(len(handler.envelope.rcpt_tos), 0)
+
+
class TestSMTPWithController(unittest.TestCase):
def test_mail_with_size_too_large(self):
controller = SizedController(Sink(), 9999)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 1
}
|
1.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "atpublic",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/aio-libs/aiosmtpd.git@2ec2b40aab6288baf2153672aae51800d3e73765#egg=aiosmtpd
atpublic @ file:///home/conda/feedstock_root/build_artifacts/atpublic_1737771474411/work
exceptiongroup==1.2.2
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
tomli==2.2.1
|
name: aiosmtpd
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- atpublic=5.1=pyhd8ed1ab_0
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- exceptiongroup==1.2.2
- iniconfig==2.1.0
- packaging==24.2
- pluggy==1.5.0
- pytest==8.3.5
- tomli==2.2.1
prefix: /opt/conda/envs/aiosmtpd
|
[
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_ehlo_duplicate",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_ehlo_then_helo",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_helo_duplicate",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_helo_then_ehlo",
"aiosmtpd/tests/test_smtp.py::TestResetCommands::test_ehlo",
"aiosmtpd/tests/test_smtp.py::TestResetCommands::test_helo"
] |
[] |
[
"aiosmtpd/tests/test_smtp.py::TestProtocol::test_empty_email",
"aiosmtpd/tests/test_smtp.py::TestProtocol::test_honors_mail_delimeters",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_data_invalid_params",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_data_no_helo",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_data_no_rcpt",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_ehlo",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_ehlo_no_hostname",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_empty_command",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_expn",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_helo",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_helo_no_hostname",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_help",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_help_bad_arg",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_help_data",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_help_ehlo",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_help_helo",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_help_mail",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_help_mail_esmtp",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_help_noop",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_help_quit",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_help_rcpt",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_help_rcpt_esmtp",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_help_rset",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_help_vrfy",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_mail_fail_parse_email",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_mail_from_malformed",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_mail_from_twice",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_mail_malformed_params_esmtp",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_mail_missing_params_esmtp",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_mail_no_arg",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_mail_no_from",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_mail_no_helo",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_mail_params_bad_syntax_esmtp",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_mail_params_esmtp",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_mail_params_no_esmtp",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_mail_unrecognized_params_esmtp",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_noop",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_noop_with_arg",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_quit",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_quit_with_arg",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_rcpt_fail_parse_email",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_rcpt_no_address",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_rcpt_no_arg",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_rcpt_no_arg_esmtp",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_rcpt_no_helo",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_rcpt_no_mail",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_rcpt_no_to",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_rcpt_with_bad_params",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_rcpt_with_params_no_esmtp",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_rcpt_with_unknown_params",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_rset",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_rset_with_arg",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_too_long_command",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_unknown_command",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_vrfy",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_vrfy_no_arg",
"aiosmtpd/tests/test_smtp.py::TestSMTP::test_vrfy_not_an_address",
"aiosmtpd/tests/test_smtp.py::TestResetCommands::test_rset",
"aiosmtpd/tests/test_smtp.py::TestSMTPWithController::test_bad_encodings",
"aiosmtpd/tests/test_smtp.py::TestSMTPWithController::test_dots_escaped",
"aiosmtpd/tests/test_smtp.py::TestSMTPWithController::test_esmtp_no_size_limit",
"aiosmtpd/tests/test_smtp.py::TestSMTPWithController::test_exception_handler_exception",
"aiosmtpd/tests/test_smtp.py::TestSMTPWithController::test_exception_handler_undescribable",
"aiosmtpd/tests/test_smtp.py::TestSMTPWithController::test_mail_invalid_body",
"aiosmtpd/tests/test_smtp.py::TestSMTPWithController::test_mail_with_compatible_smtputf8",
"aiosmtpd/tests/test_smtp.py::TestSMTPWithController::test_mail_with_incompatible_smtputf8",
"aiosmtpd/tests/test_smtp.py::TestSMTPWithController::test_mail_with_size_too_large",
"aiosmtpd/tests/test_smtp.py::TestSMTPWithController::test_mail_with_unrequited_smtputf8",
"aiosmtpd/tests/test_smtp.py::TestSMTPWithController::test_process_message_error",
"aiosmtpd/tests/test_smtp.py::TestSMTPWithController::test_too_long_message_body",
"aiosmtpd/tests/test_smtp.py::TestSMTPWithController::test_unexpected_errors",
"aiosmtpd/tests/test_smtp.py::TestSMTPWithController::test_unexpected_errors_custom_response",
"aiosmtpd/tests/test_smtp.py::TestSMTPWithController::test_unexpected_errors_unhandled",
"aiosmtpd/tests/test_smtp.py::TestCustomizations::test_custom_greeting",
"aiosmtpd/tests/test_smtp.py::TestCustomizations::test_custom_hostname",
"aiosmtpd/tests/test_smtp.py::TestCustomizations::test_default_greeting",
"aiosmtpd/tests/test_smtp.py::TestCustomizations::test_mail_invalid_body_param",
"aiosmtpd/tests/test_smtp.py::TestClientCrash::test_close_in_command",
"aiosmtpd/tests/test_smtp.py::TestClientCrash::test_close_in_data",
"aiosmtpd/tests/test_smtp.py::TestClientCrash::test_connection_reset_during_DATA",
"aiosmtpd/tests/test_smtp.py::TestClientCrash::test_connection_reset_during_command",
"aiosmtpd/tests/test_smtp.py::TestStrictASCII::test_bad_encoded_param",
"aiosmtpd/tests/test_smtp.py::TestStrictASCII::test_data",
"aiosmtpd/tests/test_smtp.py::TestStrictASCII::test_ehlo",
"aiosmtpd/tests/test_smtp.py::TestStrictASCII::test_mail_param"
] |
[] |
Apache License 2.0
| 1,325 |
|
python-cmd2__cmd2-115
|
a0d829e4105cd431198feb43534adaf953b090ba
|
2017-06-03 16:12:27
|
ddfd3d9a400ae81468e9abcc89fe690c30b7ec7f
|
diff --git a/CHANGES.md b/CHANGES.md
index 98aa2cf0..2324522f 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,6 +1,17 @@
News
====
+0.7.3
+-----
+
+*Release date: TBD*
+
+* Bug fixes
+ * Fixed a bug in display a span of history items when only an end index is supplied
+* Enhancements
+ * Added the ability to exclude commands from the help menu (**eof** included by default)
+ * Redundant list command removed and features merged into history command
+
0.7.2
-----
diff --git a/cmd2.py b/cmd2.py
index 4befe019..3755ef56 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -1121,9 +1121,12 @@ class Cmd(cmd.Cmd):
Commands may be terminated with: {}
Command-line arguments allowed: {}
Output redirection and pipes allowed: {}
- Settable parameters: {}\n""".format(not self.case_insensitive, str(self.terminators),
- self.allow_cli_args,
- self.allow_redirection, ' '.join(self.settable)))
+ Parsing of @options commands:
+ Use POSIX-style argument parser (vs Windows): {}
+ Strip Quotes when using Windows-style argument parser: {}
+ Use a list of arguments instead of a single argument string: {}
+ \n""".format(not self.case_insensitive, str(self.terminators), self.allow_cli_args, self.allow_redirection,
+ POSIX_SHLEX, STRIP_QUOTES_FOR_NON_POSIX, USE_ARG_LIST))
def do_help(self, arg):
"""List available commands with "help" or detailed help with "help cmd"."""
@@ -1592,7 +1595,8 @@ class Cmd(cmd.Cmd):
| no arg: list all
| arg is integer: list one history item, by index
- | arg is string: string search
+ | a..b, a:b, a:, ..b -> list history items by a span of indices (inclusive)
+ | arg is string: list all commands matching string search
| arg is /enclosed in forward-slashes/: regular expression search
"""
# If arguments are being passed as a list instead of as a string
@@ -1602,10 +1606,20 @@ class Cmd(cmd.Cmd):
else:
arg = ''
+ # If an argument was supplied, then retrieve partial contents of the history
if arg:
- history = self.history.get(arg)
+ # If a character indicating a slice is present, retrieve a slice of the history
+ if '..' in arg or ':' in arg:
+ # Get a slice of history
+ history = self.history.span(arg)
+ else:
+ # Get item(s) from history by index or string search
+ history = self.history.get(arg)
else:
+ # If no arg given, then retrieve the entire history
history = self.history
+
+ # Display the history items retrieved
for hi in history:
if opts.script:
self.poutput(hi)
@@ -1628,38 +1642,6 @@ class Cmd(cmd.Cmd):
except IndexError:
return None
- def do_list(self, arg):
- """list [arg]: lists command(s) from history in a flexible/searchable way.
-
- :param arg: str - behavior varies as follows:
-
- * no arg -> list most recent command
- * arg is integer -> list one history item, by index
- * a..b, a:b, a:, ..b -> list spans from a (or start) to b (or end)
- * arg is string -> list all commands matching string search
- * arg is /enclosed in forward-slashes/ -> regular expression search
- """
- try:
- history = self.history.span(arg or '-1')
- except IndexError:
- history = self.history.search(arg)
- for hi in history:
- self.poutput(hi.pr())
-
- def help_list(self):
- """Print help for do_list()."""
- help_str = """Lists command(s) from history in a flexible/searchable way.
-
- Usage: list [arg]
-
- Where arg is:
- no arg -> list most recent command
- arg is integer -> list one history item, by index
- a..b, a:b, a:, ..b -> list spans from a (or start) to b (or end)
- arg is string -> list all commands matching string search
- arg is /enclosed in forward-slashes/ -> regular expression search"""
- self.stdout.write("{}\n".format(help_str))
-
def do_edit(self, arg):
"""Edit a file or command in a text editor.
@@ -2170,7 +2152,7 @@ class History(list):
raise IndexError
if not results.group('separator'):
return [self[self._to_index(results.group('start'))]]
- start = self._to_index(results.group('start'))
+ start = self._to_index(results.group('start')) or 0 # Ensure start is not None
end = self._to_index(results.group('end'))
reverse = False
if end is not None:
diff --git a/docs/freefeatures.rst b/docs/freefeatures.rst
index 3c740c00..5e354549 100644
--- a/docs/freefeatures.rst
+++ b/docs/freefeatures.rst
@@ -220,8 +220,6 @@ also provide `bash-like history list editing`_.
.. automethod:: cmd2.Cmd.do_history
-.. automethod:: cmd2.Cmd.do_list
-
.. automethod:: cmd2.Cmd.do_run
Quitting the application
diff --git a/examples/exampleSession.txt b/examples/exampleSession.txt
index 893d7b59..62c130f0 100644
--- a/examples/exampleSession.txt
+++ b/examples/exampleSession.txt
@@ -3,8 +3,8 @@
Documented commands (type help <topic>):
========================================
-_relative_load edit help list orate py run say shell show
-cmdenvironment eof history load pause quit save set shortcuts speak
+_relative_load edit history orate py run say shell show
+cmdenvironment help load pause quit save set shortcuts speak
(Cmd) help say
Repeats what you tell me to.
|
history and list commands are largely redundant
The **history** and **list** commands largely have the same basic functionality of displaying commands from the history.
There is a partial overlap in the functionality where they both support some of the same features. But each also has at least one feature that the other doesn't have.
It would probably be more convenient for end users to combine all of the functionality into one common **history** command and remove the **list** command.
|
python-cmd2/cmd2
|
diff --git a/tests/conftest.py b/tests/conftest.py
index 3977de5f..41bd007a 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -15,8 +15,8 @@ import cmd2
# Help text for base cmd2.Cmd application
BASE_HELP = """Documented commands (type help <topic>):
========================================
-_relative_load edit history load py run set shortcuts
-cmdenvironment help list pause quit save shell show
+_relative_load edit history pause quit save shell show
+cmdenvironment help load py run set shortcuts
"""
# Help text for the history command
@@ -24,7 +24,8 @@ HELP_HISTORY = """history [arg]: lists past commands issued
| no arg: list all
| arg is integer: list one history item, by index
- | arg is string: string search
+ | a..b, a:b, a:, ..b -> list history items by a span of indices (inclusive)
+ | arg is string: list all commands matching string search
| arg is /enclosed in forward-slashes/: regular expression search
Usage: history [options] (limit on which commands to include)
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index ce47ef47..5783d944 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -142,48 +142,62 @@ shortcuts
""")
assert out == expected
-
-def test_base_list(base_app):
+def test_history_with_string_argument(base_app):
run_cmd(base_app, 'help')
run_cmd(base_app, 'shortcuts')
- out = run_cmd(base_app, 'list')
+ run_cmd(base_app, 'help history')
+ out = run_cmd(base_app, 'history help')
expected = normalize("""
--------------------------[2]
-shortcuts
+-------------------------[1]
+help
+-------------------------[3]
+help history
""")
assert out == expected
-def test_list_with_string_argument(base_app):
+def test_history_with_integer_argument(base_app):
run_cmd(base_app, 'help')
run_cmd(base_app, 'shortcuts')
- run_cmd(base_app, 'help list')
- out = run_cmd(base_app, 'list help')
+ out = run_cmd(base_app, 'history 1')
expected = normalize("""
-------------------------[1]
help
--------------------------[3]
-help list
""")
assert out == expected
-def test_list_with_integer_argument(base_app):
+def test_history_with_integer_span(base_app):
run_cmd(base_app, 'help')
run_cmd(base_app, 'shortcuts')
- out = run_cmd(base_app, 'list 1')
+ run_cmd(base_app, 'help history')
+ out = run_cmd(base_app, 'history 1..2')
expected = normalize("""
-------------------------[1]
help
+-------------------------[2]
+shortcuts
""")
assert out == expected
+def test_history_with_span_start(base_app):
+ run_cmd(base_app, 'help')
+ run_cmd(base_app, 'shortcuts')
+ run_cmd(base_app, 'help history')
+ out = run_cmd(base_app, 'history 2:')
+ expected = normalize("""
+-------------------------[2]
+shortcuts
+-------------------------[3]
+help history
+""")
+ assert out == expected
-def test_list_with_integer_span(base_app):
+def test_history_with_span_end(base_app):
run_cmd(base_app, 'help')
run_cmd(base_app, 'shortcuts')
- run_cmd(base_app, 'help list')
- out = run_cmd(base_app, 'list 1..2')
+ run_cmd(base_app, 'help history')
+ out = run_cmd(base_app, 'history :2')
expected = normalize("""
-------------------------[1]
help
@@ -201,17 +215,13 @@ def test_base_cmdenvironment(base_app):
Commands may be terminated with: [';']
Command-line arguments allowed: True
Output redirection and pipes allowed: True
+ Parsing of @options commands:
+ Use POSIX-style argument parser (vs Windows): False
+ Strip Quotes when using Windows-style argument parser: True
+ Use a list of arguments instead of a single argument string: False
+
""")
- assert out[:4] == expected[:4]
- assert out[4].strip().startswith('Settable parameters: ')
-
- # Settable parameters can be listed in any order, so need to validate carefully using unordered sets
- settable_params = {'continuation_prompt', 'default_file_name', 'prompt', 'abbrev', 'quiet', 'case_insensitive',
- 'colors', 'echo', 'timing', 'editor', 'feedback_to_output', 'debug', 'autorun_on_edit',
- 'locals_in_py'}
- out_params = set(out[4].split("Settable parameters: ")[1].split())
- assert settable_params == out_params
-
+ assert out == expected
def test_base_load(base_app, request):
test_dir = os.path.dirname(request.module.__file__)
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index c31b519d..03fec92a 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -106,9 +106,8 @@ def test_base_with_transcript(_cmdline_app):
Documented commands (type help <topic>):
========================================
-_relative_load help load py save shell speak
-cmdenvironment history orate quit say shortcuts
-edit list pause run set show
+_relative_load edit history orate py run say shell show
+cmdenvironment help load pause quit save set shortcuts speak
(Cmd) help say
Repeats what you tell me to.
diff --git a/tests/transcript.txt b/tests/transcript.txt
index 013e2d0f..d0fd86a6 100644
--- a/tests/transcript.txt
+++ b/tests/transcript.txt
@@ -2,9 +2,8 @@
Documented commands (type help <topic>):
========================================
-_relative_load help load py save shell speak
-cmdenvironment history orate quit say shortcuts
-edit list pause run set show
+_relative_load edit history orate py run say shell show
+cmdenvironment help load pause quit save set shortcuts speak
(Cmd) help say
Repeats what you tell me to.
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 4
}
|
0.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/python-cmd2/cmd2.git@a0d829e4105cd431198feb43534adaf953b090ba#egg=cmd2
exceptiongroup==1.2.2
iniconfig==2.1.0
mock==5.2.0
packaging==24.2
pluggy==1.5.0
pyparsing==3.2.3
pytest==8.3.5
six==1.17.0
tomli==2.2.1
|
name: cmd2
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- exceptiongroup==1.2.2
- iniconfig==2.1.0
- mock==5.2.0
- packaging==24.2
- pluggy==1.5.0
- pyparsing==3.2.3
- pytest==8.3.5
- six==1.17.0
- tomli==2.2.1
prefix: /opt/conda/envs/cmd2
|
[
"tests/test_cmd2.py::test_base_help",
"tests/test_cmd2.py::test_base_help_history",
"tests/test_cmd2.py::test_history_with_integer_span",
"tests/test_cmd2.py::test_history_with_span_start",
"tests/test_cmd2.py::test_history_with_span_end",
"tests/test_cmd2.py::test_base_cmdenvironment",
"tests/test_cmd2.py::test_allow_redirection",
"tests/test_cmd2.py::test_input_redirection",
"tests/test_transcript.py::test_base_with_transcript",
"tests/test_transcript.py::test_transcript_from_cmdloop"
] |
[
"tests/test_cmd2.py::test_output_redirection"
] |
[
"tests/test_cmd2.py::test_ver",
"tests/test_cmd2.py::test_base_shortcuts",
"tests/test_cmd2.py::test_base_show",
"tests/test_cmd2.py::test_base_show_long",
"tests/test_cmd2.py::test_base_set",
"tests/test_cmd2.py::test_base_set_not_supported",
"tests/test_cmd2.py::test_base_shell",
"tests/test_cmd2.py::test_base_py",
"tests/test_cmd2.py::test_base_run_python_script",
"tests/test_cmd2.py::test_base_error",
"tests/test_cmd2.py::test_base_history",
"tests/test_cmd2.py::test_history_with_string_argument",
"tests/test_cmd2.py::test_history_with_integer_argument",
"tests/test_cmd2.py::test_base_load",
"tests/test_cmd2.py::test_base_load_default_file",
"tests/test_cmd2.py::test_base_relative_load",
"tests/test_cmd2.py::test_base_save",
"tests/test_cmd2.py::test_pipe_to_shell",
"tests/test_cmd2.py::test_send_to_paste_buffer",
"tests/test_cmd2.py::test_base_timing",
"tests/test_cmd2.py::test_base_debug",
"tests/test_cmd2.py::test_base_colorize",
"tests/test_cmd2.py::test_edit_no_editor",
"tests/test_cmd2.py::test_edit_file",
"tests/test_cmd2.py::test_edit_number",
"tests/test_cmd2.py::test_edit_blank",
"tests/test_cmd2.py::test_base_py_interactive",
"tests/test_cmd2.py::test_base_cmdloop_with_queue",
"tests/test_cmd2.py::test_base_cmdloop_without_queue",
"tests/test_cmd2.py::test_cmdloop_without_rawinput",
"tests/test_transcript.py::Cmd2TestCase::runTest",
"tests/test_transcript.py::TestMyAppCase::runTest",
"tests/test_transcript.py::test_optparser",
"tests/test_transcript.py::test_optparser_nosuchoption",
"tests/test_transcript.py::test_comment_stripping",
"tests/test_transcript.py::test_optarser_correct_args_with_quotes_and_midline_options",
"tests/test_transcript.py::test_optarser_options_with_spaces_in_quotes",
"tests/test_transcript.py::test_commands_at_invocation",
"tests/test_transcript.py::test_select_options",
"tests/test_transcript.py::test_multiline_command_transcript_with_comments_at_beginning",
"tests/test_transcript.py::test_invalid_syntax",
"tests/test_transcript.py::test_regex_transcript"
] |
[] |
MIT License
| 1,326 |
|
smok-serwis__coolamqp-25
|
a379f33e87f4285a931031f4f69c70a5f30b46b7
|
2017-06-04 21:19:17
|
1b7c1619d9a65eabc4bb2502b098930e3d48a959
|
diff --git a/coolamqp/framing/base.py b/coolamqp/framing/base.py
index 5f7ccf2..31753c9 100644
--- a/coolamqp/framing/base.py
+++ b/coolamqp/framing/base.py
@@ -92,6 +92,15 @@ class AMQPContentPropertyList(object):
# todo they are immutable, so they could just serialize themselves...
+ def get(self, property_name, default=None):
+ """
+ Return a particular property, or default if not defined
+ :param property_name: property name, unicode
+ :param default: default value
+ :return: memoryview or bytes
+ """
+ return getattr(self, property_name, default)
+
@staticmethod
def zero_property_flags(property_flags):
"""
diff --git a/coolamqp/framing/compilation/compile_definitions.py b/coolamqp/framing/compilation/compile_definitions.py
index 0109147..62a957d 100644
--- a/coolamqp/framing/compilation/compile_definitions.py
+++ b/coolamqp/framing/compilation/compile_definitions.py
@@ -55,7 +55,7 @@ binary string? It's a memoryview all right.
Only thing that isn't are field names in tables.
"""
-import struct, collections, warnings, logging, six
+import struct, collections, logging, six
from coolamqp.framing.base import AMQPClass, AMQPMethodPayload, AMQPContentPropertyList
from coolamqp.framing.field_table import enframe_table, deframe_table, frame_table_size
@@ -230,7 +230,7 @@ Field = collections.namedtuple('Field', ('name', 'type', 'basic_type', 'reserved
#
# If you do not know in advance what properties you will be using, it is correct to use
# this constructor.
-
+ if zpf in BasicContentPropertyList.PARTICULAR_CLASSES:
return %s.PARTICULAR_CLASSES[zpf](**kwargs)
else:
logger.debug('Property field (%s:%d) not seen yet, compiling', repr(zpf))
diff --git a/coolamqp/framing/definitions.py b/coolamqp/framing/definitions.py
index cab1e07..e472c3d 100644
--- a/coolamqp/framing/definitions.py
+++ b/coolamqp/framing/definitions.py
@@ -23,7 +23,7 @@ binary string? It's a memoryview all right.
Only thing that isn't are field names in tables.
"""
-import struct, collections, warnings, logging, six
+import struct, collections, logging, six
from coolamqp.framing.base import AMQPClass, AMQPMethodPayload, AMQPContentPropertyList
from coolamqp.framing.field_table import enframe_table, deframe_table, frame_table_size
@@ -2359,6 +2359,23 @@ class BasicContentPropertyList(AMQPContentPropertyList):
])
zpf = six.binary_type(zpf)
+# If you know in advance what properties you will be using, use typized constructors like
+#
+# runs once
+# my_type = BasicContentPropertyList.typize('content_type', 'content_encoding')
+#
+# runs many times
+# props = my_type('text/plain', 'utf8')
+#
+# instead of
+#
+# # runs many times
+# props = BasicContentPropertyList(content_type='text/plain', content_encoding='utf8')
+#
+# This way you will be faster.
+#
+# If you do not know in advance what properties you will be using, it is correct to use
+# this constructor.
if zpf in BasicContentPropertyList.PARTICULAR_CLASSES:
return BasicContentPropertyList.PARTICULAR_CLASSES[zpf](**kwargs)
else:
|
Add some kind of .get() for attributes
Because doing
```python
try:
mode = message.properties.content_type.tobytes()
except AttributeError:
mode = b'application/x-pickle'
```
all over sucks
|
smok-serwis/coolamqp
|
diff --git a/tests/test_objects.py b/tests/test_objects.py
index 6a4c0c6..e3a109d 100644
--- a/tests/test_objects.py
+++ b/tests/test_objects.py
@@ -5,9 +5,7 @@ It sounds like a melody
from __future__ import print_function, absolute_import, division
import six
import unittest
-
-
-from coolamqp.objects import NodeDefinition
+from coolamqp.objects import NodeDefinition, MessageProperties
class TestObjects(unittest.TestCase):
@@ -23,3 +21,10 @@ class TestObjects(unittest.TestCase):
n1 = NodeDefinition(u'amqp://ala:ma@kota/')
self.assertEquals(n1.virtual_host, u'/')
+
+ def test_get_message_properties(self):
+ empty_p_msg = MessageProperties()
+ ce_p_msg = MessageProperties(content_encoding=b'wtf')
+
+ self.assertIsNone(empty_p_msg.get('content_encoding'), None)
+ self.assertEquals(ce_p_msg.get('content_encoding', b'wtf'), b'wtf')
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 3,
"test_score": 0
},
"num_modified_files": 3
}
|
0.90
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"nose",
"coverage",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.5",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
-e git+https://github.com/smok-serwis/coolamqp.git@a379f33e87f4285a931031f4f69c70a5f30b46b7#egg=CoolAMQP
coverage==6.2
futures==2.2.0
importlib-metadata==4.8.3
iniconfig==1.1.1
monotonic==1.6
nose==1.3.7
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: coolamqp
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- coverage==6.2
- futures==2.2.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- monotonic==1.6
- nose==1.3.7
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/coolamqp
|
[
"tests/test_objects.py::TestObjects::test_get_message_properties"
] |
[] |
[
"tests/test_objects.py::TestObjects::test_node_definition_from_amqp"
] |
[] |
MIT License
| 1,328 |
|
python-cmd2__cmd2-117
|
ccef0b4193297c0b88e8add373f6a49126ffe772
|
2017-06-04 23:45:14
|
ddfd3d9a400ae81468e9abcc89fe690c30b7ec7f
|
diff --git a/cmd2.py b/cmd2.py
index 3755ef56..13169a17 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -1610,8 +1610,11 @@ class Cmd(cmd.Cmd):
if arg:
# If a character indicating a slice is present, retrieve a slice of the history
if '..' in arg or ':' in arg:
- # Get a slice of history
- history = self.history.span(arg)
+ try:
+ # Get a slice of history
+ history = self.history.span(arg)
+ except IndexError:
+ history = self.history.get(arg)
else:
# Get item(s) from history by index or string search
history = self.history.get(arg)
|
Unhandled exception in history command introduced by recent changes
A bug was introduced by the recent changes which merged the list functionality into the history command.
When attempting to do a span of history indices, an index error can occur and that exception needs to be caught and default history behavior needs to occur at that point instead.
|
python-cmd2/cmd2
|
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 5783d944..2198d5c0 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -206,6 +206,17 @@ shortcuts
""")
assert out == expected
+def test_history_with_span_index_error(base_app):
+ run_cmd(base_app, 'help')
+ run_cmd(base_app, 'help history')
+ run_cmd(base_app, '!ls -hal :')
+ out = run_cmd(base_app, 'history "hal :"')
+ expected = normalize("""
+-------------------------[3]
+!ls -hal :
+""")
+ assert out == expected
+
def test_base_cmdenvironment(base_app):
out = run_cmd(base_app, 'cmdenvironment')
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 1
}
|
0.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"mock",
"sphinx",
"sphinx-rtd-theme",
"pytest-xdist",
"pytest-cov"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
attrs==22.2.0
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
-e git+https://github.com/python-cmd2/cmd2.git@ccef0b4193297c0b88e8add373f6a49126ffe772#egg=cmd2
coverage==6.2
docutils==0.18.1
execnet==1.9.0
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==3.0.3
MarkupSafe==2.0.1
mock==5.2.0
packaging==21.3
pluggy==1.0.0
py==1.11.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
pytest-xdist==3.0.2
pytz==2025.2
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0
|
name: cmd2
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- attrs==22.2.0
- babel==2.11.0
- charset-normalizer==2.0.12
- coverage==6.2
- docutils==0.18.1
- execnet==1.9.0
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- jinja2==3.0.3
- markupsafe==2.0.1
- mock==5.2.0
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pygments==2.14.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- pytest-xdist==3.0.2
- pytz==2025.2
- requests==2.27.1
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==5.3.0
- sphinx-rtd-theme==2.0.0
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- zipp==3.6.0
prefix: /opt/conda/envs/cmd2
|
[
"tests/test_cmd2.py::test_history_with_span_index_error"
] |
[
"tests/test_cmd2.py::test_output_redirection"
] |
[
"tests/test_cmd2.py::test_ver",
"tests/test_cmd2.py::test_base_help",
"tests/test_cmd2.py::test_base_help_history",
"tests/test_cmd2.py::test_base_shortcuts",
"tests/test_cmd2.py::test_base_show",
"tests/test_cmd2.py::test_base_show_long",
"tests/test_cmd2.py::test_base_set",
"tests/test_cmd2.py::test_base_set_not_supported",
"tests/test_cmd2.py::test_base_shell",
"tests/test_cmd2.py::test_base_py",
"tests/test_cmd2.py::test_base_run_python_script",
"tests/test_cmd2.py::test_base_error",
"tests/test_cmd2.py::test_base_history",
"tests/test_cmd2.py::test_history_with_string_argument",
"tests/test_cmd2.py::test_history_with_integer_argument",
"tests/test_cmd2.py::test_history_with_integer_span",
"tests/test_cmd2.py::test_history_with_span_start",
"tests/test_cmd2.py::test_history_with_span_end",
"tests/test_cmd2.py::test_base_cmdenvironment",
"tests/test_cmd2.py::test_base_load",
"tests/test_cmd2.py::test_base_load_default_file",
"tests/test_cmd2.py::test_base_relative_load",
"tests/test_cmd2.py::test_base_save",
"tests/test_cmd2.py::test_allow_redirection",
"tests/test_cmd2.py::test_input_redirection",
"tests/test_cmd2.py::test_pipe_to_shell",
"tests/test_cmd2.py::test_send_to_paste_buffer",
"tests/test_cmd2.py::test_base_timing",
"tests/test_cmd2.py::test_base_debug",
"tests/test_cmd2.py::test_base_colorize",
"tests/test_cmd2.py::test_edit_no_editor",
"tests/test_cmd2.py::test_edit_file",
"tests/test_cmd2.py::test_edit_number",
"tests/test_cmd2.py::test_edit_blank",
"tests/test_cmd2.py::test_base_py_interactive",
"tests/test_cmd2.py::test_base_cmdloop_with_queue",
"tests/test_cmd2.py::test_base_cmdloop_without_queue",
"tests/test_cmd2.py::test_cmdloop_without_rawinput"
] |
[] |
MIT License
| 1,329 |
|
tornadoweb__tornado-2074
|
62e47215ce12aee83f951758c96775a43e80475b
|
2017-06-05 05:01:04
|
03f13800e854a6fc9e6efa2168e694d9599348bd
|
ploxiln: just one test failure on Python 2.7.8:
```
FAIL: test_connection_refused (tornado.test.iostream_test.TestIOStream)
...
tornado/test/iostream_test.py", line 240, in test_connection_refused
self.assertFalse(self.connect_called)
AssertionError: True is not false
```
|
diff --git a/tornado/http1connection.py b/tornado/http1connection.py
index c6d3e336..b7a62b8c 100644
--- a/tornado/http1connection.py
+++ b/tornado/http1connection.py
@@ -357,6 +357,10 @@ class HTTP1Connection(httputil.HTTPConnection):
# Applications are discouraged from touching Transfer-Encoding,
# but if they do, leave it alone.
'Transfer-Encoding' not in headers)
+ # If connection to a 1.1 client will be closed, inform client
+ if (self._request_start_line.version == 'HTTP/1.1' and
+ self._disconnect_on_finish):
+ headers['Connection'] = 'close'
# If a 1.0 client asked for keep-alive, add the header.
if (self._request_start_line.version == 'HTTP/1.0' and
(self._request_headers.get('Connection', '').lower() ==
@@ -418,7 +422,7 @@ class HTTP1Connection(httputil.HTTPConnection):
def write(self, chunk, callback=None):
"""Implements `.HTTPConnection.write`.
- For backwards compatibility is is allowed but deprecated to
+ For backwards compatibility it is allowed but deprecated to
skip `write_headers` and instead call `write()` with a
pre-encoded header block.
"""
diff --git a/tornado/httpserver.py b/tornado/httpserver.py
index 7a7d08cd..95273a36 100644
--- a/tornado/httpserver.py
+++ b/tornado/httpserver.py
@@ -154,7 +154,6 @@ class HTTPServer(TCPServer, Configurable,
max_body_size=None, max_buffer_size=None,
trusted_downstream=None):
self.request_callback = request_callback
- self.no_keep_alive = no_keep_alive
self.xheaders = xheaders
self.protocol = protocol
self.conn_params = HTTP1ConnectionParameters(
|
http1connection: Send `Connection: close` before closing connection
From https://github.com/tornadoweb/tornado/pull/1963#issuecomment-305983002
When the client sends `Connection: close`, Tornado (correctly) responds by closing the connection after sending the response. [RFC 7230 section 6.6](https://tools.ietf.org/html/rfc7230#section-6.6) says that a server SHOULD set the `Connection: close` header in the response when it does so.
|
tornadoweb/tornado
|
diff --git a/tornado/test/httpserver_test.py b/tornado/test/httpserver_test.py
index f5f91a9d..d8342f74 100644
--- a/tornado/test/httpserver_test.py
+++ b/tornado/test/httpserver_test.py
@@ -719,6 +719,7 @@ class KeepAliveTest(AsyncHTTPTestCase):
self.stream.read_until_close(callback=self.stop)
data = self.wait()
self.assertTrue(not data)
+ self.assertEqual(self.headers['Connection'], 'close')
self.close()
# keepalive is supported for http 1.0 too, but it's opt-in
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 2
}
|
4.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"coverage",
"codecov",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
coverage==6.2
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
requests==2.27.1
tomli==1.2.3
-e git+https://github.com/tornadoweb/tornado.git@62e47215ce12aee83f951758c96775a43e80475b#egg=tornado
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0
|
name: tornado
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- charset-normalizer==2.0.12
- codecov==2.1.13
- coverage==6.2
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- requests==2.27.1
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- zipp==3.6.0
prefix: /opt/conda/envs/tornado
|
[
"tornado/test/httpserver_test.py::KeepAliveTest::test_request_close"
] |
[
"tornado/test/httpserver_test.py::HTTPServerRawTest::test_invalid_content_length",
"tornado/test/httpserver_test.py::HTTPServerRawTest::test_malformed_first_line",
"tornado/test/httpserver_test.py::HTTPServerRawTest::test_malformed_headers",
"tornado/test/httpserver_test.py::UnixSocketTest::test_unix_socket_bad_request",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_body_size_override_reset",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_large_body_buffered",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_large_body_buffered_chunked",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_large_body_streaming",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_large_body_streaming_chunked",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_timeout"
] |
[
"tornado/test/httpserver_test.py::SSLv23Test::test_error_logging",
"tornado/test/httpserver_test.py::SSLv23Test::test_large_post",
"tornado/test/httpserver_test.py::SSLv23Test::test_non_ssl_request",
"tornado/test/httpserver_test.py::SSLv23Test::test_ssl",
"tornado/test/httpserver_test.py::SSLv3Test::test_error_logging",
"tornado/test/httpserver_test.py::SSLv3Test::test_large_post",
"tornado/test/httpserver_test.py::SSLv3Test::test_non_ssl_request",
"tornado/test/httpserver_test.py::SSLv3Test::test_ssl",
"tornado/test/httpserver_test.py::TLSv1Test::test_error_logging",
"tornado/test/httpserver_test.py::TLSv1Test::test_large_post",
"tornado/test/httpserver_test.py::TLSv1Test::test_non_ssl_request",
"tornado/test/httpserver_test.py::TLSv1Test::test_ssl",
"tornado/test/httpserver_test.py::SSLContextTest::test_error_logging",
"tornado/test/httpserver_test.py::SSLContextTest::test_large_post",
"tornado/test/httpserver_test.py::SSLContextTest::test_non_ssl_request",
"tornado/test/httpserver_test.py::SSLContextTest::test_ssl",
"tornado/test/httpserver_test.py::BadSSLOptionsTest::test_missing_arguments",
"tornado/test/httpserver_test.py::BadSSLOptionsTest::test_missing_key",
"tornado/test/httpserver_test.py::HTTPConnectionTest::test_100_continue",
"tornado/test/httpserver_test.py::HTTPConnectionTest::test_multipart_form",
"tornado/test/httpserver_test.py::HTTPConnectionTest::test_newlines",
"tornado/test/httpserver_test.py::HTTPServerTest::test_double_slash",
"tornado/test/httpserver_test.py::HTTPServerTest::test_empty_post_parameters",
"tornado/test/httpserver_test.py::HTTPServerTest::test_empty_query_string",
"tornado/test/httpserver_test.py::HTTPServerTest::test_malformed_body",
"tornado/test/httpserver_test.py::HTTPServerTest::test_query_string_encoding",
"tornado/test/httpserver_test.py::HTTPServerTest::test_types",
"tornado/test/httpserver_test.py::HTTPServerRawTest::test_chunked_request_body",
"tornado/test/httpserver_test.py::HTTPServerRawTest::test_chunked_request_uppercase",
"tornado/test/httpserver_test.py::HTTPServerRawTest::test_empty_request",
"tornado/test/httpserver_test.py::XHeaderTest::test_ip_headers",
"tornado/test/httpserver_test.py::XHeaderTest::test_scheme_headers",
"tornado/test/httpserver_test.py::XHeaderTest::test_trusted_downstream",
"tornado/test/httpserver_test.py::SSLXHeaderTest::test_request_without_xprotocol",
"tornado/test/httpserver_test.py::ManualProtocolTest::test_manual_protocol",
"tornado/test/httpserver_test.py::UnixSocketTest::test_unix_socket",
"tornado/test/httpserver_test.py::KeepAliveTest::test_cancel_during_download",
"tornado/test/httpserver_test.py::KeepAliveTest::test_finish_while_closed",
"tornado/test/httpserver_test.py::KeepAliveTest::test_http10",
"tornado/test/httpserver_test.py::KeepAliveTest::test_http10_keepalive",
"tornado/test/httpserver_test.py::KeepAliveTest::test_http10_keepalive_extra_crlf",
"tornado/test/httpserver_test.py::KeepAliveTest::test_keepalive_chunked",
"tornado/test/httpserver_test.py::KeepAliveTest::test_pipelined_cancel",
"tornado/test/httpserver_test.py::KeepAliveTest::test_pipelined_requests",
"tornado/test/httpserver_test.py::KeepAliveTest::test_two_requests",
"tornado/test/httpserver_test.py::GzipTest::test_gzip",
"tornado/test/httpserver_test.py::GzipTest::test_uncompressed",
"tornado/test/httpserver_test.py::GzipUnsupportedTest::test_gzip_unsupported",
"tornado/test/httpserver_test.py::GzipUnsupportedTest::test_uncompressed",
"tornado/test/httpserver_test.py::StreamingChunkSizeTest::test_chunked_body",
"tornado/test/httpserver_test.py::StreamingChunkSizeTest::test_chunked_compressed",
"tornado/test/httpserver_test.py::StreamingChunkSizeTest::test_compressed_body",
"tornado/test/httpserver_test.py::StreamingChunkSizeTest::test_regular_body",
"tornado/test/httpserver_test.py::MaxHeaderSizeTest::test_large_headers",
"tornado/test/httpserver_test.py::MaxHeaderSizeTest::test_small_headers",
"tornado/test/httpserver_test.py::IdleTimeoutTest::test_idle_after_use",
"tornado/test/httpserver_test.py::IdleTimeoutTest::test_unused_connection",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_large_body_streaming_chunked_override",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_large_body_streaming_override",
"tornado/test/httpserver_test.py::BodyLimitsTest::test_small_body",
"tornado/test/httpserver_test.py::LegacyInterfaceTest::test_legacy_interface"
] |
[] |
Apache License 2.0
| 1,330 |
typesafehub__conductr-cli-484
|
c91b5dd3bee57bd813dfa26c9724edc13b3ce2c9
|
2017-06-05 13:40:46
|
39719b38ec6fc0f598756700a8a815b56bd8bc59
|
diff --git a/conductr_cli/endpoint.py b/conductr_cli/endpoint.py
index b8048f5..4cf8d4c 100644
--- a/conductr_cli/endpoint.py
+++ b/conductr_cli/endpoint.py
@@ -112,7 +112,7 @@ class HttpRequest:
def hocon(self):
request_tree = ConfigTree()
- request_tree.put(self.match if self.match else 'path', self.value)
+ request_tree.put(self.match if self.match else 'path-beg', self.value)
if self.method:
request_tree.put('method', self.method)
if self.rewrite:
|
bndl endpoint should default to --path-beg
|
typesafehub/conductr-cli
|
diff --git a/conductr_cli/test/test_bndl_utils.py b/conductr_cli/test/test_bndl_utils.py
index 70ab43c..72c200b 100644
--- a/conductr_cli/test/test_bndl_utils.py
+++ b/conductr_cli/test/test_bndl_utils.py
@@ -434,7 +434,7 @@ class TestBndlUtils(CliTestCase):
| http {
| requests = [
| {
- | path = "/"
+ | path-beg = "/"
| }
| ]
| }
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 1
}
|
1.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"tox",
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
argcomplete==3.6.1
arrow==1.3.0
cachetools==5.5.2
certifi==2025.1.31
chardet==5.2.0
charset-normalizer==3.4.1
colorama==0.4.6
-e git+https://github.com/typesafehub/conductr-cli.git@c91b5dd3bee57bd813dfa26c9724edc13b3ce2c9#egg=conductr_cli
distlib==0.3.9
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
filelock==3.18.0
idna==3.10
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
jsonschema==2.6.0
packaging @ file:///croot/packaging_1734472117206/work
pager==3.3
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
prettytable==0.7.2
psutil==5.9.8
Pygments==2.19.1
pyhocon==0.3.35
PyJWT==1.4.2
pyparsing==3.2.3
pyproject-api==1.9.0
pyreadline==2.1
pytest @ file:///croot/pytest_1738938843180/work
python-dateutil==2.9.0.post0
requests==2.32.3
requests-toolbelt==1.0.0
six==1.17.0
sseclient==0.0.14
toml==0.10.2
tomli==2.2.1
tox==4.25.0
types-python-dateutil==2.9.0.20241206
typing_extensions==4.13.0
urllib3==2.3.0
virtualenv==20.29.3
www-authenticate==0.9.2
|
name: conductr-cli
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- argcomplete==3.6.1
- arrow==1.3.0
- cachetools==5.5.2
- certifi==2025.1.31
- chardet==5.2.0
- charset-normalizer==3.4.1
- colorama==0.4.6
- distlib==0.3.9
- filelock==3.18.0
- idna==3.10
- jsonschema==2.6.0
- pager==3.3
- platformdirs==4.3.7
- prettytable==0.7.2
- psutil==5.9.8
- pygments==2.19.1
- pyhocon==0.3.35
- pyjwt==1.4.2
- pyparsing==3.2.3
- pyproject-api==1.9.0
- pyreadline==2.1
- python-dateutil==2.9.0.post0
- requests==2.32.3
- requests-toolbelt==1.0.0
- six==1.17.0
- sseclient==0.0.14
- toml==0.10.2
- tomli==2.2.1
- tox==4.25.0
- types-python-dateutil==2.9.0.20241206
- typing-extensions==4.13.0
- urllib3==2.3.0
- virtualenv==20.29.3
- www-authenticate==0.9.2
prefix: /opt/conda/envs/conductr-cli
|
[
"conductr_cli/test/test_bndl_utils.py::TestBndlUtils::test_load_bundle_args_into_conf"
] |
[] |
[
"conductr_cli/test/test_bndl_utils.py::TestBndlUtils::test_detect_format_dir",
"conductr_cli/test/test_bndl_utils.py::TestBndlUtils::test_detect_format_stream",
"conductr_cli/test/test_bndl_utils.py::TestBndlUtils::test_digest_reader_writer",
"conductr_cli/test/test_bndl_utils.py::TestBndlUtils::test_first_mtime",
"conductr_cli/test/test_bndl_utils.py::TestBndlUtils::test_load_bundle_args_into_conf_with_generic_defaults",
"conductr_cli/test/test_bndl_utils.py::TestBndlUtils::test_load_bundle_args_into_conf_with_play_defaults"
] |
[] |
Apache License 2.0
| 1,331 |
|
tornadoweb__tornado-2075
|
62e47215ce12aee83f951758c96775a43e80475b
|
2017-06-06 08:44:56
|
03f13800e854a6fc9e6efa2168e694d9599348bd
|
diff --git a/tornado/netutil.py b/tornado/netutil.py
index 31bbe803..e58db35d 100644
--- a/tornado/netutil.py
+++ b/tornado/netutil.py
@@ -241,9 +241,18 @@ def add_accept_handler(sock, callback):
is different from the ``callback(fd, events)`` signature used for
`.IOLoop` handlers.
+ A callable is returned which, when called, will remove the `.IOLoop`
+ event handler and stop processing further incoming connections.
+
.. versionchanged:: 5.0
The ``io_loop`` argument (deprecated since version 4.1) has been removed.
+
+ .. versionchanged:: 5.0
+ A callable is returned (``None`` was returned before).
"""
+ io_loop = IOLoop.current()
+ removed = [False]
+
def accept_handler(fd, events):
# More connections may come in while we're handling callbacks;
# to prevent starvation of other tasks we must limit the number
@@ -257,6 +266,9 @@ def add_accept_handler(sock, callback):
# heuristic for the number of connections we can reasonably
# accept at once.
for i in xrange(_DEFAULT_BACKLOG):
+ if removed[0]:
+ # The socket was probably closed
+ return
try:
connection, address = sock.accept()
except socket.error as e:
@@ -272,7 +284,13 @@ def add_accept_handler(sock, callback):
raise
set_close_exec(connection.fileno())
callback(connection, address)
- IOLoop.current().add_handler(sock, accept_handler, IOLoop.READ)
+
+ def remove_handler():
+ io_loop.remove_handler(sock)
+ removed[0] = True
+
+ io_loop.add_handler(sock, accept_handler, IOLoop.READ)
+ return remove_handler
def is_valid_ip(ip):
diff --git a/tornado/tcpserver.py b/tornado/tcpserver.py
index b3cdaa2c..fea215f5 100644
--- a/tornado/tcpserver.py
+++ b/tornado/tcpserver.py
@@ -110,7 +110,8 @@ class TCPServer(object):
read_chunk_size=None):
self.io_loop = IOLoop.current()
self.ssl_options = ssl_options
- self._sockets = {} # fd -> socket object
+ self._sockets = {} # fd -> socket object
+ self._handlers = {} # fd -> remove_handler callable
self._pending_sockets = []
self._started = False
self._stopped = False
@@ -156,7 +157,8 @@ class TCPServer(object):
"""
for sock in sockets:
self._sockets[sock.fileno()] = sock
- add_accept_handler(sock, self._handle_connection)
+ self._handlers[sock.fileno()] = add_accept_handler(
+ sock, self._handle_connection)
def add_socket(self, socket):
"""Singular version of `add_sockets`. Takes a single socket object."""
@@ -233,7 +235,8 @@ class TCPServer(object):
self._stopped = True
for fd, sock in self._sockets.items():
assert sock.fileno() == fd
- self.io_loop.remove_handler(fd)
+ # Unregister socket from IOLoop
+ self._handlers.pop(fd)()
sock.close()
def handle_stream(self, stream, address):
|
EBADF in accept() handler if TCPServer.stop() was called in the meantime
We've had sporadic issues where a EBADF error when calling accept() was being logged. See example here:
https://travis-ci.org/dask/distributed/jobs/238031120#L1596-L1607
After some debugging, I've come to the conclusion that this happens whenever a IO handler calls TCPServer.stop(), while another handler is pending for a connection request on that TCPServer's listening socket(s). TCPServer.stop() closes the listening socket immediately and, when the queued accept handler is called, it finds a closed socket fd.
|
tornadoweb/tornado
|
diff --git a/tornado/test/tcpserver_test.py b/tornado/test/tcpserver_test.py
index 9afb5420..2417992c 100644
--- a/tornado/test/tcpserver_test.py
+++ b/tornado/test/tcpserver_test.py
@@ -68,3 +68,48 @@ class TCPServerTest(AsyncTestCase):
server.add_socket(sock)
server.stop()
server.stop()
+
+ @gen_test
+ def test_stop_in_callback(self):
+ # Issue #2069: calling server.stop() in a loop callback should not
+ # raise EBADF when the loop handles other server connection
+ # requests in the same loop iteration
+
+ class TestServer(TCPServer):
+ @gen.coroutine
+ def handle_stream(self, stream, address):
+ server.stop()
+ yield stream.read_until_close()
+
+ sock, port = bind_unused_port()
+ server = TestServer()
+ server.add_socket(sock)
+ server_addr = ('localhost', port)
+ N = 40
+ clients = [IOStream(socket.socket()) for i in range(N)]
+ connected_clients = []
+
+ @gen.coroutine
+ def connect(c):
+ try:
+ yield c.connect(server_addr)
+ except EnvironmentError:
+ pass
+ else:
+ connected_clients.append(c)
+
+ yield [connect(c) for c in clients]
+
+ self.assertGreater(len(connected_clients), 0,
+ "all clients failed connecting")
+ try:
+ if len(connected_clients) == N:
+ # Ideally we'd make the test deterministic, but we're testing
+ # for a race condition in combination with the system's TCP stack...
+ self.skipTest("at least one client should fail connecting "
+ "for the test to be meaningful")
+ finally:
+ for c in connected_clients:
+ c.close()
+
+ # Here tearDown() would re-raise the EBADF encountered in the IO loop
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 1
},
"num_modified_files": 2
}
|
4.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pycurl>=7.19.3.1",
"twisted",
"pycares",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
Automat==22.10.0
certifi==2021.5.30
cffi==1.15.1
constantly==15.1.0
hyperlink==21.0.0
idna==3.10
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
incremental==22.10.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pycares==4.3.0
pycparser==2.21
pycurl==7.45.6
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
six==1.17.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
-e git+https://github.com/tornadoweb/tornado.git@62e47215ce12aee83f951758c96775a43e80475b#egg=tornado
Twisted==22.4.0
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
zope.interface==5.5.2
|
name: tornado
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- automat==22.10.0
- cffi==1.15.1
- constantly==15.1.0
- hyperlink==21.0.0
- idna==3.10
- incremental==22.10.0
- pycares==4.3.0
- pycparser==2.21
- pycurl==7.45.6
- six==1.17.0
- twisted==22.4.0
- zope-interface==5.5.2
prefix: /opt/conda/envs/tornado
|
[
"tornado/test/tcpserver_test.py::TCPServerTest::test_stop_in_callback"
] |
[] |
[
"tornado/test/tcpserver_test.py::TCPServerTest::test_handle_stream_coroutine_logging",
"tornado/test/tcpserver_test.py::TCPServerTest::test_handle_stream_native_coroutine",
"tornado/test/tcpserver_test.py::TCPServerTest::test_stop_twice"
] |
[] |
Apache License 2.0
| 1,334 |
|
jboss-dockerfiles__dogen-135
|
a155c8b0383d66f5a4f81501e855edfcb148cb3e
|
2017-06-06 09:14:02
|
bc9263c5b683fdf901ac1646286ee3908b85dcdc
|
dbecvarik: url should be deprecated only, otherwise it will make all of current descriptors unusable.
|
diff --git a/dogen/generator.py b/dogen/generator.py
index 52fa501..d59602d 100644
--- a/dogen/generator.py
+++ b/dogen/generator.py
@@ -58,7 +58,7 @@ class Generator(object):
r = requests.get(location, verify=self.ssl_verify, stream=True)
if r.status_code != 200:
- raise Exception("Could not download file from %s" % location)
+ raise Error("Could not download file from %s" % location)
with open(output, 'wb') as f:
for chunk in r.iter_content(chunk_size=1024):
@@ -253,10 +253,23 @@ class Generator(object):
self.cfg['artifacts'] = {}
for source in self.cfg['sources']:
- url = source['url']
- target = source.get('target')
+ url = source.get('url')
+ artifact = source.get('artifact')
+
+ if url:
+ self.log.warn("The 'url' key is deprecated, please use 'artifact' for specifying the %s artifact location" % url)
+
+ if artifact:
+ self.log.warn("You specified both: 'artifact' and 'url' for a source file, 'artifact': will be used: %s" % artifact)
+ else:
+ # Backward compatibility
+ artifact = url
- basename = os.path.basename(url)
+ if not artifact:
+ raise Error("Artifact location for one or more sources was not provided, please check your image descriptor!")
+
+ basename = os.path.basename(artifact)
+ target = source.get('target')
# In case we specify target name for the artifact - use it
if not target:
@@ -270,7 +283,7 @@ class Generator(object):
md5sum = source.get('md5sum')
if md5sum:
- self.log.warn("The 'md5sum' key is deprecated, please use 'md5' for %s. Or better switch to sha256 or sha1." % url)
+ self.log.warn("The 'md5sum' key is deprecated, please use 'md5' for %s. Or better switch to sha256 or sha1." % artifact)
# Backwards compatibility for md5sum
if not source.get('md5'):
@@ -295,17 +308,17 @@ class Generator(object):
sources_cache = os.environ.get("DOGEN_SOURCES_CACHE")
if sources_cache:
- url = sources_cache.replace('#filename#', basename)
+ artifact = sources_cache.replace('#filename#', basename)
if algorithms:
if len(algorithms) > 1:
- self.log.warn("You specified multiple algorithms for '%s' url, but only '%s' will be used to fetch it from cache" % (url, algorithms[0]))
+ self.log.warn("You specified multiple algorithms for '%s' artifact, but only '%s' will be used to fetch it from cache" % (artifact, algorithms[0]))
- url = url.replace('#hash#', source[algorithms[0]]).replace('#algorithm#', algorithms[0])
+ artifact = artifact.replace('#hash#', source[algorithms[0]]).replace('#algorithm#', algorithms[0])
- self.log.info("Using '%s' as cached location for artifact" % url)
+ self.log.info("Using '%s' as cached location for artifact" % artifact)
- self._fetch_file(url, filename)
+ self._fetch_file(artifact, filename)
if algorithms:
for algorithm in algorithms:
@@ -327,6 +340,6 @@ class Generator(object):
filesum = hash.hexdigest()
if filesum.lower() != checksum.lower():
- raise Exception("The %s computed for the '%s' file ('%s') doesn't match the '%s' value" % (algorithm, filename, filesum, checksum))
+ raise Error("The %s computed for the '%s' file ('%s') doesn't match the '%s' value" % (algorithm, filename, filesum, checksum))
self.log.debug("Hash is correct.")
diff --git a/dogen/schema/kwalify_schema.yaml b/dogen/schema/kwalify_schema.yaml
index a54aa67..b8035d1 100644
--- a/dogen/schema/kwalify_schema.yaml
+++ b/dogen/schema/kwalify_schema.yaml
@@ -66,8 +66,9 @@ map:
sources:
seq:
- map:
- url: {type: str}
- md5sum: {type: str}
+ url: {type: str} # deprecated, use artifact
+ artifact: {type: str}
+ md5sum: {type: str} # deprecated, use md5
md5: {type: str}
sha1: {type: str}
sha256: {type: str}
diff --git a/dogen/template_helper.py b/dogen/template_helper.py
index 3e88f03..e36693b 100644
--- a/dogen/template_helper.py
+++ b/dogen/template_helper.py
@@ -10,7 +10,7 @@ class TemplateHelper(object):
if target:
return target
- return os.path.basename(source['url'])
+ return os.path.basename(source['artifact'])
def cmd(self, arr):
"""
|
Rename "url" in sources to "artifact"
It doesn't need to be a URL, it can be a filename only too. It's a bit misleading to call it "url".
|
jboss-dockerfiles/dogen
|
diff --git a/tests/schemas/good/openshift_amq_6.2_image.yaml b/tests/schemas/good/openshift_amq_6.2_image.yaml
index fa4f3cf..2cde6e8 100644
--- a/tests/schemas/good/openshift_amq_6.2_image.yaml
+++ b/tests/schemas/good/openshift_amq_6.2_image.yaml
@@ -51,10 +51,10 @@ scripts:
- package: os-amq-permissions
exec: install.sh
sources:
- - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+ - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
md5: 1b996b9083f537917b307309b0e2f16d
- - url: http://redacted/openshift-activemq-plugin-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-activemq-plugin-1.0.0.Final-redhat-1.jar
md5: 325fbbaff0f7dbea42203346d9c3bf98
- - url: http://redacted/jboss-dmr-1.2.2.Final-redhat-1.jar
+ - artifact: http://redacted/jboss-dmr-1.2.2.Final-redhat-1.jar
md5: 8df4cbf6f39c3bce21de16ad708084d5
diff --git a/tests/schemas/good/openshift_datagrid_6.5_image.yaml b/tests/schemas/good/openshift_datagrid_6.5_image.yaml
index b20b77e..67ff7a1 100644
--- a/tests/schemas/good/openshift_datagrid_6.5_image.yaml
+++ b/tests/schemas/good/openshift_datagrid_6.5_image.yaml
@@ -150,17 +150,17 @@ scripts:
exec: configure.sh
user: 185
sources:
- - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+ - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
md5: 1b996b9083f537917b307309b0e2f16d
- - url: http://redacted/javax.json-1.0.4.jar
+ - artifact: http://redacted/javax.json-1.0.4.jar
md5: 569870f975deeeb6691fcb9bc02a9555
- - url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
+ - artifact: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
md5: 7c743e35463db5f55f415dd666d705c5
- - url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
md5: bafa4db7efe4082d76cde2fa9499bf84
- - url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
md5: 71bbfdf795a2c65e4473df242f765490
- - url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
md5: 145add030a89c3ed588dce27b0f24999
- - url: http://redacted/oauth-20100527.jar
+ - artifact: http://redacted/oauth-20100527.jar
md5: 91c7c70579f95b7ddee95b2143a49b41
diff --git a/tests/schemas/good/openshift_eap_6.4_image.yaml b/tests/schemas/good/openshift_eap_6.4_image.yaml
index 2b24f39..0ab9029 100644
--- a/tests/schemas/good/openshift_eap_6.4_image.yaml
+++ b/tests/schemas/good/openshift_eap_6.4_image.yaml
@@ -97,23 +97,23 @@ scripts:
exec: configure.sh
user: 185
sources:
- - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+ - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
md5: 1b996b9083f537917b307309b0e2f16d
- - url: http://redacted/javax.json-1.0.4.jar
+ - artifact: http://redacted/javax.json-1.0.4.jar
md5: 569870f975deeeb6691fcb9bc02a9555
- - url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
+ - artifact: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
md5: 7c743e35463db5f55f415dd666d705c5
- - url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
md5: bafa4db7efe4082d76cde2fa9499bf84
- - url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
md5: 71bbfdf795a2c65e4473df242f765490
- - url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
md5: 145add030a89c3ed588dce27b0f24999
- - url: http://redacted/oauth-20100527.jar
+ - artifact: http://redacted/oauth-20100527.jar
md5: 91c7c70579f95b7ddee95b2143a49b41
- - url: http://redacted/activemq-rar-5.11.0.redhat-621084.rar
+ - artifact: http://redacted/activemq-rar-5.11.0.redhat-621084.rar
md5: 207e17ac8102c93233fe2764d1fe8499
- - url: http://redacted/rh-sso-7.0.0-eap6-adapter.zip
+ - artifact: http://redacted/rh-sso-7.0.0-eap6-adapter.zip
md5: 6fd81306ea4297307dcc5f51712e5f95
- - url: http://redacted/rh-sso-7.0.0-saml-eap6-adapter.zip
+ - artifact: http://redacted/rh-sso-7.0.0-saml-eap6-adapter.zip
md5: 3b953c114dd09f86e71e18cd57d8af56
diff --git a/tests/schemas/good/openshift_eap_7.0_image.yaml b/tests/schemas/good/openshift_eap_7.0_image.yaml
index 08f5a5c..7c0c4b4 100644
--- a/tests/schemas/good/openshift_eap_7.0_image.yaml
+++ b/tests/schemas/good/openshift_eap_7.0_image.yaml
@@ -106,23 +106,23 @@ scripts:
exec: configure.sh
user: 185
sources:
- - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+ - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
md5: 1b996b9083f537917b307309b0e2f16d
- - url: http://redacted/javax.json-1.0.4.jar
+ - artifact: http://redacted/javax.json-1.0.4.jar
md5: 569870f975deeeb6691fcb9bc02a9555
- - url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
+ - artifact: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
md5: 7c743e35463db5f55f415dd666d705c5
- - url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
md5: bafa4db7efe4082d76cde2fa9499bf84
- - url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
md5: 71bbfdf795a2c65e4473df242f765490
- - url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
md5: 145add030a89c3ed588dce27b0f24999
- - url: http://redacted/oauth-20100527.jar
+ - artifact: http://redacted/oauth-20100527.jar
md5: 91c7c70579f95b7ddee95b2143a49b41
- - url: http://redacted/activemq-rar-5.11.0.redhat-621084.rar
+ - artifact: http://redacted/activemq-rar-5.11.0.redhat-621084.rar
md5: 207e17ac8102c93233fe2764d1fe8499
- - url: http://redacted/rh-sso-7.0.0-eap7-adapter.zip
+ - artifact: http://redacted/rh-sso-7.0.0-eap7-adapter.zip
md5: 1542c1014d9ebc24522839a5fa8bee4d
- - url: http://redacted/rh-sso-7.0.0-saml-eap7-adapter.zip
+ - artifact: http://redacted/rh-sso-7.0.0-saml-eap7-adapter.zip
md5: ce858a47c707b362a968ffd5c66768dd
diff --git a/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml b/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml
index 953fa45..9c5855d 100644
--- a/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml
+++ b/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml
@@ -100,23 +100,23 @@ scripts:
user: 185
exec: configure.sh
sources:
- - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+ - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
md5: 1b996b9083f537917b307309b0e2f16d
- - url: http://redacted/javax.json-1.0.4.jar
+ - artifact: http://redacted/javax.json-1.0.4.jar
md5: 569870f975deeeb6691fcb9bc02a9555
- - url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
+ - artifact: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
md5: 7c743e35463db5f55f415dd666d705c5
- - url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
md5: bafa4db7efe4082d76cde2fa9499bf84
- - url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
md5: 71bbfdf795a2c65e4473df242f765490
- - url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
md5: 145add030a89c3ed588dce27b0f24999
- - url: http://redacted/oauth-20100527.jar
+ - artifact: http://redacted/oauth-20100527.jar
md5: 91c7c70579f95b7ddee95b2143a49b41
- - url: http://redacted/activemq-rar-5.11.0.redhat-621084.rar
+ - artifact: http://redacted/activemq-rar-5.11.0.redhat-621084.rar
md5: 207e17ac8102c93233fe2764d1fe8499
- - url: http://redacted/rh-sso-7.0.0-eap6-adapter.zip
+ - artifact: http://redacted/rh-sso-7.0.0-eap6-adapter.zip
md5: 6fd81306ea4297307dcc5f51712e5f95
- - url: http://redacted/rh-sso-7.0.0-saml-eap6-adapter.zip
+ - artifact: http://redacted/rh-sso-7.0.0-saml-eap6-adapter.zip
md5: 3b953c114dd09f86e71e18cd57d8af56
diff --git a/tests/schemas/good/openshift_kieserver_6.2_image.yaml b/tests/schemas/good/openshift_kieserver_6.2_image.yaml
index 3a1bd93..77134f3 100644
--- a/tests/schemas/good/openshift_kieserver_6.2_image.yaml
+++ b/tests/schemas/good/openshift_kieserver_6.2_image.yaml
@@ -129,12 +129,12 @@ scripts:
user: 185
exec: configure.sh
sources:
- - url: http://redacted/jboss-bpmsuite-6.2.1.GA-redhat-2-deployable-eap6.x.zip
+ - artifact: http://redacted/jboss-bpmsuite-6.2.1.GA-redhat-2-deployable-eap6.x.zip
md5: b63c7dfe82a44a140cce3a824c8c2e90
- - url: http://redacted/openshift-kieserver-common-1.0.2.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-kieserver-common-1.0.2.Final-redhat-1.jar
md5: 5858103206d0bcc4695aad38a7430c75
- - url: http://redacted/openshift-kieserver-jms-1.0.2.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-kieserver-jms-1.0.2.Final-redhat-1.jar
md5: 4a80b12399c49a1d274bbd1c62b49b65
- - url: http://redacted/openshift-kieserver-web-1.0.2.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-kieserver-web-1.0.2.Final-redhat-1.jar
md5: adf602d027020b30cc5743d3d5d8e2f7
diff --git a/tests/schemas/good/openshift_kieserver_6.3_image.yaml b/tests/schemas/good/openshift_kieserver_6.3_image.yaml
index caf4912..010b945 100644
--- a/tests/schemas/good/openshift_kieserver_6.3_image.yaml
+++ b/tests/schemas/good/openshift_kieserver_6.3_image.yaml
@@ -130,13 +130,13 @@ scripts:
user: 185
exec: configure.sh
sources:
- - url: http://redacted/jboss-bpmsuite-6.3.0.GA-deployable-eap6.x.zip
+ - artifact: http://redacted/jboss-bpmsuite-6.3.0.GA-deployable-eap6.x.zip
md5: 4e283717b0f295adf7025971065d6db8
- - url: http://redacted/jboss-bpmsuite-6.3.0.GA-supplementary-tools.zip
+ - artifact: http://redacted/jboss-bpmsuite-6.3.0.GA-supplementary-tools.zip
md5: b3d135e2d297f1e89d9ff8357c1e9aac
- - url: http://redacted/openshift-kieserver-common-1.0.2.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-kieserver-common-1.0.2.Final-redhat-1.jar
md5: 5858103206d0bcc4695aad38a7430c75
- - url: http://redacted/openshift-kieserver-jms-1.0.2.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-kieserver-jms-1.0.2.Final-redhat-1.jar
md5: 4a80b12399c49a1d274bbd1c62b49b65
- - url: http://redacted/openshift-kieserver-web-1.0.2.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-kieserver-web-1.0.2.Final-redhat-1.jar
md5: adf602d027020b30cc5743d3d5d8e2f7
diff --git a/tests/schemas/good/openshift_sso_7.0_image.yaml b/tests/schemas/good/openshift_sso_7.0_image.yaml
index 76cee4f..0c43530 100644
--- a/tests/schemas/good/openshift_sso_7.0_image.yaml
+++ b/tests/schemas/good/openshift_sso_7.0_image.yaml
@@ -96,18 +96,18 @@ scripts:
- package: os-sso
exec: configure.sh
sources:
- - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+ - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
md5: 1b996b9083f537917b307309b0e2f16d
- - url: http://redacted/javax.json-1.0.4.jar
+ - artifact: http://redacted/javax.json-1.0.4.jar
md5: 569870f975deeeb6691fcb9bc02a9555
- - url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
+ - artifact: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
md5: 7c743e35463db5f55f415dd666d705c5
- - url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
md5: bafa4db7efe4082d76cde2fa9499bf84
- - url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
md5: 71bbfdf795a2c65e4473df242f765490
- - url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
+ - artifact: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
md5: 145add030a89c3ed588dce27b0f24999
- - url: http://redacted/oauth-20100527.jar
+ - artifact: http://redacted/oauth-20100527.jar
md5: 91c7c70579f95b7ddee95b2143a49b41
diff --git a/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml b/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml
index 4c4d54e..c7e5991 100644
--- a/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml
+++ b/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml
@@ -93,11 +93,11 @@ scripts:
user: 185
exec: configure.sh
sources:
- - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+ - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
md5: 1b996b9083f537917b307309b0e2f16d
- - url: http://redacted/json-smart-1.1.1.jar
+ - artifact: http://redacted/json-smart-1.1.1.jar
md5: c382c9109020d001b96329c2057ba933
- - url: http://redacted/commons-lang-2.6.0.redhat-4.jar
+ - artifact: http://redacted/commons-lang-2.6.0.redhat-4.jar
md5: 0da0fbfb0ff2160df3a4832d28003361
- - url: http://redacted/jsonevent-layout-1.7-redhat-1.jar
+ - artifact: http://redacted/jsonevent-layout-1.7-redhat-1.jar
md5: 08f9aa037ac91c4aaa0d5dabf143a60e
diff --git a/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml b/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml
index 6a0b095..b7039a3 100644
--- a/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml
+++ b/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml
@@ -93,11 +93,11 @@ scripts:
user: 185
exec: configure.sh
sources:
- - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+ - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
md5: 1b996b9083f537917b307309b0e2f16d
- - url: http://redacted/json-smart-1.1.1.jar
+ - artifact: http://redacted/json-smart-1.1.1.jar
md5: c382c9109020d001b96329c2057ba933
- - url: http://redacted/commons-lang-2.6.0.redhat-4.jar
+ - artifact: http://redacted/commons-lang-2.6.0.redhat-4.jar
md5: 0da0fbfb0ff2160df3a4832d28003361
- - url: http://redacted/jsonevent-layout-1.7-redhat-1.jar
+ - artifact: http://redacted/jsonevent-layout-1.7-redhat-1.jar
md5: 08f9aa037ac91c4aaa0d5dabf143a60e
diff --git a/tests/test_unit_generate_configuration.py b/tests/test_unit_generate_configuration.py
index 531ee8e..268f9d5 100644
--- a/tests/test_unit_generate_configuration.py
+++ b/tests/test_unit_generate_configuration.py
@@ -245,7 +245,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_without_specified_md5sum(self, mock_fetch_file):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip".encode())
+ f.write("sources:\n - artifact: http://somehost.com/file.zip".encode())
generator = Generator(self.log, self.args)
generator.configure()
@@ -257,7 +257,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources(self, mock_fetch_file, mock_check_sum):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode())
+ f.write("sources:\n - artifact: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode())
generator = Generator(self.log, self.args)
generator.configure()
@@ -270,7 +270,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_with_multiple_hashes(self, mock_fetch_file, mock_check_sum):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode())
+ f.write("sources:\n - artifact: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode())
generator = Generator(self.log, self.args)
generator.configure()
@@ -284,7 +284,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_with_multiple_hashes_and_cache_url(self, mock_fetch_file, mock_check_sum):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode())
+ f.write("sources:\n - artifact: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode())
k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/get?#algorithm#=#hash#'})
k.start()
@@ -301,7 +301,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_with_deprecated_md5sum(self, mock_fetch_file, mock_check_sum):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b".encode())
+ f.write("sources:\n - artifact: http://somehost.com/file.zip\n md5sum: e9013fc202c87be48e3b302df10efc4b".encode())
generator = Generator(self.log, self.args)
generator.configure()
@@ -314,7 +314,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_with_sha1(self, mock_fetch_file, mock_check_sum):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode())
+ f.write("sources:\n - artifact: http://somehost.com/file.zip\n sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode())
generator = Generator(self.log, self.args)
generator.configure()
@@ -327,7 +327,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_with_sha256(self, mock_fetch_file, mock_check_sum):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n sha256: 9912afca5a08e9e05174c5fbb7a9a1510283d5952f90796c6a3e8bc78217e2fb".encode())
+ f.write("sources:\n - artifact: http://somehost.com/file.zip\n sha256: 9912afca5a08e9e05174c5fbb7a9a1510283d5952f90796c6a3e8bc78217e2fb".encode())
generator = Generator(self.log, self.args)
generator.configure()
@@ -341,7 +341,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_when_local_file_exists_and_is_correct(self, mock_fetch_file, mock_check_sum, mock_path):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode())
+ f.write("sources:\n - artifact: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode())
generator = Generator(self.log, self.args)
generator.configure()
@@ -354,7 +354,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_when_local_file_exists_and_is_broken(self, mock_fetch_file, mock_check_sum, mock_path):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode())
+ f.write("sources:\n - artifact: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode())
generator = Generator(self.log, self.args)
generator.configure()
@@ -366,7 +366,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_with_target_filename(self, mock_fetch_file, mock_check_sum):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode())
+ f.write("sources:\n - artifact: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode())
generator = Generator(self.log, self.args)
generator.configure()
@@ -378,7 +378,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_with_cache_url(self, mock_fetch_file, mock_check_sum):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode())
+ f.write("sources:\n - artifact: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b".encode())
k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/get?#algorithm#=#hash#'})
k.start()
@@ -393,7 +393,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_with_cache_url_and_target_filename(self, mock_fetch_file, mock_check_sum):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode())
+ f.write("sources:\n - artifact: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode())
k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/get?#algorithm#=#hash#'})
k.start()
@@ -408,7 +408,7 @@ class TestConfig(unittest.TestCase):
@mock.patch('dogen.generator.Generator._fetch_file')
def test_handling_sources_with_cache_url_with_filename_to_replace(self, mock_fetch_file, mock_check_sum):
with self.descriptor as f:
- f.write("sources:\n - url: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode())
+ f.write("sources:\n - artifact: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode())
k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/#filename#'})
k.start()
@@ -418,3 +418,31 @@ class TestConfig(unittest.TestCase):
k.stop()
mock_fetch_file.assert_called_with('http://cache/file.zip', 'target/target.zip')
+
+ # https://github.com/jboss-dockerfiles/dogen/issues/132
+ @mock.patch('dogen.generator.Generator.check_sum')
+ @mock.patch('dogen.generator.Generator._fetch_file')
+ def test_handling_sources_with_url_and_artifact_keys_set(self, mock_fetch_file, mock_check_sum):
+ with self.descriptor as f:
+ f.write("sources:\n - url: http://something.com\n artifact: http://somehost.com/file.zip\n md5: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode())
+
+ generator = Generator(self.log, self.args)
+ generator.configure()
+ generator.handle_sources()
+
+ self.log.warn.assert_any_call("The 'url' key is deprecated, please use 'artifact' for specifying the http://something.com artifact location")
+ self.log.warn.assert_any_call("You specified both: 'artifact' and 'url' for a source file, 'artifact': will be used: http://somehost.com/file.zip")
+ mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/target.zip')
+
+ @mock.patch('dogen.generator.Generator._fetch_file')
+ def test_handling_sources_should_fail_when_no_artifact_nor_url_is_provided(self, mock_fetch_file):
+ with self.descriptor as f:
+ f.write("sources:\n - md5: e9013fc202c87be48e3b302df10efc4b\n target: target.zip".encode())
+
+ generator = Generator(self.log, self.args)
+ generator.configure()
+
+ with self.assertRaises(Error) as cm:
+ generator.handle_sources()
+
+ self.assertEquals(str(cm.exception), "Artifact location for one or more sources was not provided, please check your image descriptor!")
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 3
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi==2025.1.31
charset-normalizer==3.4.1
coverage==7.8.0
docopt==0.6.2
-e git+https://github.com/jboss-dockerfiles/dogen.git@a155c8b0383d66f5a4f81501e855edfcb148cb3e#egg=dogen
exceptiongroup==1.2.2
idna==3.10
iniconfig==2.1.0
Jinja2==3.1.6
MarkupSafe==3.0.2
mock==5.2.0
packaging==24.2
pluggy==1.5.0
pykwalify==1.8.0
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
PyYAML==6.0.2
requests==2.32.3
ruamel.yaml==0.18.10
ruamel.yaml.clib==0.2.12
six==1.17.0
tomli==2.2.1
urllib3==2.3.0
|
name: dogen
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- certifi==2025.1.31
- charset-normalizer==3.4.1
- coverage==7.8.0
- docopt==0.6.2
- exceptiongroup==1.2.2
- idna==3.10
- iniconfig==2.1.0
- jinja2==3.1.6
- markupsafe==3.0.2
- mock==5.2.0
- packaging==24.2
- pluggy==1.5.0
- pykwalify==1.8.0
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pyyaml==6.0.2
- requests==2.32.3
- ruamel-yaml==0.18.10
- ruamel-yaml-clib==0.2.12
- six==1.17.0
- tomli==2.2.1
- urllib3==2.3.0
prefix: /opt/conda/envs/dogen
|
[
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_should_fail_when_no_artifact_nor_url_is_provided",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_when_local_file_exists_and_is_broken",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_when_local_file_exists_and_is_correct",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_cache_url",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_cache_url_and_target_filename",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_cache_url_with_filename_to_replace",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_deprecated_md5sum",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_multiple_hashes",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_multiple_hashes_and_cache_url",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_sha1",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_sha256",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_target_filename",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_with_url_and_artifact_keys_set",
"tests/test_unit_generate_configuration.py::TestConfig::test_handling_sources_without_specified_md5sum"
] |
[] |
[
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_exec",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_exec_not_env",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_user_not_default",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_script_user_not_env",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_scripts_dir_in_cli_should_override_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_scripts_dir_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_template_in_cli_should_override_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_custom_template_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_default_script_exec",
"tests/test_unit_generate_configuration.py::TestConfig::test_default_script_user",
"tests/test_unit_generate_configuration.py::TestConfig::test_default_values",
"tests/test_unit_generate_configuration.py::TestConfig::test_do_not_skip_ssl_verification_in_cli_false_should_override_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_do_not_skip_ssl_verification_in_descriptor",
"tests/test_unit_generate_configuration.py::TestConfig::test_env_provided_script_user",
"tests/test_unit_generate_configuration.py::TestConfig::test_env_supplied_script_exec",
"tests/test_unit_generate_configuration.py::TestConfig::test_fail_if_version_mismatch",
"tests/test_unit_generate_configuration.py::TestConfig::test_no_scripts_defined",
"tests/test_unit_generate_configuration.py::TestConfig::test_scripts_dir_found_by_convention",
"tests/test_unit_generate_configuration.py::TestConfig::test_skip_ssl_verification_in_descriptor"
] |
[] |
MIT License
| 1,336 |
jboss-dockerfiles__dogen-140
|
ac07abe63ec944d407e1d06669a09deeacc4e720
|
2017-06-06 12:34:35
|
bc9263c5b683fdf901ac1646286ee3908b85dcdc
|
diff --git a/dogen/schema/kwalify_schema.yaml b/dogen/schema/kwalify_schema.yaml
index 79a6b09..05069f3 100644
--- a/dogen/schema/kwalify_schema.yaml
+++ b/dogen/schema/kwalify_schema.yaml
@@ -23,22 +23,14 @@ map:
value: {type: str, required: True}
description: {type: str}
envs:
- type: map
- mapping:
- information:
- type: seq
- sequence:
- - type: map
- mapping:
- name: {type: str, required: True}
- value: {type: any, required: True}
- description: {type: str}
- configuration:
- seq:
- - map:
- name: {type: str, required: True}
- example: {type: any}
- description: {type: str}
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ name: {type: str, required: True}
+ value: {type: any}
+ example: {type: any}
+ description: {type: str}
ports:
seq:
- map:
diff --git a/dogen/template_helper.py b/dogen/template_helper.py
index e36693b..09106a7 100644
--- a/dogen/template_helper.py
+++ b/dogen/template_helper.py
@@ -52,14 +52,9 @@ class TemplateHelper(object):
envs = []
- if 'information' in env_variables:
- for e in env_variables['information']:
- envs.append(e)
-
- if 'configuration' in env_variables:
- for e in env_variables['configuration']:
- if 'value' in e:
- envs.append(e)
+ for env in env_variables:
+ if env.get('value') is not None:
+ envs.append(env)
return envs
|
Remove information and configuration sections in envs
Instead we should have a single `envs` section that contains an array of environment variables. The old "information" envs should have a new key added: `information` (or similar) with boolean value.
This makes it easier to understand the image.yaml.
|
jboss-dockerfiles/dogen
|
diff --git a/tests/schemas/good/openshift_amq_6.2_image.yaml b/tests/schemas/good/openshift_amq_6.2_image.yaml
index 2cde6e8..00c95c9 100644
--- a/tests/schemas/good/openshift_amq_6.2_image.yaml
+++ b/tests/schemas/good/openshift_amq_6.2_image.yaml
@@ -12,19 +12,18 @@ labels:
- name: "io.openshift.s2i.scripts-url"
value: "image:///usr/local/s2i"
envs:
- configuration:
- - name: AMQ_MESH_SERVICE_NAME
- example: broker-amq-tcp
- - name: AMQ_MESH_DISCOVERY_TYPE
- example: kube
- - name: AMQ_MESH_SERVICE_NAMESPACE
- example: my-project
- - name: AMQ_SPLIT
- example: true
- description: "Allow multiple instances to share the same Persistent Volume. If set to true each instance will use a separate area within the Persistent Volume as its data directory. Default is unset."
- - name: AMQ_LOCK_TIMEOUT
- example: 30
- description: "If allowing multiple instances to share the same Persistent Volume then wait for this timeout period (seconds) to see if an existing server will terminate before moving to the next instance. Default is 30 seconds."
+ - name: AMQ_MESH_SERVICE_NAME
+ example: broker-amq-tcp
+ - name: AMQ_MESH_DISCOVERY_TYPE
+ example: kube
+ - name: AMQ_MESH_SERVICE_NAMESPACE
+ example: my-project
+ - name: AMQ_SPLIT
+ example: true
+ description: "Allow multiple instances to share the same Persistent Volume. If set to true each instance will use a separate area within the Persistent Volume as its data directory. Default is unset."
+ - name: AMQ_LOCK_TIMEOUT
+ example: 30
+ description: "If allowing multiple instances to share the same Persistent Volume then wait for this timeout period (seconds) to see if an existing server will terminate before moving to the next instance. Default is 30 seconds."
ports:
- value: 8778
- value: 5672
diff --git a/tests/schemas/good/openshift_datagrid_6.5_image.yaml b/tests/schemas/good/openshift_datagrid_6.5_image.yaml
index 67ff7a1..1cabb3f 100644
--- a/tests/schemas/good/openshift_datagrid_6.5_image.yaml
+++ b/tests/schemas/good/openshift_datagrid_6.5_image.yaml
@@ -14,72 +14,70 @@ labels:
- name: "io.openshift.s2i.scripts-url"
value: "image:///usr/local/s2i"
envs:
- information:
- - name: "JBOSS_MODULES_SYSTEM_PKGS"
- value: "org.jboss.logmanager"
- configuration:
- - name: "OPENSHIFT_KUBE_PING_NAMESPACE"
- example: "myproject"
- description: "Clustering project namespace."
- - name: "OPENSHIFT_KUBE_PING_LABELS"
- example: "application=eap-app"
- description: "Clustering labels selector."
- - name: "JAVA_OPTS_APPEND"
- example: "-Dfoo=bar"
- - name: "JGROUPS_CLUSTER_PASSWORD"
- example: "miR0JaDR"
- description: "A password to control access to the JGroup. Needs to be set consistently cluster-wide. The image default is to use the `OPENSHIFT_KUBE_PING_LABELS` variable value, however the JBoss application templates generate and supply a random value."
- - name: CACHE_NAMES
- description: "List of caches to configure. Defaults to default,memcached"
- example: "addressbook,addressbook_indexed"
- - name: DEFAULT_CACHE
- description: "Indicates the default cache for this cache container."
- example: "addressbook"
- - name: CACHE_CONTAINER_START
- description: "Should this cache container be started on server startup, or lazily when requested by a service or deployment. Defaults to LAZY"
- example: "EAGER"
- - name: CACHE_CONTAINER_STATISTICS
- description: "Determines whether or not the cache container should collect statistics. Disable for optimal performance. Default is true"
- example: "false"
- - name: TRANSPORT_LOCK_TIMEOUT
- description: "Infinispan uses a distributed lock to maintain a coherent transaction log during state transfer or remd5suming, which means that only one cache can be doing state transfer or rehashing at the same time. This constraint is in place because more than one cache could be involved in a transaction. This timeout controls the time to wait to acquire a distributed lock. Defaults to 240000"
- example: "120000"
- - name: CONTAINER_SECURITY_IDENTITY_ROLE_MAPPER
- description: "Set a role mapper for this cache container. Valid values are: identity-role-mapper,common-name-role-mapper,cluster-role-mapper,custom-role-mapper"
- example: "identity-role-mapper"
- - name: CONTAINER_SECURITY_CUSTOM_ROLE_MAPPER_CLASS
- description: "Class of the custom principal to role mapper"
- example: "com.acme.CustomRoleMapper"
- - name: CONTAINER_SECURITY_ROLES
- description: "Defines role names and assigns permissions to them."
- example: "admin=ALL,reader=READ,writer=WRITE"
- - name: INFINISPAN_CONNECTORS
- description: "Comma separated list of connectors to configure. Defaults to hotrod,memcached,rest. Beware, if you enable authorization or authentication on your cache you should remove memcached as the protocol is insecure."
- example: "hotrod"
- - name: HOTROD_SERVICE_NAME
- description: "Name of the OpenShift service used to expose HotRod externally."
- example: "DATAGRID_APP_HOTROD"
- - name: HOTROD_AUTHENTICATION
- description: "If defined the hotrod-connectors will be configured with authentication in the ApplicationRealm."
- example: "true"
- - name: HOTROD_ENCRYPTION
- description: "If defined the hotrod-connectors will be configured with encryption in the ApplicationRealm."
- example: "true"
- - name: ENCRYPTION_REQUIRE_SSL_CLIENT_AUTH
- description: "Whether to require client certificate authentication. Defaults to false."
- example: "true"
- - name: MEMCACHED_CACHE
- description: "The name of the cache to use for the Memcached connector."
- example: "memcached"
- - name: REST_SECURITY_DOMAIN
- description: "The security domain to use for authentication/authorization purposes. Defaults to none (no authentication)"
- example: "other"
- - name: "USERNAME"
- example: "openshift"
- description: "Username for JDG user"
- - name: "PASSWORD"
- example: "p@ssw0rd"
- description: "Password for JDG user"
+ - name: "JBOSS_MODULES_SYSTEM_PKGS"
+ value: "org.jboss.logmanager"
+ - name: "OPENSHIFT_KUBE_PING_NAMESPACE"
+ example: "myproject"
+ description: "Clustering project namespace."
+ - name: "OPENSHIFT_KUBE_PING_LABELS"
+ example: "application=eap-app"
+ description: "Clustering labels selector."
+ - name: "JAVA_OPTS_APPEND"
+ example: "-Dfoo=bar"
+ - name: "JGROUPS_CLUSTER_PASSWORD"
+ example: "miR0JaDR"
+ description: "A password to control access to the JGroup. Needs to be set consistently cluster-wide. The image default is to use the `OPENSHIFT_KUBE_PING_LABELS` variable value, however the JBoss application templates generate and supply a random value."
+ - name: CACHE_NAMES
+ description: "List of caches to configure. Defaults to default,memcached"
+ example: "addressbook,addressbook_indexed"
+ - name: DEFAULT_CACHE
+ description: "Indicates the default cache for this cache container."
+ example: "addressbook"
+ - name: CACHE_CONTAINER_START
+ description: "Should this cache container be started on server startup, or lazily when requested by a service or deployment. Defaults to LAZY"
+ example: "EAGER"
+ - name: CACHE_CONTAINER_STATISTICS
+ description: "Determines whether or not the cache container should collect statistics. Disable for optimal performance. Default is true"
+ example: "false"
+ - name: TRANSPORT_LOCK_TIMEOUT
+ description: "Infinispan uses a distributed lock to maintain a coherent transaction log during state transfer or remd5suming, which means that only one cache can be doing state transfer or rehashing at the same time. This constraint is in place because more than one cache could be involved in a transaction. This timeout controls the time to wait to acquire a distributed lock. Defaults to 240000"
+ example: "120000"
+ - name: CONTAINER_SECURITY_IDENTITY_ROLE_MAPPER
+ description: "Set a role mapper for this cache container. Valid values are: identity-role-mapper,common-name-role-mapper,cluster-role-mapper,custom-role-mapper"
+ example: "identity-role-mapper"
+ - name: CONTAINER_SECURITY_CUSTOM_ROLE_MAPPER_CLASS
+ description: "Class of the custom principal to role mapper"
+ example: "com.acme.CustomRoleMapper"
+ - name: CONTAINER_SECURITY_ROLES
+ description: "Defines role names and assigns permissions to them."
+ example: "admin=ALL,reader=READ,writer=WRITE"
+ - name: INFINISPAN_CONNECTORS
+ description: "Comma separated list of connectors to configure. Defaults to hotrod,memcached,rest. Beware, if you enable authorization or authentication on your cache you should remove memcached as the protocol is insecure."
+ example: "hotrod"
+ - name: HOTROD_SERVICE_NAME
+ description: "Name of the OpenShift service used to expose HotRod externally."
+ example: "DATAGRID_APP_HOTROD"
+ - name: HOTROD_AUTHENTICATION
+ description: "If defined the hotrod-connectors will be configured with authentication in the ApplicationRealm."
+ example: "true"
+ - name: HOTROD_ENCRYPTION
+ description: "If defined the hotrod-connectors will be configured with encryption in the ApplicationRealm."
+ example: "true"
+ - name: ENCRYPTION_REQUIRE_SSL_CLIENT_AUTH
+ description: "Whether to require client certificate authentication. Defaults to false."
+ example: "true"
+ - name: MEMCACHED_CACHE
+ description: "The name of the cache to use for the Memcached connector."
+ example: "memcached"
+ - name: REST_SECURITY_DOMAIN
+ description: "The security domain to use for authentication/authorization purposes. Defaults to none (no authentication)"
+ example: "other"
+ - name: "USERNAME"
+ example: "openshift"
+ description: "Username for JDG user"
+ - name: "PASSWORD"
+ example: "p@ssw0rd"
+ description: "Password for JDG user"
ports:
- value: 8443
- value: 8778
diff --git a/tests/schemas/good/openshift_decisionserver_6.2_image.yaml b/tests/schemas/good/openshift_decisionserver_6.2_image.yaml
index 6fe16a8..3ff05e5 100644
--- a/tests/schemas/good/openshift_decisionserver_6.2_image.yaml
+++ b/tests/schemas/good/openshift_decisionserver_6.2_image.yaml
@@ -11,14 +11,13 @@ labels:
- name: "io.openshift.tags"
value: "builder,decisionserver,decisionserver6"
envs:
- information:
- - name: "KIE_SERVER_BPM_DISABLED"
- value: "true"
- description: "The BPM capability is disabled in this image."
- - name: "KIE_SERVER_BPM_UI_DISABLED"
- value: "true"
- description: "The BPM UI capability is disabled in this image."
- - name: "KIE_SERVER_BRP_DISABLED"
- value: "true"
- description: "The BRP capability is disabled in this image."
+ - name: "KIE_SERVER_BPM_DISABLED"
+ value: "true"
+ description: "The BPM capability is disabled in this image."
+ - name: "KIE_SERVER_BPM_UI_DISABLED"
+ value: "true"
+ description: "The BPM UI capability is disabled in this image."
+ - name: "KIE_SERVER_BRP_DISABLED"
+ value: "true"
+ description: "The BRP capability is disabled in this image."
diff --git a/tests/schemas/good/openshift_decisionserver_6.3_image.yaml b/tests/schemas/good/openshift_decisionserver_6.3_image.yaml
index 1eff437..28ae16f 100644
--- a/tests/schemas/good/openshift_decisionserver_6.3_image.yaml
+++ b/tests/schemas/good/openshift_decisionserver_6.3_image.yaml
@@ -11,14 +11,13 @@ labels:
- name: "io.openshift.tags"
value: "builder,decisionserver,decisionserver6"
envs:
- information:
- - name: "KIE_SERVER_BPM_DISABLED"
- value: "true"
- description: "The BPM capability is disabled in this image."
- - name: "KIE_SERVER_BPM_UI_DISABLED"
- value: "true"
- description: "The BPM UI capability is disabled in this image."
- - name: "KIE_SERVER_BRP_DISABLED"
- value: "true"
- description: "The BRP capability is disabled in this image."
+ - name: "KIE_SERVER_BPM_DISABLED"
+ value: "true"
+ description: "The BPM capability is disabled in this image."
+ - name: "KIE_SERVER_BPM_UI_DISABLED"
+ value: "true"
+ description: "The BPM UI capability is disabled in this image."
+ - name: "KIE_SERVER_BRP_DISABLED"
+ value: "true"
+ description: "The BRP capability is disabled in this image."
diff --git a/tests/schemas/good/openshift_eap_6.4_image.yaml b/tests/schemas/good/openshift_eap_6.4_image.yaml
index 0ab9029..44075d3 100644
--- a/tests/schemas/good/openshift_eap_6.4_image.yaml
+++ b/tests/schemas/good/openshift_eap_6.4_image.yaml
@@ -14,24 +14,22 @@ labels:
- name: "io.openshift.s2i.scripts-url"
value: "image:///usr/local/s2i"
envs:
- information:
- - name: "STI_BUILDER"
- value: "jee"
- - name: "JBOSS_MODULES_SYSTEM_PKGS"
- value: "org.jboss.logmanager,jdk.nashorn.api"
- configuration:
- - name: "OPENSHIFT_KUBE_PING_NAMESPACE"
- example: "myproject"
- description: "Clustering project namespace."
- - name: "OPENSHIFT_KUBE_PING_LABELS"
- example: "application=eap-app"
- description: "Clustering labels selector."
- - name: "JAVA_OPTS_APPEND"
- example: "-Dfoo=bar"
- description: "Server startup options."
- - name: "MQ_SIMPLE_DEFAULT_PHYSICAL_DESTINATION"
- example: "false"
- description: "For backwards compatability, set to true to use 'MyQueue' and 'MyTopic' as physical destination name defaults instead of 'queue/MyQueue' and 'topic/MyTopic'."
+ - name: "STI_BUILDER"
+ value: "jee"
+ - name: "JBOSS_MODULES_SYSTEM_PKGS"
+ value: "org.jboss.logmanager,jdk.nashorn.api"
+ - name: "OPENSHIFT_KUBE_PING_NAMESPACE"
+ example: "myproject"
+ description: "Clustering project namespace."
+ - name: "OPENSHIFT_KUBE_PING_LABELS"
+ example: "application=eap-app"
+ description: "Clustering labels selector."
+ - name: "JAVA_OPTS_APPEND"
+ example: "-Dfoo=bar"
+ description: "Server startup options."
+ - name: "MQ_SIMPLE_DEFAULT_PHYSICAL_DESTINATION"
+ example: "false"
+ description: "For backwards compatability, set to true to use 'MyQueue' and 'MyTopic' as physical destination name defaults instead of 'queue/MyQueue' and 'topic/MyTopic'."
ports:
- value: 8443
- value: 8778
diff --git a/tests/schemas/good/openshift_eap_7.0_image.yaml b/tests/schemas/good/openshift_eap_7.0_image.yaml
index 7c0c4b4..8d392ca 100644
--- a/tests/schemas/good/openshift_eap_7.0_image.yaml
+++ b/tests/schemas/good/openshift_eap_7.0_image.yaml
@@ -14,33 +14,31 @@ labels:
- name: "io.openshift.s2i.scripts-url"
value: "image:///usr/local/s2i"
envs:
- information:
- - name: "STI_BUILDER"
- value: "jee"
- - name: "JBOSS_MODULES_SYSTEM_PKGS"
- value: "org.jboss.logmanager,org.jboss.byteman,jdk.nashorn.api"
- configuration:
- - name: "OPENSHIFT_KUBE_PING_NAMESPACE"
- example: "myproject"
- description: "Clustering project namespace."
- - name: "OPENSHIFT_KUBE_PING_LABELS"
- example: "application=eap-app"
- description: "Clustering labels selector."
- - name: "JAVA_OPTS_APPEND"
- example: "-Dfoo=bar"
- description: "Server startup options."
- - name: "JBOSS_MODULES_SYSTEM_PKGS_APPEND"
- example: "org.jboss.byteman"
- description: "Comma-separated list of package names that will be appended to the JBOSS_MODULES_SYSTEM_PKGS environment variable."
- - name: "MQ_SIMPLE_DEFAULT_PHYSICAL_DESTINATION"
- example: "false"
- description: "For backwards compatability, set to true to use 'MyQueue' and 'MyTopic' as physical destination name defaults instead of 'queue/MyQueue' and 'topic/MyTopic'."
- - name: "DEFAULT_JMS_CONNECTION_FACTORY"
- example: "java:jboss/DefaultJMSConnectionFactory"
- description: "Specify the default JNDI binding for the JMS connection factory (jms-connection-factory='java:jboss/DefaultJMSConnectionFactory')."
- - name: "CLI_GRACEFUL_SHUTDOWN"
- example: "true"
- description: "If set to any non zero length value then the image will prevent shutdown with the TERM signal and will require execution of the shutdown command through jboss-cli."
+ - name: "STI_BUILDER"
+ value: "jee"
+ - name: "JBOSS_MODULES_SYSTEM_PKGS"
+ value: "org.jboss.logmanager,org.jboss.byteman,jdk.nashorn.api"
+ - name: "OPENSHIFT_KUBE_PING_NAMESPACE"
+ example: "myproject"
+ description: "Clustering project namespace."
+ - name: "OPENSHIFT_KUBE_PING_LABELS"
+ example: "application=eap-app"
+ description: "Clustering labels selector."
+ - name: "JAVA_OPTS_APPEND"
+ example: "-Dfoo=bar"
+ description: "Server startup options."
+ - name: "JBOSS_MODULES_SYSTEM_PKGS_APPEND"
+ example: "org.jboss.byteman"
+ description: "Comma-separated list of package names that will be appended to the JBOSS_MODULES_SYSTEM_PKGS environment variable."
+ - name: "MQ_SIMPLE_DEFAULT_PHYSICAL_DESTINATION"
+ example: "false"
+ description: "For backwards compatability, set to true to use 'MyQueue' and 'MyTopic' as physical destination name defaults instead of 'queue/MyQueue' and 'topic/MyTopic'."
+ - name: "DEFAULT_JMS_CONNECTION_FACTORY"
+ example: "java:jboss/DefaultJMSConnectionFactory"
+ description: "Specify the default JNDI binding for the JMS connection factory (jms-connection-factory='java:jboss/DefaultJMSConnectionFactory')."
+ - name: "CLI_GRACEFUL_SHUTDOWN"
+ example: "true"
+ description: "If set to any non zero length value then the image will prevent shutdown with the TERM signal and will require execution of the shutdown command through jboss-cli."
ports:
- value: 8443
- value: 8778
diff --git a/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml b/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml
index 9c5855d..7d577d5 100644
--- a/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml
+++ b/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml
@@ -14,24 +14,22 @@ labels:
- name: "io.openshift.s2i.scripts-url"
value: "image:///usr/local/s2i"
envs:
- information:
- - name: "STI_BUILDER"
- value: "jee"
- - name: "JBOSS_MODULES_SYSTEM_PKGS"
- value: "org.jboss.logmanager"
- configuration:
- - name: "OPENSHIFT_KUBE_PING_NAMESPACE"
- example: "myproject"
- description: "Clustering project namespace."
- - name: "OPENSHIFT_KUBE_PING_LABELS"
- example: "application=eap-app"
- description: "Clustering labels selector."
- - name: "JAVA_OPTS_APPEND"
- example: "-Dfoo=bar"
- description: "Server startup options."
- - name: "MQ_SIMPLE_DEFAULT_PHYSICAL_DESTINATION"
- example: "false"
- description: "For backwards compatability, set to true to use 'MyQueue' and 'MyTopic' as physical destination name defaults instead of 'queue/MyQueue' and 'topic/MyTopic'."
+ - name: "STI_BUILDER"
+ value: "jee"
+ - name: "JBOSS_MODULES_SYSTEM_PKGS"
+ value: "org.jboss.logmanager"
+ - name: "OPENSHIFT_KUBE_PING_NAMESPACE"
+ example: "myproject"
+ description: "Clustering project namespace."
+ - name: "OPENSHIFT_KUBE_PING_LABELS"
+ example: "application=eap-app"
+ description: "Clustering labels selector."
+ - name: "JAVA_OPTS_APPEND"
+ example: "-Dfoo=bar"
+ description: "Server startup options."
+ - name: "MQ_SIMPLE_DEFAULT_PHYSICAL_DESTINATION"
+ example: "false"
+ description: "For backwards compatability, set to true to use 'MyQueue' and 'MyTopic' as physical destination name defaults instead of 'queue/MyQueue' and 'topic/MyTopic'."
ports:
- value: 8443
- value: 8778
diff --git a/tests/schemas/good/openshift_kieserver_6.2_image.yaml b/tests/schemas/good/openshift_kieserver_6.2_image.yaml
index 77134f3..7c84769 100644
--- a/tests/schemas/good/openshift_kieserver_6.2_image.yaml
+++ b/tests/schemas/good/openshift_kieserver_6.2_image.yaml
@@ -11,104 +11,102 @@ labels:
- name: "io.openshift.tags"
value: "builder,kieserver,kieserver6"
envs:
- information:
- - name: "KIE_CONTAINER_REDIRECT_ENABLED"
- value: "false"
- description: "KIE Container alias ids will not be redirected to generated deployment ids in 6.2."
- configuration:
- - name: "KIE_CONTAINER_DEPLOYMENT"
- example: "containerId=groupId:artifactId:version|c2=g2:a2:v2'"
- description: "The KIE Containers to deploy. (required)"
- - name: "KIE_SERVER_BPM_DISABLED"
- example: "false"
- description: "Whether to disable the BPM capability. (optional)"
- - name: "KIE_SERVER_BPM_UI_DISABLED"
- example: "false"
- description: "Whether to disable the BPM UI capability. (optional)"
- - name: "KIE_SERVER_BRM_DISABLED"
- example: "false"
- description: "Whether to disable the BRM capability. (optional)"
- - name: "KIE_SERVER_BRP_DISABLED"
- example: "false"
- description: "Whether to disable the BRP capability. (optional)"
- - name: "KIE_SERVER_DOMAIN"
- example: "other"
- description: "JAAS LoginContext domain that shall be used to authenticate users when using JMS. (optional)"
- - name: "KIE_SERVER_EXECUTOR_POOL_SIZE"
- example: "1"
- description: "BPM Executor pool size. (optional)"
- - name: "KIE_SERVER_EXECUTOR_RETRY_COUNT"
- example: "3"
- description: "BPM Executor retry count. (optional)"
- - name: "KIE_SERVER_EXECUTOR_INTERVAL"
- example: "3"
- description: "BPM Executor interval. (optional)"
- - name: "KIE_SERVER_EXECUTOR_INITIAL_DELAY"
- example: "100"
- description: "BPM Executor initial dealy. (optional)"
- - name: "KIE_SERVER_EXECUTOR_TIMEUNIT"
- example: "SECONDS"
- description: "BPM Executor timeunit. (optional)"
- - name: "KIE_SERVER_EXECUTOR_JMS"
- example: "true"
- description: "Whether to use JMS for BPM Executor. (optional)"
- - name: "KIE_SERVER_EXECUTOR_JMS_QUEUE"
- example: "queue/KIE.SERVER.EXECUTOR"
- description: "BPM JNDI name of executor queue for JMS. (optional)"
- - name: "KIE_SERVER_EXECUTOR_JMS_TRANSACTED"
- example: "false"
- description: "Whether to transact JMS for BPM Executor. (optional)"
- - name: "KIE_SERVER_FILTER_CLASSES"
- example: "true"
- description: "Whether remoteable classes in the kjar should be filtered. (optional)"
- - name: "KIE_SERVER_HOST"
- example: "localhost"
- description: "The host name to access the KIE Server REST interface. (optional)"
- - name: "KIE_SERVER_HT_CALLBACK"
- example: "custom"
- description: "BPM Human task callback type (mvel, ldap, db, jaas, props, custom). (optional)"
- - name: "KIE_SERVER_HT_CUSTOM_CALLBACK"
- example: "org.custom.MyUserGroupCallback"
- description: "BPM Human task custom callback class (implements UserGroupCallback). (optional)"
- - name: "KIE_SERVER_HT_USERINFO"
- example: "custom"
- description: "BPM Human task UserInfo type (ldap, db, props, custom). (optional)"
- - name: "KIE_SERVER_HT_CUSTOM_USERINFO"
- example: "org.custom.MyUserInfo"
- description: "BPM Human task custom userinfo class (implements UserInfo). (optional)"
- - name: "KIE_SERVER_ID"
- example: "kieserver"
- description: "The KIE Server identifier. (optional)"
- - name: "KIE_SERVER_JMS_QUEUES_REQUEST"
- example: "queue/KIE.SERVER.REQUEST"
- description: "JNDI name of request queue for JMS. (optional)"
- - name: "KIE_SERVER_JMS_QUEUES_RESPONSE"
- example: "queue/KIE.SERVER.RESPONSE"
- description: "JNDI name of response queue for JMS. (optional)"
- - name: "KIE_SERVER_MBEANS_ENABLED"
- example: "true"
- description: "Whether the KIE Server JMX MBeans should be enabled. (optional)"
- - name: "KIE_SERVER_PASSWORD"
- example: "kieserver1!"
- description: "The password to access the KIE Server REST or JMS interface. Must be different than username; must not be root, admin, or administrator; must contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), and 1 non-alphanumeric symbol(s). (optional)"
- - name: "KIE_SERVER_PERSISTENCE_DIALECT"
- example: "org.hibernate.dialect.MySQL5Dialect"
- description: "BPM Hibernate persistence dialect. (optional)"
- - name: "KIE_SERVER_PERSISTENCE_DS"
- example: "java:/jboss/datasources/ExampleDS"
- description: "BPM Hibernate persistence datasource; will default to DB_JNDI. (optional)"
- - name: "KIE_SERVER_PERSISTENCE_TM"
- example: "org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"
- description: "BPM Hibernate persistence transaction manager. (optional)"
- - name: "KIE_SERVER_PORT"
- example: "8080"
- description: "The port to access the KIE Server REST interface. (optional)"
- - name: "KIE_SERVER_PROTOCOL"
- example: "http"
- description: "The protocol to access the KIE Server REST interface. (optional)"
- - name: "KIE_SERVER_USER"
- example: "kieserver"
- description: "The user name to access the KIE Server REST or JMS interface. (optional)"
+ - name: "KIE_CONTAINER_REDIRECT_ENABLED"
+ value: "false"
+ description: "KIE Container alias ids will not be redirected to generated deployment ids in 6.2."
+ - name: "KIE_CONTAINER_DEPLOYMENT"
+ example: "containerId=groupId:artifactId:version|c2=g2:a2:v2'"
+ description: "The KIE Containers to deploy. (required)"
+ - name: "KIE_SERVER_BPM_DISABLED"
+ example: "false"
+ description: "Whether to disable the BPM capability. (optional)"
+ - name: "KIE_SERVER_BPM_UI_DISABLED"
+ example: "false"
+ description: "Whether to disable the BPM UI capability. (optional)"
+ - name: "KIE_SERVER_BRM_DISABLED"
+ example: "false"
+ description: "Whether to disable the BRM capability. (optional)"
+ - name: "KIE_SERVER_BRP_DISABLED"
+ example: "false"
+ description: "Whether to disable the BRP capability. (optional)"
+ - name: "KIE_SERVER_DOMAIN"
+ example: "other"
+ description: "JAAS LoginContext domain that shall be used to authenticate users when using JMS. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_POOL_SIZE"
+ example: "1"
+ description: "BPM Executor pool size. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_RETRY_COUNT"
+ example: "3"
+ description: "BPM Executor retry count. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_INTERVAL"
+ example: "3"
+ description: "BPM Executor interval. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_INITIAL_DELAY"
+ example: "100"
+ description: "BPM Executor initial dealy. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_TIMEUNIT"
+ example: "SECONDS"
+ description: "BPM Executor timeunit. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_JMS"
+ example: "true"
+ description: "Whether to use JMS for BPM Executor. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_JMS_QUEUE"
+ example: "queue/KIE.SERVER.EXECUTOR"
+ description: "BPM JNDI name of executor queue for JMS. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_JMS_TRANSACTED"
+ example: "false"
+ description: "Whether to transact JMS for BPM Executor. (optional)"
+ - name: "KIE_SERVER_FILTER_CLASSES"
+ example: "true"
+ description: "Whether remoteable classes in the kjar should be filtered. (optional)"
+ - name: "KIE_SERVER_HOST"
+ example: "localhost"
+ description: "The host name to access the KIE Server REST interface. (optional)"
+ - name: "KIE_SERVER_HT_CALLBACK"
+ example: "custom"
+ description: "BPM Human task callback type (mvel, ldap, db, jaas, props, custom). (optional)"
+ - name: "KIE_SERVER_HT_CUSTOM_CALLBACK"
+ example: "org.custom.MyUserGroupCallback"
+ description: "BPM Human task custom callback class (implements UserGroupCallback). (optional)"
+ - name: "KIE_SERVER_HT_USERINFO"
+ example: "custom"
+ description: "BPM Human task UserInfo type (ldap, db, props, custom). (optional)"
+ - name: "KIE_SERVER_HT_CUSTOM_USERINFO"
+ example: "org.custom.MyUserInfo"
+ description: "BPM Human task custom userinfo class (implements UserInfo). (optional)"
+ - name: "KIE_SERVER_ID"
+ example: "kieserver"
+ description: "The KIE Server identifier. (optional)"
+ - name: "KIE_SERVER_JMS_QUEUES_REQUEST"
+ example: "queue/KIE.SERVER.REQUEST"
+ description: "JNDI name of request queue for JMS. (optional)"
+ - name: "KIE_SERVER_JMS_QUEUES_RESPONSE"
+ example: "queue/KIE.SERVER.RESPONSE"
+ description: "JNDI name of response queue for JMS. (optional)"
+ - name: "KIE_SERVER_MBEANS_ENABLED"
+ example: "true"
+ description: "Whether the KIE Server JMX MBeans should be enabled. (optional)"
+ - name: "KIE_SERVER_PASSWORD"
+ example: "kieserver1!"
+ description: "The password to access the KIE Server REST or JMS interface. Must be different than username; must not be root, admin, or administrator; must contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), and 1 non-alphanumeric symbol(s). (optional)"
+ - name: "KIE_SERVER_PERSISTENCE_DIALECT"
+ example: "org.hibernate.dialect.MySQL5Dialect"
+ description: "BPM Hibernate persistence dialect. (optional)"
+ - name: "KIE_SERVER_PERSISTENCE_DS"
+ example: "java:/jboss/datasources/ExampleDS"
+ description: "BPM Hibernate persistence datasource; will default to DB_JNDI. (optional)"
+ - name: "KIE_SERVER_PERSISTENCE_TM"
+ example: "org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"
+ description: "BPM Hibernate persistence transaction manager. (optional)"
+ - name: "KIE_SERVER_PORT"
+ example: "8080"
+ description: "The port to access the KIE Server REST interface. (optional)"
+ - name: "KIE_SERVER_PROTOCOL"
+ example: "http"
+ description: "The protocol to access the KIE Server REST interface. (optional)"
+ - name: "KIE_SERVER_USER"
+ example: "kieserver"
+ description: "The user name to access the KIE Server REST or JMS interface. (optional)"
ports:
- value: 8778
cmd:
diff --git a/tests/schemas/good/openshift_kieserver_6.3_image.yaml b/tests/schemas/good/openshift_kieserver_6.3_image.yaml
index 010b945..bea0c84 100644
--- a/tests/schemas/good/openshift_kieserver_6.3_image.yaml
+++ b/tests/schemas/good/openshift_kieserver_6.3_image.yaml
@@ -11,103 +11,102 @@ labels:
- name: "io.openshift.tags"
value: "builder,kieserver,kieserver6"
envs:
- configuration:
- - name: "KIE_CONTAINER_DEPLOYMENT"
- example: "containerId=groupId:artifactId:version|c2=g2:a2:v2'"
- description: "The KIE Containers to deploy. (required)"
- - name: "KIE_CONTAINER_REDIRECT_ENABLED"
- example: "true"
- description: "Whether KIE Container alias ids will be redirected to generated deployment ids. (optional)"
- - name: "KIE_SERVER_BPM_DISABLED"
- example: "false"
- description: "Whether to disable the BPM capability. (optional)"
- - name: "KIE_SERVER_BPM_UI_DISABLED"
- example: "false"
- description: "Whether to disable the BPM UI capability. (optional)"
- - name: "KIE_SERVER_BRM_DISABLED"
- example: "false"
- description: "Whether to disable the BRM capability. (optional)"
- - name: "KIE_SERVER_BRP_DISABLED"
- example: "false"
- description: "Whether to disable the BRP capability. (optional)"
- - name: "KIE_SERVER_DOMAIN"
- example: "other"
- description: "JAAS LoginContext domain that shall be used to authenticate users when using JMS. (optional)"
- - name: "KIE_SERVER_EXECUTOR_POOL_SIZE"
- example: "1"
- description: "BPM Executor pool size. (optional)"
- - name: "KIE_SERVER_EXECUTOR_RETRY_COUNT"
- example: "3"
- description: "BPM Executor retry count. (optional)"
- - name: "KIE_SERVER_EXECUTOR_INTERVAL"
- example: "3"
- description: "BPM Executor interval. (optional)"
- - name: "KIE_SERVER_EXECUTOR_INITIAL_DELAY"
- example: "100"
- description: "BPM Executor initial dealy. (optional)"
- - name: "KIE_SERVER_EXECUTOR_TIMEUNIT"
- example: "SECONDS"
- description: "BPM Executor timeunit. (optional)"
- - name: "KIE_SERVER_EXECUTOR_JMS"
- example: "true"
- description: "Whether to use JMS for BPM Executor. (optional)"
- - name: "KIE_SERVER_EXECUTOR_JMS_QUEUE"
- example: "queue/KIE.SERVER.EXECUTOR"
- description: "BPM JNDI name of executor queue for JMS. (optional)"
- - name: "KIE_SERVER_EXECUTOR_JMS_TRANSACTED"
- example: "false"
- description: "Whether to transact JMS for BPM Executor. (optional)"
- - name: "KIE_SERVER_FILTER_CLASSES"
- example: "true"
- description: "Whether remoteable classes in the kjar should be filtered. (optional)"
- - name: "KIE_SERVER_HOST"
- example: "localhost"
- description: "The host name to access the KIE Server REST interface. (optional)"
- - name: "KIE_SERVER_HT_CALLBACK"
- example: "custom"
- description: "BPM Human task callback type (mvel, ldap, db, jaas, props, custom). (optional)"
- - name: "KIE_SERVER_HT_CUSTOM_CALLBACK"
- example: "org.custom.MyUserGroupCallback"
- description: "BPM Human task custom callback class (implements UserGroupCallback). (optional)"
- - name: "KIE_SERVER_HT_USERINFO"
- example: "custom"
- description: "BPM Human task UserInfo type (ldap, db, props, custom). (optional)"
- - name: "KIE_SERVER_HT_CUSTOM_USERINFO"
- example: "org.custom.MyUserInfo"
- description: "BPM Human task custom userinfo class (implements UserInfo). (optional)"
- - name: "KIE_SERVER_ID"
- example: "kieserver"
- description: "The KIE Server identifier. (optional)"
- - name: "KIE_SERVER_JMS_QUEUES_REQUEST"
- example: "queue/KIE.SERVER.REQUEST"
- description: "JNDI name of request queue for JMS. (optional)"
- - name: "KIE_SERVER_JMS_QUEUES_RESPONSE"
- example: "queue/KIE.SERVER.RESPONSE"
- description: "JNDI name of response queue for JMS. (optional)"
- - name: "KIE_SERVER_MBEANS_ENABLED"
- example: "true"
- description: "Whether the KIE Server JMX MBeans should be enabled. (optional)"
- - name: "KIE_SERVER_PASSWORD"
- example: "kieserver1!"
- description: "The password to access the KIE Server REST or JMS interface. Must be different than username; must not be root, admin, or administrator; must contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), and 1 non-alphanumeric symbol(s). (optional)"
- - name: "KIE_SERVER_PERSISTENCE_DIALECT"
- example: "org.hibernate.dialect.MySQL5Dialect"
- description: "BPM Hibernate persistence dialect. (optional)"
- - name: "KIE_SERVER_PERSISTENCE_DS"
- example: "java:/jboss/datasources/ExampleDS"
- description: "BPM Hibernate persistence datasource; will default to DB_JNDI. (optional)"
- - name: "KIE_SERVER_PERSISTENCE_TM"
- example: "org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"
- description: "BPM Hibernate persistence transaction manager. (optional)"
- - name: "KIE_SERVER_PORT"
- example: "8080"
- description: "The port to access the KIE Server REST interface. (optional)"
- - name: "KIE_SERVER_PROTOCOL"
- example: "http"
- description: "The protocol to access the KIE Server REST interface. (optional)"
- - name: "KIE_SERVER_USER"
- example: "kieserver"
- description: "The user name to access the KIE Server REST or JMS interface. (optional)"
+ - name: "KIE_CONTAINER_DEPLOYMENT"
+ example: "containerId=groupId:artifactId:version|c2=g2:a2:v2'"
+ description: "The KIE Containers to deploy. (required)"
+ - name: "KIE_CONTAINER_REDIRECT_ENABLED"
+ example: "true"
+ description: "Whether KIE Container alias ids will be redirected to generated deployment ids. (optional)"
+ - name: "KIE_SERVER_BPM_DISABLED"
+ example: "false"
+ description: "Whether to disable the BPM capability. (optional)"
+ - name: "KIE_SERVER_BPM_UI_DISABLED"
+ example: "false"
+ description: "Whether to disable the BPM UI capability. (optional)"
+ - name: "KIE_SERVER_BRM_DISABLED"
+ example: "false"
+ description: "Whether to disable the BRM capability. (optional)"
+ - name: "KIE_SERVER_BRP_DISABLED"
+ example: "false"
+ description: "Whether to disable the BRP capability. (optional)"
+ - name: "KIE_SERVER_DOMAIN"
+ example: "other"
+ description: "JAAS LoginContext domain that shall be used to authenticate users when using JMS. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_POOL_SIZE"
+ example: "1"
+ description: "BPM Executor pool size. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_RETRY_COUNT"
+ example: "3"
+ description: "BPM Executor retry count. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_INTERVAL"
+ example: "3"
+ description: "BPM Executor interval. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_INITIAL_DELAY"
+ example: "100"
+ description: "BPM Executor initial dealy. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_TIMEUNIT"
+ example: "SECONDS"
+ description: "BPM Executor timeunit. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_JMS"
+ example: "true"
+ description: "Whether to use JMS for BPM Executor. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_JMS_QUEUE"
+ example: "queue/KIE.SERVER.EXECUTOR"
+ description: "BPM JNDI name of executor queue for JMS. (optional)"
+ - name: "KIE_SERVER_EXECUTOR_JMS_TRANSACTED"
+ example: "false"
+ description: "Whether to transact JMS for BPM Executor. (optional)"
+ - name: "KIE_SERVER_FILTER_CLASSES"
+ example: "true"
+ description: "Whether remoteable classes in the kjar should be filtered. (optional)"
+ - name: "KIE_SERVER_HOST"
+ example: "localhost"
+ description: "The host name to access the KIE Server REST interface. (optional)"
+ - name: "KIE_SERVER_HT_CALLBACK"
+ example: "custom"
+ description: "BPM Human task callback type (mvel, ldap, db, jaas, props, custom). (optional)"
+ - name: "KIE_SERVER_HT_CUSTOM_CALLBACK"
+ example: "org.custom.MyUserGroupCallback"
+ description: "BPM Human task custom callback class (implements UserGroupCallback). (optional)"
+ - name: "KIE_SERVER_HT_USERINFO"
+ example: "custom"
+ description: "BPM Human task UserInfo type (ldap, db, props, custom). (optional)"
+ - name: "KIE_SERVER_HT_CUSTOM_USERINFO"
+ example: "org.custom.MyUserInfo"
+ description: "BPM Human task custom userinfo class (implements UserInfo). (optional)"
+ - name: "KIE_SERVER_ID"
+ example: "kieserver"
+ description: "The KIE Server identifier. (optional)"
+ - name: "KIE_SERVER_JMS_QUEUES_REQUEST"
+ example: "queue/KIE.SERVER.REQUEST"
+ description: "JNDI name of request queue for JMS. (optional)"
+ - name: "KIE_SERVER_JMS_QUEUES_RESPONSE"
+ example: "queue/KIE.SERVER.RESPONSE"
+ description: "JNDI name of response queue for JMS. (optional)"
+ - name: "KIE_SERVER_MBEANS_ENABLED"
+ example: "true"
+ description: "Whether the KIE Server JMX MBeans should be enabled. (optional)"
+ - name: "KIE_SERVER_PASSWORD"
+ example: "kieserver1!"
+ description: "The password to access the KIE Server REST or JMS interface. Must be different than username; must not be root, admin, or administrator; must contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), and 1 non-alphanumeric symbol(s). (optional)"
+ - name: "KIE_SERVER_PERSISTENCE_DIALECT"
+ example: "org.hibernate.dialect.MySQL5Dialect"
+ description: "BPM Hibernate persistence dialect. (optional)"
+ - name: "KIE_SERVER_PERSISTENCE_DS"
+ example: "java:/jboss/datasources/ExampleDS"
+ description: "BPM Hibernate persistence datasource; will default to DB_JNDI. (optional)"
+ - name: "KIE_SERVER_PERSISTENCE_TM"
+ example: "org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"
+ description: "BPM Hibernate persistence transaction manager. (optional)"
+ - name: "KIE_SERVER_PORT"
+ example: "8080"
+ description: "The port to access the KIE Server REST interface. (optional)"
+ - name: "KIE_SERVER_PROTOCOL"
+ example: "http"
+ description: "The protocol to access the KIE Server REST interface. (optional)"
+ - name: "KIE_SERVER_USER"
+ example: "kieserver"
+ description: "The user name to access the KIE Server REST or JMS interface. (optional)"
ports:
- value: 8778
cmd:
diff --git a/tests/schemas/good/openshift_processserver_6.3_image.yaml b/tests/schemas/good/openshift_processserver_6.3_image.yaml
index cc5b047..e2eef92 100644
--- a/tests/schemas/good/openshift_processserver_6.3_image.yaml
+++ b/tests/schemas/good/openshift_processserver_6.3_image.yaml
@@ -11,11 +11,10 @@ labels:
- name: "io.openshift.tags"
value: "builder,processserver,processserver6"
envs:
- information:
- - name: "KIE_SERVER_BPM_UI_DISABLED"
- value: "true"
- description: "The BPM UI capability is disabled in this image."
- - name: "KIE_SERVER_BRP_DISABLED"
- value: "true"
- description: "The BRP capability is disabled in this image."
+ - name: "KIE_SERVER_BPM_UI_DISABLED"
+ value: "true"
+ description: "The BPM UI capability is disabled in this image."
+ - name: "KIE_SERVER_BRP_DISABLED"
+ value: "true"
+ description: "The BRP capability is disabled in this image."
diff --git a/tests/schemas/good/openshift_sso_7.0_image.yaml b/tests/schemas/good/openshift_sso_7.0_image.yaml
index 0c43530..6ddc915 100644
--- a/tests/schemas/good/openshift_sso_7.0_image.yaml
+++ b/tests/schemas/good/openshift_sso_7.0_image.yaml
@@ -14,30 +14,28 @@ labels:
- name: "io.openshift.s2i.scripts-url"
value: "image:///usr/local/s2i"
envs:
- information:
- - name: "STI_BUILDER"
- value: "jee"
- - name: "JBOSS_MODULES_SYSTEM_PKGS"
- value: "org.jboss.logmanager,jdk.nashorn.api"
- configuration:
- - name: "OPENSHIFT_KUBE_PING_NAMESPACE"
- example: "myproject"
- description: "Clustering project namespace."
- - name: "OPENSHIFT_KUBE_PING_LABELS"
- example: "application=sso"
- description: "Clustering labels selector."
- - name: "JAVA_OPTS_APPEND"
- example: "-Dfoo=bar"
- description: "Server startup options."
- - name: "MQ_SIMPLE_DEFAULT_PHYSICAL_DESTINATION"
- example: "false"
- description: "For backwards compatability, set to true to use 'MyQueue' and 'MyTopic' as physical destination name defaults instead of 'queue/MyQueue' and 'topic/MyTopic'."
- - name: "SSO_ADMIN_USERNAME"
- example: "admin"
- description: "SSO administrator username"
- - name: "SSO_ADMIN_PASSWORD"
- example: "hardtoguess"
- description: "SSO administrator password"
+ - name: "STI_BUILDER"
+ value: "jee"
+ - name: "JBOSS_MODULES_SYSTEM_PKGS"
+ value: "org.jboss.logmanager,jdk.nashorn.api"
+ - name: "OPENSHIFT_KUBE_PING_NAMESPACE"
+ example: "myproject"
+ description: "Clustering project namespace."
+ - name: "OPENSHIFT_KUBE_PING_LABELS"
+ example: "application=sso"
+ description: "Clustering labels selector."
+ - name: "JAVA_OPTS_APPEND"
+ example: "-Dfoo=bar"
+ description: "Server startup options."
+ - name: "MQ_SIMPLE_DEFAULT_PHYSICAL_DESTINATION"
+ example: "false"
+ description: "For backwards compatability, set to true to use 'MyQueue' and 'MyTopic' as physical destination name defaults instead of 'queue/MyQueue' and 'topic/MyTopic'."
+ - name: "SSO_ADMIN_USERNAME"
+ example: "admin"
+ description: "SSO administrator username"
+ - name: "SSO_ADMIN_PASSWORD"
+ example: "hardtoguess"
+ description: "SSO administrator password"
ports:
- value: 8443
- value: 8778
diff --git a/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml b/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml
index c7e5991..ca482f1 100644
--- a/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml
+++ b/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml
@@ -14,31 +14,29 @@ labels:
- name: "io.openshift.s2i.scripts-url"
value: "image:///usr/local/s2i"
envs:
- information:
- - name: "STI_BUILDER"
- value: "jee"
- configuration:
- - name: JWS_ADMIN_USERNAME
- example: jwsadmin
- - name: JWS_ADMIN_PASSWORD
- example: p5sw0rdd
- - name: JWS_HTTPS_CERTIFICATE_DIR
- example: /opt/webserver/conf
- - name: JWS_HTTPS_CERTIFICATE
- example: server.crt
- - name: JWS_HTTPS_CERTIFICATE_KEY
- example: server.key
- - name: JWS_HTTPS_CERTIFICATE_PASSWORD
- example: $tr0nGPaSs?
- - name: CATALINA_OPTS_APPEND
- example: -Dfoo=bar
- - name: JWS_REALM_USERTABLE
- - name: JWS_REALM_USERNAME_COL
- - name: JWS_REALM_USERCRED_COL
- - name: JWS_REALM_USERROLE_TABLE
- - name: JWS_REALM_ROLENAME_COL
- - name: DB_SERVICE_PREFIX_MAPPING
- example: test-postgresql=TEST_POSTGRESQL,test-mysql=TEST_MYSQL
+ - name: "STI_BUILDER"
+ value: "jee"
+ - name: JWS_ADMIN_USERNAME
+ example: jwsadmin
+ - name: JWS_ADMIN_PASSWORD
+ example: p5sw0rdd
+ - name: JWS_HTTPS_CERTIFICATE_DIR
+ example: /opt/webserver/conf
+ - name: JWS_HTTPS_CERTIFICATE
+ example: server.crt
+ - name: JWS_HTTPS_CERTIFICATE_KEY
+ example: server.key
+ - name: JWS_HTTPS_CERTIFICATE_PASSWORD
+ example: $tr0nGPaSs?
+ - name: CATALINA_OPTS_APPEND
+ example: -Dfoo=bar
+ - name: JWS_REALM_USERTABLE
+ - name: JWS_REALM_USERNAME_COL
+ - name: JWS_REALM_USERCRED_COL
+ - name: JWS_REALM_USERROLE_TABLE
+ - name: JWS_REALM_ROLENAME_COL
+ - name: DB_SERVICE_PREFIX_MAPPING
+ example: test-postgresql=TEST_POSTGRESQL,test-mysql=TEST_MYSQL
ports:
- value: 8443
- value: 8778
diff --git a/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml b/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml
index b7039a3..83c9812 100644
--- a/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml
+++ b/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml
@@ -14,31 +14,29 @@ labels:
- name: "io.openshift.s2i.scripts-url"
value: "image:///usr/local/s2i"
envs:
- information:
- - name: "STI_BUILDER"
- value: "jee"
- configuration:
- - name: JWS_ADMIN_USERNAME
- example: jwsadmin
- - name: JWS_ADMIN_PASSWORD
- example: p5sw0rdd
- - name: JWS_HTTPS_CERTIFICATE_DIR
- example: /opt/webserver/conf
- - name: JWS_HTTPS_CERTIFICATE
- example: server.crt
- - name: JWS_HTTPS_CERTIFICATE_KEY
- example: server.key
- - name: JWS_HTTPS_CERTIFICATE_PASSWORD
- example: $tr0nGPaSs?
- - name: CATALINA_OPTS_APPEND
- example: -Dfoo=bar
- - name: JWS_REALM_USERTABLE
- - name: JWS_REALM_USERNAME_COL
- - name: JWS_REALM_USERCRED_COL
- - name: JWS_REALM_USERROLE_TABLE
- - name: JWS_REALM_ROLENAME_COL
- - name: DB_SERVICE_PREFIX_MAPPING
- example: test-postgresql=TEST_POSTGRESQL,test-mysql=TEST_MYSQL
+ - name: "STI_BUILDER"
+ value: "jee"
+ - name: JWS_ADMIN_USERNAME
+ example: jwsadmin
+ - name: JWS_ADMIN_PASSWORD
+ example: p5sw0rdd
+ - name: JWS_HTTPS_CERTIFICATE_DIR
+ example: /opt/webserver/conf
+ - name: JWS_HTTPS_CERTIFICATE
+ example: server.crt
+ - name: JWS_HTTPS_CERTIFICATE_KEY
+ example: server.key
+ - name: JWS_HTTPS_CERTIFICATE_PASSWORD
+ example: $tr0nGPaSs?
+ - name: CATALINA_OPTS_APPEND
+ example: -Dfoo=bar
+ - name: JWS_REALM_USERTABLE
+ - name: JWS_REALM_USERNAME_COL
+ - name: JWS_REALM_USERCRED_COL
+ - name: JWS_REALM_USERROLE_TABLE
+ - name: JWS_REALM_ROLENAME_COL
+ - name: DB_SERVICE_PREFIX_MAPPING
+ example: test-postgresql=TEST_POSTGRESQL,test-mysql=TEST_MYSQL
ports:
- value: 8443
- value: 8778
diff --git a/tests/test_dockerfile.py b/tests/test_dockerfile.py
index 2ffa5a6..3ab2885 100644
--- a/tests/test_dockerfile.py
+++ b/tests/test_dockerfile.py
@@ -176,3 +176,17 @@ class TestDockerfile(unittest.TestCase):
dockerfile = f.read()
regex = re.compile(r'LABEL name=\"\$JBOSS_IMAGE_NAME\" \\\s+version=\"\$JBOSS_IMAGE_VERSION\" \\\s+architecture=\"x86_64\" \\\s+com.redhat.component=\"someimage\" \\\s+description=\"This is a nice image\"', re.MULTILINE)
self.assertRegexpMatches(dockerfile, regex)
+
+ # https://github.com/jboss-dockerfiles/dogen/issues/127
+ def test_generating_env_variables(self):
+ with open(self.yaml, 'ab') as f:
+ f.write("envs:\n - name: INFO_ENV\n value: 0\n - name: CONFIG_ENV\n example: 1234\n - name: COMBINED_ENV\n value: set_value\n example: example_value\n description: This is a description".encode())
+
+ generator = Generator(self.log, self.args)
+ generator.configure()
+ generator.render_from_template()
+
+ with open(os.path.join(self.target, "Dockerfile"), "r") as f:
+ dockerfile = f.read()
+ regex = re.compile(r'ENV JBOSS_IMAGE_NAME=\"someimage\" \\\s+JBOSS_IMAGE_VERSION=\"1\" \\\s+INFO_ENV=\"0\" \\\s+COMBINED_ENV=\"set_value\" \n', re.MULTILINE)
+ self.assertRegexpMatches(dockerfile, regex)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 2
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi==2025.1.31
charset-normalizer==3.4.1
coverage==7.8.0
docopt==0.6.2
-e git+https://github.com/jboss-dockerfiles/dogen.git@ac07abe63ec944d407e1d06669a09deeacc4e720#egg=dogen
exceptiongroup==1.2.2
idna==3.10
iniconfig==2.1.0
Jinja2==3.1.6
MarkupSafe==3.0.2
mock==5.2.0
packaging==24.2
pluggy==1.5.0
pykwalify==1.8.0
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
PyYAML==6.0.2
requests==2.32.3
ruamel.yaml==0.18.10
ruamel.yaml.clib==0.2.12
six==1.17.0
tomli==2.2.1
urllib3==2.3.0
|
name: dogen
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- certifi==2025.1.31
- charset-normalizer==3.4.1
- coverage==7.8.0
- docopt==0.6.2
- exceptiongroup==1.2.2
- idna==3.10
- iniconfig==2.1.0
- jinja2==3.1.6
- markupsafe==3.0.2
- mock==5.2.0
- packaging==24.2
- pluggy==1.5.0
- pykwalify==1.8.0
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pyyaml==6.0.2
- requests==2.32.3
- ruamel-yaml==0.18.10
- ruamel-yaml-clib==0.2.12
- six==1.17.0
- tomli==2.2.1
- urllib3==2.3.0
prefix: /opt/conda/envs/dogen
|
[
"tests/test_dockerfile.py::TestDockerfile::test_generating_env_variables"
] |
[] |
[
"tests/test_dockerfile.py::TestDockerfile::test_debug_port",
"tests/test_dockerfile.py::TestDockerfile::test_default_cmd_user",
"tests/test_dockerfile.py::TestDockerfile::test_generating_description_label",
"tests/test_dockerfile.py::TestDockerfile::test_generating_maintainer_label",
"tests/test_dockerfile.py::TestDockerfile::test_set_cmd",
"tests/test_dockerfile.py::TestDockerfile::test_set_cmd_user",
"tests/test_dockerfile.py::TestDockerfile::test_set_entrypoint",
"tests/test_dockerfile.py::TestDockerfile::test_volumes"
] |
[] |
MIT License
| 1,340 |
|
bokeh__bokeh-6394
|
be0d7255b917dd915a6b6cee5e40073e5a31eba6
|
2017-06-06 17:16:35
|
44b63d65efec1e06fb565a9a81e0f2f21315e85a
|
bryevdv: @philippjfr I have updated the test I think it should be better now
philippjfr: Looks good and works for me.
|
diff --git a/bokeh/core/property/bases.py b/bokeh/core/property/bases.py
index c5d7c92c9..4aace587a 100644
--- a/bokeh/core/property/bases.py
+++ b/bokeh/core/property/bases.py
@@ -178,7 +178,19 @@ class Property(PropertyDescriptorFactory):
if isinstance(new, np.ndarray) or isinstance(old, np.ndarray):
return np.array_equal(new, old)
- return new == old
+ # this handles the special but common case where there is a dict with numpy
+ # arrays as values (e.g. the .data property of a ColumnDataSource)
+ if isinstance(new, dict) and isinstance(old, dict):
+ if set(new.keys()) != set(old.keys()):
+ return False
+ return all(self.matches(new[k], old[k]) for k in new)
+
+ try:
+ return new == old
+
+ # if the comparison fails for some reason, just punt and return no-match
+ except ValueError:
+ return False
def from_json(self, json, models=None):
''' Convert from JSON-compatible values into a value for this property.
|
Modifying datasources broken
In bokeh master and presumably any rc/dev releases cut in the last few days, modifying a CDS is broken completely. This is because https://github.com/bokeh/bokeh/pull/6374 introduced a change in the way bokeh properties check whether an old and new value has changed. The approach there guards against checks on arrays, but since the ``.data`` property on a CDS is not itself an array it ends up doing a simple equality between the dictionary of arrays, which raises this error:
>ValueError�: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
This occurs for any change to a ``ColumnDataSource.data``, which means that any server or notebook examples that modify a CDS in python are currently broken.
|
bokeh/bokeh
|
diff --git a/bokeh/core/property/tests/test_bases.py b/bokeh/core/property/tests/test_bases.py
index 14a1234bc..d7a0309ab 100644
--- a/bokeh/core/property/tests/test_bases.py
+++ b/bokeh/core/property/tests/test_bases.py
@@ -45,6 +45,14 @@ def test_property_assert_msg_funcs():
p.prepare_value(hp, "foo", 10)
assert str(e) == "bad True name, 10"
+def test_property_matches_basic_types(capsys):
+ p = pb.Property()
+ for x in [1, 1.2, "a", np.arange(4), None, False, True, {}, []]:
+ assert p.matches(x, x) is True
+ assert p.matches(x, "junk") is False
+ out, err = capsys.readouterr()
+ assert err == ""
+
def test_property_matches_compatible_arrays(capsys):
p = pb.Property()
a = np.arange(5)
@@ -65,3 +73,35 @@ def test_property_matches_incompatible_arrays(capsys):
out, err = capsys.readouterr()
# no way to suppress FutureWarning in this case
# assert err == ""
+
+def test_property_matches_dicts_with_array_values(capsys):
+ p = pb.Property()
+ d1 = dict(foo=np.arange(10))
+ d2 = dict(foo=np.arange(10))
+
+ assert p.matches(d1, d1) is True
+ assert p.matches(d1, d2) is True
+
+ # XXX not sure if this is preferable to have match, or not
+ assert p.matches(d1, dict(foo=list(range(10)))) is True
+
+ assert p.matches(d1, dict(foo=np.arange(11))) is False
+ assert p.matches(d1, dict(bar=np.arange(10))) is False
+ assert p.matches(d1, dict(bar=10)) is False
+ out, err = capsys.readouterr()
+ assert err == ""
+
+def test_property_matches_non_dict_containers_with_array_false(capsys):
+ p = pb.Property()
+ d1 = [np.arange(10)]
+ d2 = [np.arange(10)]
+ assert p.matches(d1, d1) is True # because object identity
+ assert p.matches(d1, d2) is False
+
+ t1 = (np.arange(10),)
+ t2 = (np.arange(10),)
+ assert p.matches(t1, t1) is True # because object identity
+ assert p.matches(t1, t2) is False
+
+ out, err = capsys.readouterr()
+ assert err == ""
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 1
}
|
0.12
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install bokeh",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
bokeh==3.4.3
contourpy==1.3.0
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
Jinja2==3.1.6
MarkupSafe==3.0.2
numpy==2.0.2
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pillow==11.1.0
pluggy @ file:///croot/pluggy_1733169602837/work
pytest @ file:///croot/pytest_1738938843180/work
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.2
six==1.17.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
tornado==6.4.2
tzdata==2025.2
xyzservices==2025.1.0
|
name: bokeh
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- bokeh==3.4.3
- contourpy==1.3.0
- jinja2==3.1.6
- markupsafe==3.0.2
- numpy==2.0.2
- pandas==2.2.3
- pillow==11.1.0
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==6.0.2
- six==1.17.0
- tornado==6.4.2
- tzdata==2025.2
- xyzservices==2025.1.0
prefix: /opt/conda/envs/bokeh
|
[
"bokeh/core/property/tests/test_bases.py::test_property_matches_dicts_with_array_values",
"bokeh/core/property/tests/test_bases.py::test_property_matches_non_dict_containers_with_array_false"
] |
[] |
[
"bokeh/core/property/tests/test_bases.py::test_property_assert_bools",
"bokeh/core/property/tests/test_bases.py::test_property_assert_functions",
"bokeh/core/property/tests/test_bases.py::test_property_assert_msg_funcs",
"bokeh/core/property/tests/test_bases.py::test_property_matches_basic_types",
"bokeh/core/property/tests/test_bases.py::test_property_matches_compatible_arrays",
"bokeh/core/property/tests/test_bases.py::test_property_matches_incompatible_arrays"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 1,342 |
jboss-dockerfiles__dogen-143
|
a55fa36d7ae6d19688c93d42629fbd763b72419f
|
2017-06-07 10:33:27
|
bc9263c5b683fdf901ac1646286ee3908b85dcdc
|
diff --git a/dogen/cli.py b/dogen/cli.py
index 6540695..c70984c 100644
--- a/dogen/cli.py
+++ b/dogen/cli.py
@@ -14,6 +14,7 @@ from dogen.version import version
from dogen.errors import Error
from dogen.plugin import Plugin
+import colorlog
class MyParser(argparse.ArgumentParser):
@@ -25,14 +26,15 @@ class MyParser(argparse.ArgumentParser):
class CLI(object):
def __init__(self):
- self.log = logging.getLogger("dogen")
+ formatter = colorlog.ColoredFormatter(
+ '%(log_color)s%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
handler = logging.StreamHandler()
- formatter = logging.Formatter(
- '%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
handler.setFormatter(formatter)
+
+ self.log = logging.getLogger("dogen")
self.log.addHandler(handler)
- for package in ["requests.packages.urllib3", "pykwalify.core", "pykwalify.rule"]:
+ for package in ["requests.packages.urllib3", "pykwalify.rule"]:
log = logging.getLogger(package)
log.setLevel(logging.INFO)
@@ -86,7 +88,10 @@ class CLI(object):
except KeyboardInterrupt as e:
pass
except Error as e:
- self.log.exception(e)
+ if args.verbose:
+ self.log.exception(e)
+ else:
+ self.log.error(str(e))
sys.exit(1)
def get_plugins(self):
diff --git a/dogen/generator.py b/dogen/generator.py
index 335db99..0562cd8 100644
--- a/dogen/generator.py
+++ b/dogen/generator.py
@@ -48,12 +48,12 @@ class Generator(object):
self.ssl_verify to False.
"""
- self.log.info("Fetching '%s' file..." % location)
+ self.log.debug("Fetching '%s' file..." % location)
if not output:
output = tempfile.mktemp("-dogen")
- self.log.info("Fetched file will be saved as '%s'..." % os.path.basename(output))
+ self.log.debug("Fetched file will be saved as '%s'..." % os.path.basename(output))
r = requests.get(location, verify=self.ssl_verify, stream=True)
@@ -261,8 +261,12 @@ class Generator(object):
if 'sources' not in self.cfg or self.without_sources:
return []
+ self.log.info("Handling artifacts...")
self.cfg['artifacts'] = {}
+ sources_cache = os.environ.get("DOGEN_SOURCES_CACHE")
+ self.log.debug("Source cache will be used for all artifacts")
+
for source in self.cfg['sources']:
url = source.get('url')
artifact = source.get('artifact')
@@ -279,6 +283,8 @@ class Generator(object):
if not artifact:
raise Error("Artifact location for one or more sources was not provided, please check your image descriptor!")
+ self.log.info("Handling artifact '%s'" % artifact)
+
basename = os.path.basename(artifact)
target = source.get('target')
@@ -312,24 +318,28 @@ class Generator(object):
self.check_sum(filename, source[algorithm], algorithm)
passed = True
except Exception as e:
- self.log.warn(str(e))
+ self.log.debug(str(e))
+ self.log.warn("Local file doesn't match provided checksum, artifact '%s' will be downloaded again" % artifact)
passed = False
if not passed:
- sources_cache = os.environ.get("DOGEN_SOURCES_CACHE")
if sources_cache:
- artifact = sources_cache.replace('#filename#', basename)
+ cached_artifact = sources_cache.replace('#filename#', basename)
if algorithms:
if len(algorithms) > 1:
self.log.warn("You specified multiple algorithms for '%s' artifact, but only '%s' will be used to fetch it from cache" % (artifact, algorithms[0]))
- artifact = artifact.replace('#hash#', source[algorithms[0]]).replace('#algorithm#', algorithms[0])
-
- self.log.info("Using '%s' as cached location for artifact" % artifact)
+ cached_artifact = cached_artifact.replace('#hash#', source[algorithms[0]]).replace('#algorithm#', algorithms[0])
- self._fetch_file(artifact, filename)
+ try:
+ self._fetch_file(cached_artifact, filename)
+ except Exception as e:
+ self.log.warn("Could not download artifact from cached location: '%s': %s. Please make sure you set the correct value for DOGEN_SOURCES_CACHE (currently: '%s')." % (cached_artifact, str(e), sources_cache))
+ self._download_source(artifact, filename, source.get('hint'))
+ else:
+ self._download_source(artifact, filename, source.get('hint'))
if algorithms:
for algorithm in algorithms:
@@ -338,10 +348,24 @@ class Generator(object):
if algorithms:
self.cfg['artifacts'][target] = "%s:%s" % (algorithms[0], source[algorithms[0]])
else:
+ self.log.warn("No checksum was specified for artifact '%s'!" % artifact)
self.cfg['artifacts'][target] = None
+ def _download_source(self, artifact, filename, hint=None):
+ if Tools.is_url(artifact):
+ self.log.warn("Trying to download the '%s' artifact from original location" % artifact)
+ try:
+ self._fetch_file(artifact, filename)
+ except Exception as e:
+ raise Error("Could not download artifact from orignal location, reason: %s" % str(e))
+ else:
+ if hint:
+ self.log.info(hint)
+ self.log.info("Please download the '%s' artifact manually and save it as '%s'" % (artifact, filename))
+ raise Error("Artifact '%s' could not be fetched!" % artifact)
+
def check_sum(self, filename, checksum, algorithm):
- self.log.info("Checking '%s' %s hash..." % (os.path.basename(filename), algorithm))
+ self.log.debug("Checking '%s' %s hash..." % (os.path.basename(filename), algorithm))
hash = getattr(hashlib, algorithm)()
diff --git a/dogen/schema/kwalify_schema.yaml b/dogen/schema/kwalify_schema.yaml
index 05069f3..82c400d 100644
--- a/dogen/schema/kwalify_schema.yaml
+++ b/dogen/schema/kwalify_schema.yaml
@@ -64,6 +64,7 @@ map:
sha1: {type: str}
sha256: {type: str}
target: {type: str}
+ hint: {type: str}
packages:
seq:
- {type: str}
diff --git a/requirements.txt b/requirements.txt
index f7e4f1f..43c4660 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -3,3 +3,4 @@ Jinja2>=2.8
requests>=2.8.1
six>=1.10.0
pykwalify>=1.5.1
+colorlog>=2.10.0
|
Add colored logging output
To make it easier to see important messages (especially when verbose output is turned on) - we should add color to log messages.
|
jboss-dockerfiles/dogen
|
diff --git a/tests/test_unit_generate_handle_files.py b/tests/test_unit_generate_handle_files.py
index eb85ab9..daf240a 100644
--- a/tests/test_unit_generate_handle_files.py
+++ b/tests/test_unit_generate_handle_files.py
@@ -1,6 +1,7 @@
import argparse
import unittest
import mock
+import os
import six
from dogen.generator import Generator
@@ -45,8 +46,8 @@ class TestFetchFile(unittest.TestCase):
mock_requests.assert_called_with('https://host/file.tmp', verify=None, stream=True)
mock_file().write.assert_called_once_with("file-content")
- self.log.info.assert_any_call("Fetching 'https://host/file.tmp' file...")
- self.log.info.assert_any_call("Fetched file will be saved as 'some-file'...")
+ self.log.debug.assert_any_call("Fetching 'https://host/file.tmp' file...")
+ self.log.debug.assert_any_call("Fetched file will be saved as 'some-file'...")
@mock.patch('dogen.generator.tempfile.mktemp', return_value="tmpfile")
@@ -64,8 +65,8 @@ class TestFetchFile(unittest.TestCase):
mock_requests.assert_called_with('https://host/file.tmp', verify=None, stream=True)
mock_file().write.assert_called_once_with("file-content")
- self.log.info.assert_any_call("Fetching 'https://host/file.tmp' file...")
- self.log.info.assert_any_call("Fetched file will be saved as 'tmpfile'...")
+ self.log.debug.assert_any_call("Fetching 'https://host/file.tmp' file...")
+ self.log.debug.assert_any_call("Fetched file will be saved as 'tmpfile'...")
class TestCustomTemplateHandling(unittest.TestCase):
def setUp(self):
@@ -113,3 +114,76 @@ class TestCustomTemplateHandling(unittest.TestCase):
fetch_file_mock.assert_called_with("http://host/custom-template")
self.assertEqual(self.generator.template, "some-tmp-file")
+
+class TestHandleSources(unittest.TestCase):
+ def setUp(self):
+ self.log = mock.Mock()
+ args = argparse.Namespace(path="image.yaml", output="target", without_sources=None,
+ template="http://host/custom-template", scripts_path=None,
+ additional_script=None, skip_ssl_verification=None)
+ self.generator = Generator(self.log, args)
+
+ def test_fetch_artifact_without_url_should_fail(self):
+ self.generator.cfg = {'sources': [{'artifact': 'jboss-eap.zip'}]}
+
+ with self.assertRaises(Error) as cm:
+ self.generator.handle_sources()
+
+ self.assertEquals(str(cm.exception), "Artifact 'jboss-eap.zip' could not be fetched!")
+
+ @mock.patch('dogen.generator.Generator._fetch_file', side_effect=Error("Blah"))
+ def test_fetch_artifact_should_fail_when_fetching_fails(self, mock_fetch_file):
+ self.generator.cfg = {'sources': [{'artifact': 'http://jboss-eap.zip'}]}
+
+ with self.assertRaises(Error) as cm:
+ self.generator.handle_sources()
+
+ self.assertEquals(str(cm.exception), "Could not download artifact from orignal location, reason: Blah")
+
+ @mock.patch('dogen.generator.Generator._fetch_file', side_effect=[Error("cached"), Error("original")])
+ def test_fetch_artifact_should_fail_when_cached_download_failed_and_original_failed_too(self, mock_fetch_file):
+ self.generator.cfg = {'sources': [{'artifact': 'http://host.com/jboss-eap.zip'}]}
+
+ k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/get?#algorithm#=#hash#'})
+ k.start()
+
+ with self.assertRaises(Error) as cm:
+ self.generator.handle_sources()
+
+ k.stop()
+
+ self.assertEquals(str(cm.exception), "Could not download artifact from orignal location, reason: original")
+ mock_fetch_file.assert_has_calls([mock.call('http://cache/get?#algorithm#=#hash#', 'target/jboss-eap.zip'), mock.call('http://host.com/jboss-eap.zip', 'target/jboss-eap.zip')])
+
+ @mock.patch('dogen.generator.Generator._fetch_file')
+ def test_fetch_artifact_should_fetch_file_from_cache(self, mock_fetch_file):
+ self.generator.cfg = {'sources': [{'artifact': 'http://host.com/jboss-eap.zip'}]}
+
+ k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/get?#filename#'})
+ k.start()
+ self.generator.handle_sources()
+ k.stop()
+
+ # No checksum provided and computed
+ self.assertEquals(self.generator.cfg['artifacts'], {'jboss-eap.zip': None})
+ mock_fetch_file.assert_called_with('http://cache/get?jboss-eap.zip', 'target/jboss-eap.zip')
+
+ @mock.patch('dogen.generator.Generator._fetch_file')
+ def test_fetch_artifact_should_fetch_file(self, mock_fetch_file):
+ self.generator.cfg = {'sources': [{'artifact': 'http://host.com/jboss-eap.zip'}]}
+ self.generator.handle_sources()
+ # No checksum provided and computed
+ self.assertEquals(self.generator.cfg['artifacts'], {'jboss-eap.zip': None})
+ mock_fetch_file.assert_called_with('http://host.com/jboss-eap.zip', 'target/jboss-eap.zip')
+
+ @mock.patch('dogen.generator.Generator._fetch_file', side_effect=[Error("cached"), None])
+ def test_fetch_artifact_should_download_from_original_location_if_cached_location_failed(self, mock_fetch_file):
+ self.generator.cfg = {'sources': [{'artifact': 'http://host.com/jboss-eap.zip'}]}
+
+ k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/get?#algorithm#=#hash#'})
+ k.start()
+ self.generator.handle_sources()
+ k.stop()
+
+ self.assertEquals(self.generator.cfg['artifacts'], {'jboss-eap.zip': None})
+ mock_fetch_file.assert_has_calls([mock.call('http://cache/get?#algorithm#=#hash#', 'target/jboss-eap.zip'), mock.call('http://host.com/jboss-eap.zip', 'target/jboss-eap.zip')])
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 1
},
"num_modified_files": 4
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi==2025.1.31
charset-normalizer==3.4.1
coverage==7.8.0
docopt==0.6.2
-e git+https://github.com/jboss-dockerfiles/dogen.git@a55fa36d7ae6d19688c93d42629fbd763b72419f#egg=dogen
exceptiongroup==1.2.2
idna==3.10
iniconfig==2.1.0
Jinja2==3.1.6
MarkupSafe==3.0.2
mock==5.2.0
packaging==24.2
pluggy==1.5.0
pykwalify==1.8.0
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
PyYAML==6.0.2
requests==2.32.3
ruamel.yaml==0.18.10
ruamel.yaml.clib==0.2.12
six==1.17.0
tomli==2.2.1
urllib3==2.3.0
|
name: dogen
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- certifi==2025.1.31
- charset-normalizer==3.4.1
- coverage==7.8.0
- docopt==0.6.2
- exceptiongroup==1.2.2
- idna==3.10
- iniconfig==2.1.0
- jinja2==3.1.6
- markupsafe==3.0.2
- mock==5.2.0
- packaging==24.2
- pluggy==1.5.0
- pykwalify==1.8.0
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pyyaml==6.0.2
- requests==2.32.3
- ruamel-yaml==0.18.10
- ruamel-yaml-clib==0.2.12
- six==1.17.0
- tomli==2.2.1
- urllib3==2.3.0
prefix: /opt/conda/envs/dogen
|
[
"tests/test_unit_generate_handle_files.py::TestFetchFile::test_fetching_with_filename",
"tests/test_unit_generate_handle_files.py::TestFetchFile::test_fetching_with_tmpfile",
"tests/test_unit_generate_handle_files.py::TestHandleSources::test_fetch_artifact_should_download_from_original_location_if_cached_location_failed",
"tests/test_unit_generate_handle_files.py::TestHandleSources::test_fetch_artifact_should_fail_when_cached_download_failed_and_original_failed_too",
"tests/test_unit_generate_handle_files.py::TestHandleSources::test_fetch_artifact_should_fail_when_fetching_fails",
"tests/test_unit_generate_handle_files.py::TestHandleSources::test_fetch_artifact_should_fetch_file",
"tests/test_unit_generate_handle_files.py::TestHandleSources::test_fetch_artifact_without_url_should_fail"
] |
[] |
[
"tests/test_unit_generate_handle_files.py::TestURL::test_local_file",
"tests/test_unit_generate_handle_files.py::TestURL::test_remote_http_file",
"tests/test_unit_generate_handle_files.py::TestURL::test_remote_https_file",
"tests/test_unit_generate_handle_files.py::TestCustomTemplateHandling::test_do_not_fail_if_no_template_is_provided",
"tests/test_unit_generate_handle_files.py::TestCustomTemplateHandling::test_fetch_template_success",
"tests/test_unit_generate_handle_files.py::TestCustomTemplateHandling::test_fetch_template_with_error",
"tests/test_unit_generate_handle_files.py::TestHandleSources::test_fetch_artifact_should_fetch_file_from_cache"
] |
[] |
MIT License
| 1,344 |
|
BBN-Q__Auspex-98
|
783df41a1baaeb7a85611e5d599d07510df0d1ff
|
2017-06-07 20:27:11
|
bd5979590a940bcd22d0a124090ec9e05d3c050a
|
diff --git a/src/auspex/experiment.py b/src/auspex/experiment.py
index 936fa70f..6452b6f8 100644
--- a/src/auspex/experiment.py
+++ b/src/auspex/experiment.py
@@ -237,7 +237,6 @@ class Experiment(metaclass=MetaExperiment):
# Run the stream init
self.init_streams()
- self.update_descriptors()
def set_graph(self, edges):
unique_nodes = []
@@ -248,7 +247,6 @@ class Experiment(metaclass=MetaExperiment):
unique_nodes.append(ee.parent)
self.nodes = unique_nodes
self.graph = ExperimentGraph(edges, self.loop)
- self.update_descriptors()
def init_streams(self):
"""Establish the base descriptors for any internal data streams and connectors."""
@@ -386,6 +384,9 @@ class Experiment(metaclass=MetaExperiment):
self.instrs_connected = False
def run_sweeps(self):
+ # Propagate the descriptors through the network
+ self.update_descriptors()
+
#connect all instruments
if not self.instrs_connected:
self.connect_instruments()
@@ -495,7 +496,6 @@ class Experiment(metaclass=MetaExperiment):
for oc in self.output_connectors.values():
logger.debug("Adding axis %s to connector %s.", axis, oc.name)
oc.descriptor.add_axis(axis)
- self.update_descriptors()
def add_sweep(self, parameters, sweep_list, refine_func=None, callback_func=None, metadata=None):
ax = SweepAxis(parameters, sweep_list, refine_func=refine_func, callback_func=callback_func, metadata=metadata)
diff --git a/src/auspex/instruments/instrument.py b/src/auspex/instruments/instrument.py
index c00a8e5d..93874085 100644
--- a/src/auspex/instruments/instrument.py
+++ b/src/auspex/instruments/instrument.py
@@ -1,6 +1,6 @@
-# __all__ = ['Command', 'FloatCommand', 'StringCommand', 'IntCommand', 'RampCommand',
-# 'SCPICommand',
-# 'DigitizerChannel',
+# __all__ = ['Command', 'FloatCommand', 'StringCommand', 'IntCommand', 'RampCommand',
+# 'SCPICommand',
+# 'DigitizerChannel',
__all__ = ['Instrument'] # 'SCPIInstrument', 'CLibInstrument', 'MetaInstrument']
import numpy as np
@@ -226,24 +226,22 @@ class SCPIInstrument(Instrument):
# Load the dummy interface, unless we see that GPIB is in the resource string
if any([x in self.resource_name for x in ["GPIB", "USB", "SOCKET", "hislip", "inst0", "COM"]]):
interface_type = "VISA"
-
+
try:
if interface_type is None:
logger.debug("Instrument {} is using a generic instrument " +
"interface as none was provided.".format(self.name))
self.interface = Interface()
elif interface_type == "VISA":
- if "GPIB" in self.full_resource_name:
- pass
- elif any(is_valid_ipv4(substr) for substr in self.full_resource_name.split("::")) and "TCPIP" not in self.full_resource_name:
+ if any(is_valid_ipv4(substr) for substr in self.full_resource_name.split("::")) and "TCPIP" not in self.full_resource_name:
# assume single NIC for now
self.full_resource_name = "TCPIP0::" + self.full_resource_name
self.interface = VisaInterface(self.full_resource_name)
print(self.interface._resource)
logger.debug("A pyVISA interface {} was created for instrument {}.".format(str(self.interface._resource), self.name))
- elif interface_type == "Prologix":
+ elif interface_type == "Prologix":
self.interface = PrologixInterface(self.full_resource_name)
-
+
else:
raise ValueError("That interface type is not yet recognized.")
except:
|
Defer update_descriptors() until run time
Many filters are quite confused about their lot in life before the experiment has all of its parameter sweeps added. Defer calling update_descriptors() until we actually want to run.
|
BBN-Q/Auspex
|
diff --git a/test/test_average.py b/test/test_average.py
index 5c015bd1..93bf241d 100644
--- a/test/test_average.py
+++ b/test/test_average.py
@@ -136,7 +136,7 @@ class AverageTestCase(unittest.TestCase):
exp = TestExperiment()
printer_partial = Print(name="Partial")
printer_final = Print(name="Final")
- avgr = Averager(name="TestAverager")
+ avgr = Averager(name="TestAverager", axis='freq_1')
edges = [(exp.chan1, avgr.sink),
(avgr.partial_average, printer_partial.sink),
@@ -144,8 +144,6 @@ class AverageTestCase(unittest.TestCase):
exp.set_graph(edges)
exp.add_sweep(exp.freq_1, np.linspace(0,9,10))
- avgr.axis.value = 'freq_1'
- avgr.update_descriptors()
exp.run_sweeps()
if __name__ == '__main__':
diff --git a/test/test_experiment.py b/test/test_experiment.py
index 64ba5297..6ec15025 100644
--- a/test/test_experiment.py
+++ b/test/test_experiment.py
@@ -138,7 +138,7 @@ class ExperimentTestCase(unittest.TestCase):
(pt.source, prnt.sink)]
exp.set_graph(edges)
-
+ exp.update_descriptors()
self.assertFalse(pt.sink.descriptor is None)
self.assertFalse(prnt.sink.descriptor is None)
self.assertTrue(exp.chan1.descriptor == pt.sink.descriptor)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 1
},
"num_modified_files": 2
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
-e git+https://github.com/BBN-Q/Auspex.git@783df41a1baaeb7a85611e5d599d07510df0d1ff#egg=auspex
cached-property==1.5.2
certifi==2021.5.30
cffi==1.15.1
cycler==0.11.0
dataclasses==0.8
decorator==4.4.2
h5py==3.1.0
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
kiwisolver==1.3.1
matplotlib==3.3.4
networkx==2.5.1
numpy==1.19.5
packaging==21.3
pandas==1.1.5
Pillow==8.4.0
pluggy==1.0.0
py==1.11.0
pycparser==2.21
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
PyVISA==1.11.3
scipy==1.5.4
six==1.17.0
tomli==1.2.3
tqdm==4.64.1
typing_extensions==4.1.1
zipp==3.6.0
|
name: Auspex
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- cached-property==1.5.2
- cffi==1.15.1
- cycler==0.11.0
- dataclasses==0.8
- decorator==4.4.2
- h5py==3.1.0
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- iniconfig==1.1.1
- kiwisolver==1.3.1
- matplotlib==3.3.4
- networkx==2.5.1
- numpy==1.19.5
- packaging==21.3
- pandas==1.1.5
- pillow==8.4.0
- pluggy==1.0.0
- py==1.11.0
- pycparser==2.21
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyvisa==1.11.3
- scipy==1.5.4
- six==1.17.0
- tomli==1.2.3
- tqdm==4.64.1
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/Auspex
|
[
"test/test_average.py::AverageTestCase::test_sameness"
] |
[] |
[
"test/test_average.py::AverageTestCase::test_final_average_runs",
"test/test_average.py::AverageTestCase::test_final_variance_runs",
"test/test_average.py::AverageTestCase::test_partial_average_runs",
"test/test_experiment.py::ExperimentTestCase::test_compressed_streams",
"test/test_experiment.py::ExperimentTestCase::test_copy_descriptor",
"test/test_experiment.py::ExperimentTestCase::test_create_graph",
"test/test_experiment.py::ExperimentTestCase::test_depth",
"test/test_experiment.py::ExperimentTestCase::test_graph_parenting",
"test/test_experiment.py::ExperimentTestCase::test_instruments",
"test/test_experiment.py::ExperimentTestCase::test_parameters",
"test/test_experiment.py::ExperimentTestCase::test_run_simple_graph",
"test/test_experiment.py::ExperimentTestCase::test_run_simple_graph_branchout",
"test/test_experiment.py::ExperimentTestCase::test_update_descriptors"
] |
[] |
Apache License 2.0
| 1,345 |
|
melexis__warnings-plugin-9
|
63ce3d59b74e0cbd3d4b6795d57d0ce22d8ae112
|
2017-06-09 08:01:32
|
0c7e730a491d32ad90f258439715fb6507be37f2
|
diff --git a/setup.py b/setup.py
index 5672ae8..8f049c5 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ from os.path import basename, dirname, join, splitext
from setuptools import find_packages, setup
PROJECT_URL = 'https://github.com/melexis/warnings-plugin'
-VERSION = '0.0.4'
+VERSION = '0.0.5'
def read(*names, **kwargs):
diff --git a/src/mlx/warnings.py b/src/mlx/warnings.py
index 4c45974..3112a5f 100644
--- a/src/mlx/warnings.py
+++ b/src/mlx/warnings.py
@@ -6,7 +6,7 @@ import math
DOXYGEN_WARNING_REGEX = r"(?:(?:((?:[/.]|[A-Za-z]:).+?):(-?\d+):\s*([Ww]arning|[Ee]rror)|<.+>:-?\d+(?::\s*([Ww]arning|[Ee]rror))?): (.+(?:\n(?!\s*(?:[Nn]otice|[Ww]arning|[Ee]rror): )[^/<\n][^:\n][^/\n].+)*)|\s*([Nn]otice|[Ww]arning|[Ee]rror): (.+))$"
doxy_pattern = re.compile(DOXYGEN_WARNING_REGEX)
-SPHINX_WARNING_REGEX = r"^(.+?:\d+): (DEBUG|INFO|WARNING|ERROR|SEVERE): (.+)\n?$"
+SPHINX_WARNING_REGEX = r"^(.+?:(?:\d+|None)): (DEBUG|INFO|WARNING|ERROR|SEVERE): (.+)\n?$"
sphinx_pattern = re.compile(SPHINX_WARNING_REGEX)
|
Some RST warnings are not recognized
Example of warning not recognized:
```
/path/to/file.rst:None: WARNING: Traceability: cannot link to XXX, item is not defined
```
Rumours say it is because of a missing line number, and more rumours say that this regex would work
```
^(.+?:None): (DEBUG|INFO|WARNING|ERROR|SEVERE): (.+)\n?$
```
Warning is from mlx.traceability plugin, which could print a line number iso the None (see issue https://github.com/melexis/sphinx-traceability-extension/issues/2).
|
melexis/warnings-plugin
|
diff --git a/tests/test_sphinx.py b/tests/test_sphinx.py
index a9977fe..354a255 100644
--- a/tests/test_sphinx.py
+++ b/tests/test_sphinx.py
@@ -15,6 +15,11 @@ class TestSphinxWarnings(TestCase):
self.warnings.check_sphinx_warnings("/home/bljah/test/index.rst:5: WARNING: toctree contains reference to nonexisting document u'installation'")
self.assertEqual(self.warnings.return_sphinx_warnings(), 1)
+ def test_single_warning_no_line_number(self):
+ self.warnings.check_sphinx_warnings("/home/bljah/test/index.rst:5: WARNING: toctree contains reference to nonexisting document u'installation'")
+ self.warnings.check_sphinx_warnings("/home/bljah/test/index.rst:None: WARNING: toctree contains reference to nonexisting document u'installation'")
+ self.assertEqual(self.warnings.return_sphinx_warnings(), 2)
+
def test_single_warning_mixed(self):
self.warnings.check_sphinx_warnings('This1 should not be treated as warning')
self.warnings.check_sphinx_warnings("/home/bljah/test/index.rst:5: WARNING: toctree contains reference to nonexisting document u'installation'")
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 2
}
|
0.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-travis-fold",
"mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
coverage==6.2
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
-e git+https://github.com/melexis/warnings-plugin.git@63ce3d59b74e0cbd3d4b6795d57d0ce22d8ae112#egg=mlx.warnings
mock==5.2.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytest-cov==4.0.0
pytest-travis-fold==1.3.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tomli==1.2.3
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: warnings-plugin
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==6.2
- mock==5.2.0
- pytest-cov==4.0.0
- pytest-travis-fold==1.3.0
- tomli==1.2.3
prefix: /opt/conda/envs/warnings-plugin
|
[
"tests/test_sphinx.py::TestSphinxWarnings::test_single_warning_no_line_number"
] |
[] |
[
"tests/test_sphinx.py::TestSphinxWarnings::test_no_warning",
"tests/test_sphinx.py::TestSphinxWarnings::test_single_warning",
"tests/test_sphinx.py::TestSphinxWarnings::test_single_warning_mixed"
] |
[] |
Apache License 2.0
| 1,351 |
|
Azure__azure-cli-3643
|
c024331912bbf467725d76d437557ebc6e4aba17
|
2017-06-09 16:51:58
|
eb12ac454cbe1ddb59c86cdf2045e1912660e750
|
diff --git a/doc/configuring_your_machine.md b/doc/configuring_your_machine.md
index 7af498348..a4cbd442c 100644
--- a/doc/configuring_your_machine.md
+++ b/doc/configuring_your_machine.md
@@ -72,7 +72,7 @@ The repo has a launch.json file that will launch the version of Python that is f
#### OSX/Ubuntu (bash):
```Shell
- source <clone root>/env/scripts/activate
+ . <clone root>/env/bin/activate
```
#### Windows:
diff --git a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_validators.py b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_validators.py
index fd4342d86..5e0d8d925 100644
--- a/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_validators.py
+++ b/src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/_validators.py
@@ -679,8 +679,8 @@ def _validate_admin_password(password, os_type):
max_length = 72 if is_linux else 123
min_length = 12
if len(password) not in range(min_length, max_length + 1):
- raise CLIError('The pssword length must be between {} and {}'.format(min_length,
- max_length))
+ raise CLIError('The password length must be between {} and {}'.format(min_length,
+ max_length))
contains_lower = re.findall('[a-z]+', password)
contains_upper = re.findall('[A-Z]+', password)
contains_digit = re.findall('[0-9]+', password)
|
The error message for too short/long password for VM is spelled incorrectly (pssword)
We even have a test that verifies that it is incorrectly spelled :)
|
Azure/azure-cli
|
diff --git a/src/command_modules/azure-cli-vm/tests/test_vm_actions.py b/src/command_modules/azure-cli-vm/tests/test_vm_actions.py
index 800a04d14..45f0b6e8c 100644
--- a/src/command_modules/azure-cli-vm/tests/test_vm_actions.py
+++ b/src/command_modules/azure-cli-vm/tests/test_vm_actions.py
@@ -117,7 +117,7 @@ class TestActions(unittest.TestCase):
def test_validate_admin_password_linux(self):
# pylint: disable=line-too-long
- err_length = 'The pssword length must be between 12 and 72'
+ err_length = 'The password length must be between 12 and 72'
err_variety = 'Password must have the 3 of the following: 1 lower case character, 1 upper case character, 1 number and 1 special character'
self._verify_password_with_ex('te', 'linux', err_length)
@@ -129,7 +129,7 @@ class TestActions(unittest.TestCase):
def test_validate_admin_password_windows(self):
# pylint: disable=line-too-long
- err_length = 'The pssword length must be between 12 and 123'
+ err_length = 'The password length must be between 12 and 123'
err_variety = 'Password must have the 3 of the following: 1 lower case character, 1 upper case character, 1 number and 1 special character'
self._verify_password_with_ex('P1', 'windows', err_length)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 2
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "python scripts/dev_setup.py",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc libssl-dev libffi-dev"
],
"python": "3.5",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
adal==0.4.3
applicationinsights==0.10.0
argcomplete==1.8.0
astroid==2.11.7
attrs==22.2.0
autopep8==2.0.4
azure-batch==3.0.0
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli&subdirectory=src/azure-cli
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_billing&subdirectory=src/command_modules/azure-cli-billing
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_cdn&subdirectory=src/command_modules/azure-cli-cdn
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_cognitiveservices&subdirectory=src/command_modules/azure-cli-cognitiveservices
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_consumption&subdirectory=src/command_modules/azure-cli-consumption
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_core&subdirectory=src/azure-cli-core
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_cosmosdb&subdirectory=src/command_modules/azure-cli-cosmosdb
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_dla&subdirectory=src/command_modules/azure-cli-dla
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_dls&subdirectory=src/command_modules/azure-cli-dls
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_find&subdirectory=src/command_modules/azure-cli-find
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_interactive&subdirectory=src/command_modules/azure-cli-interactive
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_lab&subdirectory=src/command_modules/azure-cli-lab
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_monitor&subdirectory=src/command_modules/azure-cli-monitor
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_rdbms&subdirectory=src/command_modules/azure-cli-rdbms
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_sf&subdirectory=src/command_modules/azure-cli-sf
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_testsdk&subdirectory=src/azure-cli-testsdk
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_utility_automation&subdirectory=scripts
-e git+https://github.com/Azure/azure-cli.git@c024331912bbf467725d76d437557ebc6e4aba17#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm
azure-common==1.1.28
azure-core==1.24.2
azure-datalake-store==0.0.9
azure-graphrbac==0.30.0rc6
azure-keyvault==0.3.0
azure-mgmt-authorization==0.30.0rc6
azure-mgmt-batch==4.0.0
azure-mgmt-billing==0.1.0
azure-mgmt-cdn==0.30.2
azure-mgmt-cognitiveservices==1.0.0
azure-mgmt-compute==1.0.0rc1
azure-mgmt-consumption==0.1.0
azure-mgmt-containerregistry==0.2.1
azure-mgmt-datalake-analytics==0.1.4
azure-mgmt-datalake-nspkg==3.0.1
azure-mgmt-datalake-store==0.1.4
azure-mgmt-devtestlabs==2.0.0
azure-mgmt-dns==1.0.1
azure-mgmt-documentdb==0.1.3
azure-mgmt-iothub==0.2.2
azure-mgmt-keyvault==0.31.0
azure-mgmt-monitor==0.2.1
azure-mgmt-network==1.0.0rc3
azure-mgmt-nspkg==1.0.0
azure-mgmt-rdbms==0.1.0
azure-mgmt-redis==1.0.0
azure-mgmt-resource==1.1.0rc1
azure-mgmt-sql==0.5.1
azure-mgmt-storage==1.0.0rc1
azure-mgmt-trafficmanager==0.30.0
azure-mgmt-web==0.32.0
azure-monitor==0.3.0
azure-multiapi-storage==0.1.0
azure-nspkg==1.0.0
azure-servicefabric==5.6.130
certifi==2021.5.30
cffi==1.15.1
colorama==0.3.7
coverage==6.2
cryptography==40.0.2
flake8==5.0.4
futures==3.1.1
humanfriendly==2.4
idna==3.10
importlib-metadata==4.2.0
iniconfig==1.1.1
isodate==0.7.0
isort==5.10.1
jeepney==0.7.1
jmespath==0.10.0
keyring==23.4.1
lazy-object-proxy==1.7.1
mccabe==0.7.0
mock==5.2.0
msrest==0.4.29
msrestazure==0.4.34
nose==1.3.7
oauthlib==3.2.2
packaging==21.3
paramiko==2.0.2
pbr==6.1.1
pluggy==1.0.0
prompt-toolkit==3.0.36
py==1.11.0
pyasn1==0.5.1
pycodestyle==2.10.0
pycparser==2.21
pydocumentdb==2.3.5
pyflakes==2.5.0
Pygments==2.1.3
PyJWT==2.4.0
pylint==1.7.1
pyOpenSSL==16.2.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==3.11
requests==2.9.1
requests-oauthlib==2.0.0
scp==0.15.0
SecretStorage==3.3.3
six==1.10.0
sshtunnel==0.4.0
tabulate==0.7.7
tomli==1.2.3
typed-ast==1.5.5
typing-extensions==4.1.1
urllib3==1.26.20
urllib3-secure-extra==0.1.0
vcrpy==1.10.3
vsts-cd-manager==1.0.2
wcwidth==0.2.13
Whoosh==2.7.4
wrapt==1.16.0
xmltodict==0.14.2
zipp==3.6.0
|
name: azure-cli
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- adal==0.4.3
- applicationinsights==0.10.0
- argcomplete==1.8.0
- astroid==2.11.7
- attrs==22.2.0
- autopep8==2.0.4
- azure-batch==3.0.0
- azure-common==1.1.28
- azure-core==1.24.2
- azure-datalake-store==0.0.9
- azure-graphrbac==0.30.0rc6
- azure-keyvault==0.3.0
- azure-mgmt-authorization==0.30.0rc6
- azure-mgmt-batch==4.0.0
- azure-mgmt-billing==0.1.0
- azure-mgmt-cdn==0.30.2
- azure-mgmt-cognitiveservices==1.0.0
- azure-mgmt-compute==1.0.0rc1
- azure-mgmt-consumption==0.1.0
- azure-mgmt-containerregistry==0.2.1
- azure-mgmt-datalake-analytics==0.1.4
- azure-mgmt-datalake-nspkg==3.0.1
- azure-mgmt-datalake-store==0.1.4
- azure-mgmt-devtestlabs==2.0.0
- azure-mgmt-dns==1.0.1
- azure-mgmt-documentdb==0.1.3
- azure-mgmt-iothub==0.2.2
- azure-mgmt-keyvault==0.31.0
- azure-mgmt-monitor==0.2.1
- azure-mgmt-network==1.0.0rc3
- azure-mgmt-nspkg==1.0.0
- azure-mgmt-rdbms==0.1.0
- azure-mgmt-redis==1.0.0
- azure-mgmt-resource==1.1.0rc1
- azure-mgmt-sql==0.5.1
- azure-mgmt-storage==1.0.0rc1
- azure-mgmt-trafficmanager==0.30.0
- azure-mgmt-web==0.32.0
- azure-monitor==0.3.0
- azure-multiapi-storage==0.1.0
- azure-nspkg==1.0.0
- azure-servicefabric==5.6.130
- cffi==1.15.1
- colorama==0.3.7
- coverage==6.2
- cryptography==40.0.2
- flake8==5.0.4
- futures==3.1.1
- humanfriendly==2.4
- idna==3.10
- importlib-metadata==4.2.0
- iniconfig==1.1.1
- isodate==0.7.0
- isort==5.10.1
- jeepney==0.7.1
- jmespath==0.10.0
- keyring==23.4.1
- lazy-object-proxy==1.7.1
- mccabe==0.7.0
- mock==5.2.0
- msrest==0.4.29
- msrestazure==0.4.34
- nose==1.3.7
- oauthlib==3.2.2
- packaging==21.3
- paramiko==2.0.2
- pbr==6.1.1
- pip==9.0.1
- pluggy==1.0.0
- prompt-toolkit==3.0.36
- py==1.11.0
- pyasn1==0.5.1
- pycodestyle==2.10.0
- pycparser==2.21
- pydocumentdb==2.3.5
- pyflakes==2.5.0
- pygments==2.1.3
- pyjwt==2.4.0
- pylint==1.7.1
- pyopenssl==16.2.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==3.11
- requests==2.9.1
- requests-oauthlib==2.0.0
- scp==0.15.0
- secretstorage==3.3.3
- setuptools==30.4.0
- six==1.10.0
- sshtunnel==0.4.0
- tabulate==0.7.7
- tomli==1.2.3
- typed-ast==1.5.5
- typing-extensions==4.1.1
- urllib3==1.26.20
- urllib3-secure-extra==0.1.0
- vcrpy==1.10.3
- vsts-cd-manager==1.0.2
- wcwidth==0.2.13
- whoosh==2.7.4
- wrapt==1.16.0
- xmltodict==0.14.2
- zipp==3.6.0
prefix: /opt/conda/envs/azure-cli
|
[
"src/command_modules/azure-cli-vm/tests/test_vm_actions.py::TestActions::test_validate_admin_password_linux",
"src/command_modules/azure-cli-vm/tests/test_vm_actions.py::TestActions::test_validate_admin_password_windows"
] |
[] |
[
"src/command_modules/azure-cli-vm/tests/test_vm_actions.py::TestActions::test_figure_out_storage_source",
"src/command_modules/azure-cli-vm/tests/test_vm_actions.py::TestActions::test_generate_specfied_ssh_key_files",
"src/command_modules/azure-cli-vm/tests/test_vm_actions.py::TestActions::test_get_next_subnet_addr_suffix",
"src/command_modules/azure-cli-vm/tests/test_vm_actions.py::TestActions::test_parse_image_argument",
"src/command_modules/azure-cli-vm/tests/test_vm_actions.py::TestActions::test_source_storage_account_err_case",
"src/command_modules/azure-cli-vm/tests/test_vm_actions.py::TestActions::test_validate_admin_username_linux",
"src/command_modules/azure-cli-vm/tests/test_vm_actions.py::TestActions::test_validate_admin_username_windows"
] |
[] |
MIT License
| 1,352 |
|
d3dave__cough-3
|
b2a4ebe62f953e35beff00a9a7d7426cc20f6350
|
2017-06-10 20:39:05
|
b2a4ebe62f953e35beff00a9a7d7426cc20f6350
|
diff --git a/cough/file.py b/cough/file.py
index 84338e7..d96aa8a 100644
--- a/cough/file.py
+++ b/cough/file.py
@@ -125,25 +125,17 @@ class ObjectModule:
return bytes(body_buffer)
def dump_sections(self):
+ data_buf_offset = FileHeader.struct.size + 40 * len(self.sections)
+ hdrs_buf = bytearray()
data_buf = bytearray()
- sections_offsets = []
- reloc_offsets = []
for sec in self.sections:
if sec.data:
- sections_offsets.append(len(data_buf))
+ sec.pointer_to_raw_data = data_buf_offset + len(data_buf)
data_buf += sec.data
if sec.relocations:
- reloc_offsets.append(len(data_buf))
+ sec.pointer_to_relocations = data_buf_offset + len(data_buf)
for reloc in sec.relocations:
data_buf += reloc.pack()
+ hdrs_buf += sec.get_header()
- sections_buffer_offset = FileHeader.struct.size + 40 * len(self.sections)
- hdrs_and_data_buf = bytearray()
- for i, sec in enumerate(self.sections):
- if sec.data:
- sec.pointer_to_raw_data = sections_buffer_offset + sections_offsets[i]
- if sec.relocations:
- sec.pointer_to_relocations = sections_buffer_offset + reloc_offsets[i]
- hdrs_and_data_buf += sec.get_header()
- hdrs_and_data_buf += data_buf
- return bytes(hdrs_and_data_buf)
+ return bytes(hdrs_buf + data_buf)
|
Exception when adding an uninitialized section before an initialized section
file.py:133 is inconsistent with file.py:144
|
d3dave/cough
|
diff --git a/tests/test_coff.py b/tests/test_coff.py
index 8ca9ce4..2193214 100644
--- a/tests/test_coff.py
+++ b/tests/test_coff.py
@@ -63,3 +63,16 @@ def test_reloc():
subprocess.run(['PowerShell.exe', BUILD_SCRIPT, file.name, '/out:' + '"' + exe_path + '"'], check=True)
proc = subprocess.run([exe_path], stdout=subprocess.PIPE, check=True)
assert proc.stdout == b'A'
+
+
+def test_uninit_before_init():
+ module = cough.ObjectModule()
+
+ sec_uninit = cough.Section(b'uninit', cough.SectionFlags.CNT_UNINITIALIZED_DATA)
+ sec_uninit.size_of_raw_data = 0x400
+ module.sections.append(sec_uninit)
+
+ sec_init = cough.Section(b'init', 0, b'\xAA\xBB\xCC\xDD')
+ module.sections.append(sec_init)
+
+ assert module.get_buffer()
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 3,
"test_score": 0
},
"num_modified_files": 1
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/d3dave/cough.git@b2a4ebe62f953e35beff00a9a7d7426cc20f6350#egg=cough
exceptiongroup==1.2.2
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
tomli==2.2.1
|
name: cough
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- exceptiongroup==1.2.2
- iniconfig==2.1.0
- packaging==24.2
- pluggy==1.5.0
- pytest==8.3.5
- tomli==2.2.1
prefix: /opt/conda/envs/cough
|
[
"tests/test_coff.py::test_uninit_before_init"
] |
[
"tests/test_coff.py::test_coff",
"tests/test_coff.py::test_reloc"
] |
[] |
[] |
MIT License
| 1,359 |
|
jboss-dockerfiles__dogen-149
|
a475173ce00b2d6686c601ffc46a8d2bc3ed0a7f
|
2017-06-13 12:32:57
|
bc9263c5b683fdf901ac1646286ee3908b85dcdc
|
diff --git a/dogen/generator.py b/dogen/generator.py
index 0562cd8..415dcb0 100644
--- a/dogen/generator.py
+++ b/dogen/generator.py
@@ -313,9 +313,10 @@ class Generator(object):
algorithms.append(supported_algorithm)
try:
- if os.path.exists(filename) and algorithms:
- for algorithm in algorithms:
- self.check_sum(filename, source[algorithm], algorithm)
+ if os.path.exists(filename):
+ if algorithms:
+ for algorithm in algorithms:
+ self.check_sum(filename, source[algorithm], algorithm)
passed = True
except Exception as e:
self.log.debug(str(e))
@@ -361,7 +362,7 @@ class Generator(object):
else:
if hint:
self.log.info(hint)
- self.log.info("Please download the '%s' artifact manually and save it as '%s'" % (artifact, filename))
+ self.log.info("Please download the '%s' artifact manually and save it as '%s'" % (artifact, filename))
raise Error("Artifact '%s' could not be fetched!" % artifact)
def check_sum(self, filename, checksum, algorithm):
|
Dogen fails if md5 is not set for 'local' artifacts
Using dogen 2.0. In my image.yaml, if I have the following:
````
sources:
- artifact: myfile.tar.gz
````
I run dogen mounting `pwd` into /tmp/output inside the dogen container, and put the myfile.tar.gz inside the build/ folder. Dogen is invoked with /tmp/output/build as the destination folder.
I would expect that the local file myfile.tar.gz is added to the resulting image. However, dogen throws an error of not being able to find the artifact. In addition, the helpful hint on where to download it, i.e. "Please download the 'myfile.tar.gz' artifact manually and save it as '/tmp/output/build/myfile.tar.gz' is missing unless I also add the 'hint' field.
If I do this:
```
sources:
- artifact: myfile.tar.gz
md5: <md5sum of myfile.tar.gz>
```
Then dogen is successful creating the Dockerfile.
I would like to be able to omit the md5 field and still be able to generate the Dockerfile, as this is useful for generating Dockerfiles for locally built artifacts.
A detailed example can be found here: https://pastebin.com/31fqRGUa
|
jboss-dockerfiles/dogen
|
diff --git a/tests/test_unit_generate_handle_files.py b/tests/test_unit_generate_handle_files.py
index daf240a..e811ebb 100644
--- a/tests/test_unit_generate_handle_files.py
+++ b/tests/test_unit_generate_handle_files.py
@@ -155,6 +155,17 @@ class TestHandleSources(unittest.TestCase):
self.assertEquals(str(cm.exception), "Could not download artifact from orignal location, reason: original")
mock_fetch_file.assert_has_calls([mock.call('http://cache/get?#algorithm#=#hash#', 'target/jboss-eap.zip'), mock.call('http://host.com/jboss-eap.zip', 'target/jboss-eap.zip')])
+ @mock.patch('dogen.generator.Generator._fetch_file')
+ def test_fetch_artifact_should_fail_with_nice_message_when_artifact_without_url_is_not_found_locally(self, mock_fetch_file):
+ self.generator.cfg = {'sources': [{'artifact': 'jboss-eap.zip'}]}
+
+ with self.assertRaises(Error) as cm:
+ self.generator.handle_sources()
+
+ self.assertEquals(str(cm.exception), "Artifact 'jboss-eap.zip' could not be fetched!")
+ mock_fetch_file.assert_not_called()
+ self.log.info.assert_any_call("Please download the 'jboss-eap.zip' artifact manually and save it as 'target/jboss-eap.zip'")
+
@mock.patch('dogen.generator.Generator._fetch_file')
def test_fetch_artifact_should_fetch_file_from_cache(self, mock_fetch_file):
self.generator.cfg = {'sources': [{'artifact': 'http://host.com/jboss-eap.zip'}]}
@@ -169,7 +180,8 @@ class TestHandleSources(unittest.TestCase):
mock_fetch_file.assert_called_with('http://cache/get?jboss-eap.zip', 'target/jboss-eap.zip')
@mock.patch('dogen.generator.Generator._fetch_file')
- def test_fetch_artifact_should_fetch_file(self, mock_fetch_file):
+ @mock.patch('dogen.generator.os.path.exists', return_value=False)
+ def test_fetch_artifact_should_fetch_file(self, mock_path_exists, mock_fetch_file):
self.generator.cfg = {'sources': [{'artifact': 'http://host.com/jboss-eap.zip'}]}
self.generator.handle_sources()
# No checksum provided and computed
@@ -187,3 +199,12 @@ class TestHandleSources(unittest.TestCase):
self.assertEquals(self.generator.cfg['artifacts'], {'jboss-eap.zip': None})
mock_fetch_file.assert_has_calls([mock.call('http://cache/get?#algorithm#=#hash#', 'target/jboss-eap.zip'), mock.call('http://host.com/jboss-eap.zip', 'target/jboss-eap.zip')])
+
+ @mock.patch('dogen.generator.Generator._fetch_file')
+ @mock.patch('dogen.generator.os.path.exists', return_value=True)
+ def test_fetch_artifact_should_not_fetch_file_if_exists(self, mock_path_exists, mock_fetch_file):
+ self.generator.cfg = {'sources': [{'artifact': 'http://host.com/jboss-eap.zip'}]}
+ self.generator.handle_sources()
+ # No checksum provided and computed
+ self.assertEquals(self.generator.cfg['artifacts'], {'jboss-eap.zip': None})
+ mock_fetch_file.assert_not_called()
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi==2025.1.31
charset-normalizer==3.4.1
colorlog==6.9.0
coverage==7.8.0
docopt==0.6.2
-e git+https://github.com/jboss-dockerfiles/dogen.git@a475173ce00b2d6686c601ffc46a8d2bc3ed0a7f#egg=dogen
exceptiongroup==1.2.2
idna==3.10
iniconfig==2.1.0
Jinja2==3.1.6
MarkupSafe==3.0.2
mock==5.2.0
packaging==24.2
pluggy==1.5.0
pykwalify==1.8.0
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
PyYAML==6.0.2
requests==2.32.3
ruamel.yaml==0.18.10
ruamel.yaml.clib==0.2.12
six==1.17.0
tomli==2.2.1
urllib3==2.3.0
|
name: dogen
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- certifi==2025.1.31
- charset-normalizer==3.4.1
- colorlog==6.9.0
- coverage==7.8.0
- docopt==0.6.2
- exceptiongroup==1.2.2
- idna==3.10
- iniconfig==2.1.0
- jinja2==3.1.6
- markupsafe==3.0.2
- mock==5.2.0
- packaging==24.2
- pluggy==1.5.0
- pykwalify==1.8.0
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pyyaml==6.0.2
- requests==2.32.3
- ruamel-yaml==0.18.10
- ruamel-yaml-clib==0.2.12
- six==1.17.0
- tomli==2.2.1
- urllib3==2.3.0
prefix: /opt/conda/envs/dogen
|
[
"tests/test_unit_generate_handle_files.py::TestHandleSources::test_fetch_artifact_should_fail_with_nice_message_when_artifact_without_url_is_not_found_locally",
"tests/test_unit_generate_handle_files.py::TestHandleSources::test_fetch_artifact_should_not_fetch_file_if_exists"
] |
[] |
[
"tests/test_unit_generate_handle_files.py::TestURL::test_local_file",
"tests/test_unit_generate_handle_files.py::TestURL::test_remote_http_file",
"tests/test_unit_generate_handle_files.py::TestURL::test_remote_https_file",
"tests/test_unit_generate_handle_files.py::TestFetchFile::test_fetching_with_filename",
"tests/test_unit_generate_handle_files.py::TestFetchFile::test_fetching_with_tmpfile",
"tests/test_unit_generate_handle_files.py::TestCustomTemplateHandling::test_do_not_fail_if_no_template_is_provided",
"tests/test_unit_generate_handle_files.py::TestCustomTemplateHandling::test_fetch_template_success",
"tests/test_unit_generate_handle_files.py::TestCustomTemplateHandling::test_fetch_template_with_error",
"tests/test_unit_generate_handle_files.py::TestHandleSources::test_fetch_artifact_should_download_from_original_location_if_cached_location_failed",
"tests/test_unit_generate_handle_files.py::TestHandleSources::test_fetch_artifact_should_fail_when_cached_download_failed_and_original_failed_too",
"tests/test_unit_generate_handle_files.py::TestHandleSources::test_fetch_artifact_should_fail_when_fetching_fails",
"tests/test_unit_generate_handle_files.py::TestHandleSources::test_fetch_artifact_should_fetch_file",
"tests/test_unit_generate_handle_files.py::TestHandleSources::test_fetch_artifact_should_fetch_file_from_cache",
"tests/test_unit_generate_handle_files.py::TestHandleSources::test_fetch_artifact_without_url_should_fail"
] |
[] |
MIT License
| 1,364 |
|
python-cmd2__cmd2-125
|
0af8018cdce37e40719e3f6c4023e9525b1e69de
|
2017-06-13 18:59:29
|
ddfd3d9a400ae81468e9abcc89fe690c30b7ec7f
|
diff --git a/CHANGES.md b/CHANGES.md
index 2324522f..c1686888 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -11,6 +11,7 @@ News
* Enhancements
* Added the ability to exclude commands from the help menu (**eof** included by default)
* Redundant list command removed and features merged into history command
+ * Added **pyscript** command which supports running Python scripts with arguments
0.7.2
-----
diff --git a/README.md b/README.md
index cd739773..8c5141b6 100755
--- a/README.md
+++ b/README.md
@@ -155,8 +155,9 @@ example/exampleSession.txt:
Documented commands (type help <topic>):
========================================
-_relative_load edit help list orate py run say shell show
-cmdenvironment eof history load pause quit save set shortcuts speak
+_relative_load help orate pyscript save shell speak
+cmdenvironment history pause quit say shortcuts
+edit load py run set show
(Cmd) help say
Repeats what you tell me to.
diff --git a/cmd2.py b/cmd2.py
index 3fe13f54..aabda96e 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -1583,6 +1583,42 @@ class Cmd(cmd.Cmd):
self._in_py = False
return self._should_quit
+ # noinspection PyUnusedLocal
+ @options([], arg_desc='<script_path> [script_arguments]')
+ def do_pyscript(self, arg, opts=None):
+ """\nRuns a python script file inside the console
+
+Console commands can be executed inside this script with cmd("your command")
+However, you cannot run nested "py" or "pyscript" commands from within this script
+Paths or arguments that contain spaces must be enclosed in quotes
+"""
+ if not arg:
+ self.perror("pyscript command requires at least 1 argument ...", traceback_war=False)
+ self.do_help('pyscript')
+ return
+
+ if not USE_ARG_LIST:
+ arg = shlex.split(arg, posix=POSIX_SHLEX)
+
+ # Get the absolute path of the script
+ script_path = os.path.abspath(os.path.expanduser(arg[0]))
+
+ # Save current command line arguments
+ orig_args = sys.argv
+
+ # Overwrite sys.argv to allow the script to take command line arguments
+ sys.argv = [script_path]
+ sys.argv.extend(arg[1:])
+
+ # Run the script
+ self.do_py("run('{}')".format(arg[0]))
+
+ # Restore command line arguments to original state
+ sys.argv = orig_args
+
+ # Enable tab completion of paths for pyscript command
+ complete_pyscript = path_complete
+
# Only include the do_ipy() method if IPython is available on the system
if ipython_available:
# noinspection PyMethodMayBeStatic,PyUnusedLocal
diff --git a/examples/arg_printer.py b/examples/arg_printer.py
new file mode 100755
index 00000000..42084d4e
--- /dev/null
+++ b/examples/arg_printer.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python
+# coding=utf-8
+import sys
+print("Running Python script {!r} which was called with {} arguments".format(sys.argv[0], len(sys.argv) - 1))
+for i, arg in enumerate(sys.argv[1:]):
+ print("arg {}: {!r}".format(i+1, arg))
diff --git a/examples/exampleSession.txt b/examples/exampleSession.txt
index 62c130f0..b2cf24c0 100644
--- a/examples/exampleSession.txt
+++ b/examples/exampleSession.txt
@@ -3,8 +3,9 @@
Documented commands (type help <topic>):
========================================
-_relative_load edit history orate py run say shell show
-cmdenvironment help load pause quit save set shortcuts speak
+_relative_load help orate pyscript save shell speak
+cmdenvironment history pause quit say shortcuts
+edit load py run set show
(Cmd) help say
Repeats what you tell me to.
|
Add ability to pass arguments to a Python script
The **py** command supports running a Python script via "py run('script.py')". However, it does not currently support the ability to pass any arguments to the script.
This functionality would be a lot more flexible and reusable if arguments could be passed to the script.
So either either enhance the current py command with the ability to run a script with arguments or add a new command which supports the ability to run a script and pass it arguments.
|
python-cmd2/cmd2
|
diff --git a/tests/conftest.py b/tests/conftest.py
index 41bd007a..77f525f7 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -15,8 +15,8 @@ import cmd2
# Help text for base cmd2.Cmd application
BASE_HELP = """Documented commands (type help <topic>):
========================================
-_relative_load edit history pause quit save shell show
-cmdenvironment help load py run set shortcuts
+_relative_load edit history pause pyscript run set shortcuts
+cmdenvironment help load py quit save shell show
"""
# Help text for the history command
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index b193a20d..5ac7d6fd 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -106,8 +106,9 @@ def test_base_with_transcript(_cmdline_app):
Documented commands (type help <topic>):
========================================
-_relative_load edit history orate py run say shell show
-cmdenvironment help load pause quit save set shortcuts speak
+_relative_load help orate pyscript save shell speak
+cmdenvironment history pause quit say shortcuts
+edit load py run set show
(Cmd) help say
Repeats what you tell me to.
diff --git a/tests/transcript.txt b/tests/transcript.txt
index d0fd86a6..582f08cb 100644
--- a/tests/transcript.txt
+++ b/tests/transcript.txt
@@ -2,8 +2,9 @@
Documented commands (type help <topic>):
========================================
-_relative_load edit history orate py run say shell show
-cmdenvironment help load pause quit save set shortcuts speak
+_relative_load help orate pyscript save shell speak
+cmdenvironment history pause quit say shortcuts
+edit load py run set show
(Cmd) help say
Repeats what you tell me to.
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 4
}
|
0.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"mock",
"sphinx",
"sphinx-rtd-theme",
"pytest-xdist",
"pytest-cov"
],
"pre_install": [
"pip install tox"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.16
babel==2.17.0
cachetools==5.5.2
certifi==2025.1.31
chardet==5.2.0
charset-normalizer==3.4.1
-e git+https://github.com/python-cmd2/cmd2.git@0af8018cdce37e40719e3f6c4023e9525b1e69de#egg=cmd2
colorama==0.4.6
coverage==7.8.0
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
execnet==2.1.1
filelock==3.18.0
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
iniconfig==2.1.0
Jinja2==3.1.6
MarkupSafe==3.0.2
mock==5.2.0
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
Pygments==2.19.1
pyparsing==3.2.3
pyproject-api==1.9.0
pytest==8.3.5
pytest-cov==6.0.0
pytest-xdist==3.6.1
requests==2.32.3
six==1.17.0
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinx-rtd-theme==3.0.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
tomli==2.2.1
tox==4.25.0
typing_extensions==4.13.0
urllib3==2.3.0
virtualenv==20.29.3
zipp==3.21.0
|
name: cmd2
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.16
- babel==2.17.0
- cachetools==5.5.2
- certifi==2025.1.31
- chardet==5.2.0
- charset-normalizer==3.4.1
- colorama==0.4.6
- coverage==7.8.0
- distlib==0.3.9
- docutils==0.21.2
- exceptiongroup==1.2.2
- execnet==2.1.1
- filelock==3.18.0
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- jinja2==3.1.6
- markupsafe==3.0.2
- mock==5.2.0
- packaging==24.2
- platformdirs==4.3.7
- pluggy==1.5.0
- pygments==2.19.1
- pyparsing==3.2.3
- pyproject-api==1.9.0
- pytest==8.3.5
- pytest-cov==6.0.0
- pytest-xdist==3.6.1
- requests==2.32.3
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==7.4.7
- sphinx-rtd-theme==3.0.2
- sphinxcontrib-applehelp==2.0.0
- sphinxcontrib-devhelp==2.0.0
- sphinxcontrib-htmlhelp==2.1.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==2.0.0
- sphinxcontrib-serializinghtml==2.0.0
- tomli==2.2.1
- tox==4.25.0
- typing-extensions==4.13.0
- urllib3==2.3.0
- virtualenv==20.29.3
- zipp==3.21.0
prefix: /opt/conda/envs/cmd2
|
[
"tests/test_transcript.py::test_base_with_transcript",
"tests/test_transcript.py::test_transcript_from_cmdloop"
] |
[] |
[
"tests/test_transcript.py::Cmd2TestCase::runTest",
"tests/test_transcript.py::TestMyAppCase::runTest",
"tests/test_transcript.py::test_optparser",
"tests/test_transcript.py::test_optparser_nosuchoption",
"tests/test_transcript.py::test_comment_stripping",
"tests/test_transcript.py::test_optarser_correct_args_with_quotes_and_midline_options",
"tests/test_transcript.py::test_optarser_options_with_spaces_in_quotes",
"tests/test_transcript.py::test_commands_at_invocation",
"tests/test_transcript.py::test_select_options",
"tests/test_transcript.py::test_multiline_command_transcript_with_comments_at_beginning",
"tests/test_transcript.py::test_invalid_syntax",
"tests/test_transcript.py::test_regex_transcript"
] |
[] |
MIT License
| 1,366 |
|
Azure__azure-cli-3743
|
e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec
|
2017-06-15 20:19:26
|
eb12ac454cbe1ddb59c86cdf2045e1912660e750
|
codecov-io: # [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3743?src=pr&el=h1) Report
> Merging [#3743](https://codecov.io/gh/Azure/azure-cli/pull/3743?src=pr&el=desc) into [master](https://codecov.io/gh/Azure/azure-cli/commit/ff20840c0278a29204adbb2c23c50d92feaa799f?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `50%`.
[](https://codecov.io/gh/Azure/azure-cli/pull/3743?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #3743 +/- ##
=======================================
Coverage 72.09% 72.09%
=======================================
Files 422 422
Lines 26259 26259
Branches 3995 3995
=======================================
Hits 18932 18932
Misses 6099 6099
Partials 1228 1228
```
| [Impacted Files](https://codecov.io/gh/Azure/azure-cli/pull/3743?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [.../azure/cli/command\_modules/resource/\_validators.py](https://codecov.io/gh/Azure/azure-cli/pull/3743?src=pr&el=tree#diff-c3JjL2NvbW1hbmRfbW9kdWxlcy9henVyZS1jbGktcmVzb3VyY2UvYXp1cmUvY2xpL2NvbW1hbmRfbW9kdWxlcy9yZXNvdXJjZS9fdmFsaWRhdG9ycy5weQ==) | `71.95% <50%> (ø)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3743?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/Azure/azure-cli/pull/3743?src=pr&el=footer). Last update [ff20840...2d89597](https://codecov.io/gh/Azure/azure-cli/pull/3743?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
|
diff --git a/azure-cli.pyproj b/azure-cli.pyproj
index ea34c0dd2..842d462d2 100644
--- a/azure-cli.pyproj
+++ b/azure-cli.pyproj
@@ -616,8 +616,6 @@
<Compile Include="command_modules\azure-cli-sf\azure\cli\command_modules\sf\_params.py" />
<Compile Include="command_modules\azure-cli-sf\azure\cli\command_modules\sf\__init__.py" />
<Compile Include="command_modules\azure-cli-sf\setup.py" />
- <Compile Include="command_modules\azure-cli-sf\tests\manual_scenario_sf_commands.py" />
- <Compile Include="command_modules\azure-cli-sf\tests\manual_sf_commands.py" />
<Compile Include="command_modules\azure-cli-sql\azure\cli\command_modules\sql\commands.py" />
<Compile Include="command_modules\azure-cli-sql\azure\cli\command_modules\sql\custom.py" />
<Compile Include="command_modules\azure-cli-sql\azure\cli\command_modules\sql\help.py" />
@@ -937,12 +935,10 @@
<Folder Include="command_modules\azure-cli-redis\azure\cli\command_modules\" />
<Folder Include="command_modules\azure-cli-redis\azure\cli\command_modules\redis\" />
<Folder Include="command_modules\azure-cli-redis\tests\" />
- <Folder Include="command_modules\azure-cli-resource\azure\cli\command_modules\resource\tests\" />
<Folder Include="command_modules\azure-cli-resource\tests\" />
<Folder Include="command_modules\azure-cli-role\tests\" />
<Folder Include="command_modules\azure-cli-redis\azure\cli\command_modules\redis\tests\" />
<Folder Include="command_modules\azure-cli-role\tests\" />
- <Folder Include="command_modules\azure-cli-role\tests\recordings\" />
<Folder Include="command_modules\azure-cli-sf\" />
<Folder Include="command_modules\azure-cli-sf\azure\" />
<Folder Include="command_modules\azure-cli-sf\azure\cli\" />
@@ -1122,6 +1118,9 @@
<Content Include="command_modules\azure-cli-resource\tests\crossrg_deploy.json" />
<Content Include="command_modules\azure-cli-resource\tests\simple_deploy.json" />
<Content Include="command_modules\azure-cli-resource\tests\simple_deploy_parameters.json" />
+ <Content Include="command_modules\azure-cli-resource\tests\test-object.json" />
+ <Content Include="command_modules\azure-cli-resource\tests\test-params.json" />
+ <Content Include="command_modules\azure-cli-resource\tests\test-template.json" />
<Content Include="command_modules\azure-cli-role\HISTORY.rst" />
<Content Include="command_modules\azure-cli-sf\HISTORY.rst" />
<Content Include="command_modules\azure-cli-sql\HISTORY.rst" />
@@ -1138,11 +1137,6 @@
<Content Include="command_modules\azure-cli-vm\tests\sample-public.json" />
<Content Include="command_modules\azure-cli-vm\tests\vmss_create_test_plan.md" />
<Content Include="command_modules\azure-cli-vm\tests\vm_create_test_plan.md" />
- <Content Include="command_modules\azure-cli-role\tests\recordings\test_application_set_scenario.yaml" />
- <Content Include="command_modules\azure-cli-role\tests\recordings\test_create_for_rbac_with_secret.yaml" />
- <Content Include="command_modules\azure-cli-role\tests\recordings\test_role_assignment_scenario.yaml" />
- <Content Include="command_modules\azure-cli-role\tests\recordings\test_role_create_scenario.yaml" />
- <Content Include="command_modules\azure-cli-role\tests\recordings\test_sp_create_scenario.yaml" />
</ItemGroup>
<ItemGroup>
<Interpreter Include="..\env\">
diff --git a/src/command_modules/azure-cli-resource/HISTORY.rst b/src/command_modules/azure-cli-resource/HISTORY.rst
index eb2eb204b..7713c8e11 100644
--- a/src/command_modules/azure-cli-resource/HISTORY.rst
+++ b/src/command_modules/azure-cli-resource/HISTORY.rst
@@ -1,9 +1,16 @@
.. :changelog:
Release History
+
===============
+
+unreleased
+++++++++++++++++++
+* `group deployment create`: Fixes issue where some parameter files were no longer recognized using @<file> syntax.
+
+
2.0.8 (2017-06-13)
-^^^^^^^^^^^^^^^^^^
+++++++++++++++++++
* Fix up some parsing and error messages. (#3584)
* Fix various pylint disable rules
* Fix --resource-type parsing for the lock command to accept <resource-namespace>/<resource-type>
diff --git a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_validators.py b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_validators.py
index fd6531210..c97a2867f 100644
--- a/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_validators.py
+++ b/src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/_validators.py
@@ -62,11 +62,11 @@ def validate_deployment_parameters(namespace):
parameters = {}
for params in namespace.parameters or []:
for item in params:
- if not _try_parse_key_value_object(parameters, item):
- param_obj = _try_load_file_object(item) or _try_parse_json_object(item)
- if not param_obj:
- raise CLIError('Unable to parse parameter: {}'.format(item))
+ param_obj = _try_load_file_object(item) or _try_parse_json_object(item)
+ if param_obj:
parameters.update(param_obj)
+ elif not _try_parse_key_value_object(parameters, item):
+ raise CLIError('Unable to parse parameter: {}'.format(item))
namespace.parameters = parameters
|
Parameters file values not being read during deployment create
### Description
When using `az group deployment create` with the newest version of the Azure CLI it no longer respects the `--parameters @<file>` contents and prompts me to type out each value in the command line.
Tested same template/parameters JSON files on another machine with an older version of Azure CLI without issue.
---
### Environment summary
**Install Method:** How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly)
Answer here: Linux install using curl -L <url> | bash
**CLI Version:** What version of the CLI and modules are installed? (Use `az --version`)
Answer here:
azure-cli (2.0.8)
acr (2.0.6)
acs (2.0.8)
appservice (0.1.8)
batch (3.0.1)
billing (0.1.1)
cdn (0.0.4)
cloud (2.0.4)
cognitiveservices (0.1.4)
command-modules-nspkg (2.0.0)
component (2.0.5)
configure (2.0.8)
consumption (0.1.1)
core (2.0.9)
cosmosdb (0.1.8)
dla (0.0.8)
dls (0.0.8)
feedback (2.0.4)
find (0.2.4)
interactive (0.3.4)
iot (0.1.7)
keyvault (2.0.6)
lab (0.0.6)
monitor (0.0.6)
network (2.0.8)
nspkg (3.0.0)
profile (2.0.6)
rdbms (0.0.3)
redis (0.2.5)
resource (2.0.8)
role (2.0.6)
sf (1.0.3)
sql (2.0.5)
storage (2.0.8)
vm (2.0.8)
Python (Linux) 2.7.5 (default, Feb 10 2017, 17:36:50)
[GCC 4.9.2 20141101 (Red Hat 4.9.2-1)]
Python location '/home/jayden/lib/azure-cli/bin/python'
**OS Version:** What OS and version are you using?
Answer here: Modified Fedora 18
**Shell Type:** What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
Answer here: bash
|
Azure/azure-cli
|
diff --git a/src/command_modules/azure-cli-resource/tests/recordings/latest/test_group_deployment.yaml b/src/command_modules/azure-cli-resource/tests/recordings/latest/test_group_deployment.yaml
index 5e8b598db..36ac195af 100644
--- a/src/command_modules/azure-cli-resource/tests/recordings/latest/test_group_deployment.yaml
+++ b/src/command_modules/azure-cli-resource/tests/recordings/latest/test_group_deployment.yaml
@@ -1,350 +1,1070 @@
interactions:
+- request:
+ body: '{"tags": {"use": "az-test"}, "location": "westus"}'
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group create]
+ Connection: [keep-alive]
+ Content-Length: ['50']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python
+ AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: PUT
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001?api-version=2017-05-10
+ response:
+ body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001","name":"cli_test_deployment000001","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['328']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:13 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ x-ms-ratelimit-remaining-subscription-writes: ['1198']
+ status: {code: 201, message: Created}
- request:
body: null
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
+ CommandName: [network vnet create]
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.7+dev]
+ AZURECLI/2.0.9+dev]
accept-language: [en-US]
- x-ms-client-request-id: [984358f0-4c90-11e7-8df4-a0b3ccf7272a]
method: GET
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/azure-cli-deployment-test?api-version=2017-05-10
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001?api-version=2017-05-10
response:
- body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test","name":"azure-cli-deployment-test","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'}
+ body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001","name":"cli_test_deployment000001","location":"westus","tags":{"use":"az-test"},"properties":{"provisioningState":"Succeeded"}}'}
headers:
- Cache-Control: [no-cache]
- Content-Type: [application/json; charset=utf-8]
- Date: ['Thu, 08 Jun 2017 21:22:36 GMT']
- Expires: ['-1']
- Pragma: [no-cache]
- Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- Vary: [Accept-Encoding]
- content-length: ['240']
+ cache-control: [no-cache]
+ content-length: ['328']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:14 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ vary: [Accept-Encoding]
status: {code: 200, message: OK}
- request:
- body: '{"location": "westus", "properties": {"dhcpOptions": {}, "subnets": [{"properties":
- {"addressPrefix": "10.0.0.0/24"}, "name": "subnet1"}], "addressSpace": {"addressPrefixes":
- ["10.0.0.0/16"]}}, "tags": {}}'
+ body: '{"tags": {}, "location": "westus", "properties": {"addressSpace": {"addressPrefixes":
+ ["10.0.0.0/16"]}, "dhcpOptions": {}, "subnets": [{"properties": {"addressPrefix":
+ "10.0.0.0/24"}, "name": "subnet1"}]}}'
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
+ CommandName: [network vnet create]
Connection: [keep-alive]
Content-Length: ['205']
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.7+dev]
+ AZURECLI/2.0.9+dev]
accept-language: [en-US]
- x-ms-client-request-id: [9864d83e-4c90-11e7-a276-a0b3ccf7272a]
method: PUT
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2017-03-01
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2017-03-01
response:
- body: {string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/virtualNetworks/vnet1\"\
- ,\r\n \"etag\": \"W/\\\"afaa273d-fae6-4176-8e47-5f3f865704fe\\\"\",\r\n \
+ body: {string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1\"\
+ ,\r\n \"etag\": \"W/\\\"2e8849fc-07a0-48ba-8b8a-b03fb20355de\\\"\",\r\n \
\ \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\"\
,\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\":\
- \ \"Updating\",\r\n \"resourceGuid\": \"240e9c40-73c7-4893-83a0-d30f69019829\"\
+ \ \"Updating\",\r\n \"resourceGuid\": \"d09ae1e7-9c02-4ca6-a4aa-e763eb6f73c1\"\
,\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"\
10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\"\
: []\r\n },\r\n \"subnets\": [\r\n {\r\n \"name\": \"subnet1\"\
- ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"\
- ,\r\n \"etag\": \"W/\\\"afaa273d-fae6-4176-8e47-5f3f865704fe\\\"\"\
+ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"\
+ ,\r\n \"etag\": \"W/\\\"2e8849fc-07a0-48ba-8b8a-b03fb20355de\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Updating\"\
,\r\n \"addressPrefix\": \"10.0.0.0/24\"\r\n }\r\n }\r\
\n ],\r\n \"virtualNetworkPeerings\": []\r\n }\r\n}"}
headers:
- Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/providers/Microsoft.Network/locations/westus/operations/8c6d54b6-72de-49cb-87be-4a6bb7702d08?api-version=2017-03-01']
- Cache-Control: [no-cache]
- Content-Length: ['1072']
- Content-Type: [application/json; charset=utf-8]
- Date: ['Thu, 08 Jun 2017 21:22:36 GMT']
- Expires: ['-1']
- Pragma: [no-cache]
- Retry-After: ['3']
- Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
- Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- x-ms-ratelimit-remaining-subscription-writes: ['1195']
+ azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/ad102992-75fc-4bfa-adfa-ced6b93b3a71?api-version=2017-03-01']
+ cache-control: [no-cache]
+ content-length: ['1160']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:14 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ retry-after: ['3']
+ server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ x-ms-ratelimit-remaining-subscription-writes: ['1199']
status: {code: 201, message: Created}
- request:
body: null
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
+ CommandName: [network vnet create]
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.7+dev]
+ AZURECLI/2.0.9+dev]
accept-language: [en-US]
- x-ms-client-request-id: [9864d83e-4c90-11e7-a276-a0b3ccf7272a]
method: GET
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/8c6d54b6-72de-49cb-87be-4a6bb7702d08?api-version=2017-03-01
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/westus/operations/ad102992-75fc-4bfa-adfa-ced6b93b3a71?api-version=2017-03-01
response:
body: {string: "{\r\n \"status\": \"Succeeded\"\r\n}"}
headers:
- Cache-Control: [no-cache]
- Content-Type: [application/json; charset=utf-8]
- Date: ['Thu, 08 Jun 2017 21:22:40 GMT']
- Expires: ['-1']
- Pragma: [no-cache]
- Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
- Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- Transfer-Encoding: [chunked]
- Vary: [Accept-Encoding]
+ cache-control: [no-cache]
content-length: ['29']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:17 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: [Accept-Encoding]
status: {code: 200, message: OK}
- request:
body: null
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
+ CommandName: [network vnet create]
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.7+dev]
+ AZURECLI/2.0.9+dev]
accept-language: [en-US]
- x-ms-client-request-id: [9864d83e-4c90-11e7-a276-a0b3ccf7272a]
method: GET
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2017-03-01
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1?api-version=2017-03-01
response:
- body: {string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/virtualNetworks/vnet1\"\
- ,\r\n \"etag\": \"W/\\\"8a5432ce-5584-4583-be8a-b322c796f079\\\"\",\r\n \
+ body: {string: "{\r\n \"name\": \"vnet1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1\"\
+ ,\r\n \"etag\": \"W/\\\"f3010535-1488-4c62-9947-dc69cccdd1c7\\\"\",\r\n \
\ \"type\": \"Microsoft.Network/virtualNetworks\",\r\n \"location\": \"westus\"\
,\r\n \"tags\": {},\r\n \"properties\": {\r\n \"provisioningState\":\
- \ \"Succeeded\",\r\n \"resourceGuid\": \"240e9c40-73c7-4893-83a0-d30f69019829\"\
+ \ \"Succeeded\",\r\n \"resourceGuid\": \"d09ae1e7-9c02-4ca6-a4aa-e763eb6f73c1\"\
,\r\n \"addressSpace\": {\r\n \"addressPrefixes\": [\r\n \"\
10.0.0.0/16\"\r\n ]\r\n },\r\n \"dhcpOptions\": {\r\n \"dnsServers\"\
: []\r\n },\r\n \"subnets\": [\r\n {\r\n \"name\": \"subnet1\"\
- ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"\
- ,\r\n \"etag\": \"W/\\\"8a5432ce-5584-4583-be8a-b322c796f079\\\"\"\
+ ,\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"\
+ ,\r\n \"etag\": \"W/\\\"f3010535-1488-4c62-9947-dc69cccdd1c7\\\"\"\
,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
,\r\n \"addressPrefix\": \"10.0.0.0/24\"\r\n }\r\n }\r\
\n ],\r\n \"virtualNetworkPeerings\": []\r\n }\r\n}"}
headers:
- Cache-Control: [no-cache]
- Content-Type: [application/json; charset=utf-8]
- Date: ['Thu, 08 Jun 2017 21:22:41 GMT']
- ETag: [W/"8a5432ce-5584-4583-be8a-b322c796f079"]
- Expires: ['-1']
- Pragma: [no-cache]
- Server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
- Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- Transfer-Encoding: [chunked]
- Vary: [Accept-Encoding]
- content-length: ['1074']
+ cache-control: [no-cache]
+ content-length: ['1162']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:17 GMT']
+ etag: [W/"f3010535-1488-4c62-9947-dc69cccdd1c7"]
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: [Accept-Encoding]
status: {code: 200, message: OK}
- request:
- body: '{"properties": {"mode": "Incremental", "template": {"resources": [{"dependsOn":
- [], "properties": {"backendAddressPools": "[parameters(''backendAddressPools'')]",
- "frontendIPConfigurations": [{"properties": {"privateIPAllocationMethod": "[parameters(''privateIPAllocationMethod'')]",
- "subnet": {"id": "[parameters(''subnetId'')]"}}, "name": "LoadBalancerFrontEnd"}]},
- "name": "[parameters(''name'')]", "location": "[parameters(''location'')]",
- "apiVersion": "2016-03-30", "type": "Microsoft.Network/loadBalancers"}], "contentVersion":
- "1.0.0.0", "parameters": {"location": {"type": "string"}, "privateIPAllocationMethod":
- {"type": "string"}, "backendAddressPools": {"type": "array"}, "name": {"type":
- "string"}, "subnetId": {"type": "string"}}, "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#"},
- "parameters": {"location": {"value": "westus"}, "privateIPAllocationMethod":
- {"value": "Dynamic"}, "backendAddressPools": {"value": [{"name": "bepool1"},
- {"name": "bepool2"}]}, "name": {"value": "test-lb"}, "subnetId": {"value": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"}}}}'
+ body: 'b''{"properties": {"template": {"contentVersion": "1.0.0.0", "parameters":
+ {"location": {"type": "string"}, "tags": {"type": "object"}, "privateIPAllocationMethod":
+ {"type": "string"}, "name": {"type": "string"}, "backendAddressPools": {"type":
+ "array"}, "subnetId": {"type": "string"}}, "resources": [{"dependsOn": [], "location":
+ "[parameters(\''location\'')]", "tags": "[parameters(\''tags\'')]", "name":
+ "[parameters(\''name\'')]", "properties": {"backendAddressPools": "[parameters(\''backendAddressPools\'')]",
+ "frontendIPConfigurations": [{"name": "LoadBalancerFrontEnd", "properties":
+ {"privateIPAllocationMethod": "[parameters(\''privateIPAllocationMethod\'')]",
+ "subnet": {"id": "[parameters(\''subnetId\'')]"}}}]}, "type": "Microsoft.Network/loadBalancers",
+ "apiVersion": "2016-03-30"}], "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#"},
+ "parameters": {"location": {"value": "westus"}, "tags": {"value": {"key": "super=value"}},
+ "privateIPAllocationMethod": {"value": "Dynamic"}, "name": {"value": "test-lb"},
+ "subnetId": {"value": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"},
+ "backendAddressPools": {"value": [{"name": "bepool1"}, {"name": "bepool2"}]}},
+ "mode": "Incremental"}}'''
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment validate]
Connection: [keep-alive]
- Content-Length: ['1228']
+ Content-Length: ['1375']
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.7+dev]
+ AZURECLI/2.0.9+dev]
accept-language: [en-US]
- x-ms-client-request-id: [9ad7925e-4c90-11e7-9479-a0b3ccf7272a]
method: POST
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/azure-cli-deployment-test/providers/Microsoft.Resources/deployments/mock-deployment/validate?api-version=2017-05-10
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/mock-deployment/validate?api-version=2017-05-10
response:
- body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Resources/deployments/deployment_dry_run","name":"deployment_dry_run","properties":{"templateHash":"18048340065001902796","parameters":{"location":{"type":"String","value":"westus"},"privateIPAllocationMethod":{"type":"String","value":"Dynamic"},"backendAddressPools":{"type":"Array","value":[{"name":"bepool1"},{"name":"bepool2"}]},"name":{"type":"String","value":"test-lb"},"subnetId":{"type":"String","value":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"}},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-06-08T21:22:42.0844954Z","duration":"PT0S","correlationId":"522bdd66-c165-41e3-8913-93f10b835055","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"loadBalancers","locations":["westus"]}]}],"dependencies":[],"validatedResources":[{"apiVersion":"2016-03-30","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/loadBalancers/test-lb","name":"test-lb","type":"Microsoft.Network/loadBalancers","location":"westus","properties":{"backendAddressPools":[{"name":"bepool1"},{"name":"bepool2"}],"frontendIPConfigurations":[{"properties":{"privateIPAllocationMethod":"Dynamic","subnet":{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"}},"name":"LoadBalancerFrontEnd"}]}}]}}'}
+ body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/deployment_dry_run","name":"deployment_dry_run","properties":{"templateHash":"6408713692666354622","parameters":{"location":{"type":"String","value":"westus"},"tags":{"type":"Object","value":{"key":"super=value"}},"privateIPAllocationMethod":{"type":"String","value":"Dynamic"},"name":{"type":"String","value":"test-lb"},"backendAddressPools":{"type":"Array","value":[{"name":"bepool1"},{"name":"bepool2"}]},"subnetId":{"type":"String","value":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"}},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-06-15T20:10:19.3122369Z","duration":"PT0S","correlationId":"d30de1dd-6b13-4d1c-843e-158c7ed0317c","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"loadBalancers","locations":["westus"]}]}],"dependencies":[],"validatedResources":[{"apiVersion":"2016-03-30","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","name":"test-lb","type":"Microsoft.Network/loadBalancers","location":"westus","tags":{"key":"super=value"},"properties":{"backendAddressPools":[{"name":"bepool1"},{"name":"bepool2"}],"frontendIPConfigurations":[{"name":"LoadBalancerFrontEnd","properties":{"privateIPAllocationMethod":"Dynamic","subnet":{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"}}}]}}]}}'}
headers:
- Cache-Control: [no-cache]
- Content-Type: [application/json; charset=utf-8]
- Date: ['Thu, 08 Jun 2017 21:22:41 GMT']
- Expires: ['-1']
- Pragma: [no-cache]
- Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- Transfer-Encoding: [chunked]
- Vary: [Accept-Encoding]
- content-length: ['1676']
- x-ms-ratelimit-remaining-subscription-writes: ['1195']
+ cache-control: [no-cache]
+ content-length: ['1935']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:19 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: [Accept-Encoding]
+ x-ms-ratelimit-remaining-subscription-writes: ['1198']
status: {code: 200, message: OK}
- request:
- body: '{"properties": {"mode": "Incremental", "template": {"resources": [{"dependsOn":
- [], "properties": {"backendAddressPools": "[parameters(''backendAddressPools'')]",
- "frontendIPConfigurations": [{"properties": {"privateIPAllocationMethod": "[parameters(''privateIPAllocationMethod'')]",
- "subnet": {"id": "[parameters(''subnetId'')]"}}, "name": "LoadBalancerFrontEnd"}]},
- "name": "[parameters(''name'')]", "location": "[parameters(''location'')]",
- "apiVersion": "2016-03-30", "type": "Microsoft.Network/loadBalancers"}], "contentVersion":
- "1.0.0.0", "parameters": {"location": {"type": "string"}, "privateIPAllocationMethod":
- {"type": "string"}, "backendAddressPools": {"type": "array"}, "name": {"type":
- "string"}, "subnetId": {"type": "string"}}, "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#"},
- "parameters": {"location": {"value": "westus"}, "privateIPAllocationMethod":
- {"value": "Dynamic"}, "backendAddressPools": {"value": [{"name": "bepool1"},
- {"name": "bepool2"}]}, "name": {"value": "test-lb"}, "subnetId": {"value": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"}}}}'
+ body: 'b''{"properties": {"template": {"contentVersion": "1.0.0.0", "parameters":
+ {"location": {"type": "string"}, "tags": {"type": "object"}, "privateIPAllocationMethod":
+ {"type": "string"}, "name": {"type": "string"}, "backendAddressPools": {"type":
+ "array"}, "subnetId": {"type": "string"}}, "resources": [{"dependsOn": [], "location":
+ "[parameters(\''location\'')]", "tags": "[parameters(\''tags\'')]", "name":
+ "[parameters(\''name\'')]", "properties": {"backendAddressPools": "[parameters(\''backendAddressPools\'')]",
+ "frontendIPConfigurations": [{"name": "LoadBalancerFrontEnd", "properties":
+ {"privateIPAllocationMethod": "[parameters(\''privateIPAllocationMethod\'')]",
+ "subnet": {"id": "[parameters(\''subnetId\'')]"}}}]}, "type": "Microsoft.Network/loadBalancers",
+ "apiVersion": "2016-03-30"}], "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#"},
+ "parameters": {"location": {"value": "westus"}, "tags": {"value": {"key": "super=value"}},
+ "privateIPAllocationMethod": {"value": "Dynamic"}, "name": {"value": "test-lb"},
+ "subnetId": {"value": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"},
+ "backendAddressPools": {"value": [{"name": "bepool1"}, {"name": "bepool2"}]}},
+ "mode": "Incremental"}}'''
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
Connection: [keep-alive]
- Content-Length: ['1228']
+ Content-Length: ['1375']
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.7+dev]
+ AZURECLI/2.0.9+dev]
accept-language: [en-US]
- x-ms-client-request-id: [9b58cf52-4c90-11e7-9b16-a0b3ccf7272a]
method: PUT
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/azure-cli-deployment-test/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2017-05-10
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2017-05-10
response:
- body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Resources/deployments/azure-cli-deployment","name":"azure-cli-deployment","properties":{"templateHash":"18048340065001902796","parameters":{"location":{"type":"String","value":"westus"},"privateIPAllocationMethod":{"type":"String","value":"Dynamic"},"backendAddressPools":{"type":"Array","value":[{"name":"bepool1"},{"name":"bepool2"}]},"name":{"type":"String","value":"test-lb"},"subnetId":{"type":"String","value":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"}},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2017-06-08T21:22:43.2188091Z","duration":"PT0.2770006S","correlationId":"c18f33be-ece9-4c12-96b9-eabd6fd111ff","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"loadBalancers","locations":["westus"]}]}],"dependencies":[]}}'}
+ body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","name":"azure-cli-deployment","properties":{"templateHash":"6408713692666354622","parameters":{"location":{"type":"String","value":"westus"},"tags":{"type":"Object","value":{"key":"super=value"}},"privateIPAllocationMethod":{"type":"String","value":"Dynamic"},"name":{"type":"String","value":"test-lb"},"backendAddressPools":{"type":"Array","value":[{"name":"bepool1"},{"name":"bepool2"}]},"subnetId":{"type":"String","value":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"}},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2017-06-15T20:10:20.2470721Z","duration":"PT0.2383683S","correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"loadBalancers","locations":["westus"]}]}],"dependencies":[]}}'}
headers:
- Azure-AsyncOperation: ['https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/azure-cli-deployment-test/providers/Microsoft.Resources/deployments/azure-cli-deployment/operationStatuses/08587046499225358060?api-version=2017-05-10']
- Cache-Control: [no-cache]
- Content-Length: ['1028']
- Content-Type: [application/json; charset=utf-8]
- Date: ['Thu, 08 Jun 2017 21:22:42 GMT']
- Expires: ['-1']
- Pragma: [no-cache]
- Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- x-ms-ratelimit-remaining-subscription-writes: ['1197']
+ azure-asyncoperation: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/operationStatuses/08587040494654689172?api-version=2017-05-10']
+ cache-control: [no-cache]
+ content-length: ['1170']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:19 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ x-ms-ratelimit-remaining-subscription-writes: ['1198']
status: {code: 201, message: Created}
- request:
body: null
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A20Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['12']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:20 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A22Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['12']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:22 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A23Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['12']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:24 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A25Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['12']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:25 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A27Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['12']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:26 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A28Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['12']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:28 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A30Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['12']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:30 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A31Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['12']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:31 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A33Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['12']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:33 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A35Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['12']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:34 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A36Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['12']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:36 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A38Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"89d46fa2-00f4-4e20-acb3-92aeac6f8d3e","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"a79b3190-5206-11e7-b4af-a0b3ccf7272a","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/89d46fa2-00f4-4e20-acb3-92aeac6f8d3e/ticks/636331542194986937","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"b8232cfd-5846-4949-a2b5-60475b16d780","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:19.4986937Z","submissionTimestamp":"2017-06-15T20:10:30.6284676Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"}]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['3477']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:38 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A39Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"89d46fa2-00f4-4e20-acb3-92aeac6f8d3e","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"a79b3190-5206-11e7-b4af-a0b3ccf7272a","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/89d46fa2-00f4-4e20-acb3-92aeac6f8d3e/ticks/636331542194986937","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"b8232cfd-5846-4949-a2b5-60475b16d780","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:19.4986937Z","submissionTimestamp":"2017-06-15T20:10:30.6284676Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"}]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['3477']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:39 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A41Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"74a75f6d-5f5d-4a25-99f5-34381d6dedae","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/74a75f6d-5f5d-4a25-99f5-34381d6dedae/ticks/636331542214496826","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"5504e6a1-ff15-47b0-8cb8-cf4cf0e4321a","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Succeeded","localizedValue":"Succeeded"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:21.4496826Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Network/loadBalancers/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"8c76c4e6-ab23-4f0f-9e72-45dcf55fbb95","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"f6b7e036-afe7-451f-8002-f7050a3f24c3","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/events/8c76c4e6-ab23-4f0f-9e72-45dcf55fbb95/ticks/636331542212153096","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Network","localizedValue":"Microsoft.Network"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":{"value":"Microsoft.Network/loadBalancers","localizedValue":"Microsoft.Network/loadBalancers"},"operationId":"739eb912-937c-4fed-a9be-2bb7934d4d41","operationName":{"value":"Microsoft.Network/loadBalancers/write","localizedValue":"Microsoft.Network/loadBalancers/write"},"properties":{"statusCode":"Created","serviceRequestId":"f01a0be4-f105-42e3-af90-e63ad09c45fb","responseBody":"{\"name\":\"test-lb\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"type\":\"Microsoft.Network/loadBalancers\",\"location\":\"westus\",\"tags\":{\"key\":\"super=value\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"resourceGuid\":\"5dfd3e9a-ce5b-431e-be12-87e156d8ea66\",\"frontendIPConfigurations\":[{\"name\":\"LoadBalancerFrontEnd\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/frontendIPConfigurations/LoadBalancerFrontEnd\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\",\"privateIPAddress\":\"10.0.0.4\",\"privateIPAllocationMethod\":\"Dynamic\",\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"}}}],\"backendAddressPools\":[{\"name\":\"bepool1\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool1\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\"}},{\"name\":\"bepool2\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool2\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\"}}],\"loadBalancingRules\":[],\"probes\":[],\"inboundNatRules\":[],\"outboundNatRules\":[],\"inboundNatPools\":[]}}"},"status":{"value":"Succeeded","localizedValue":"Succeeded"},"subStatus":{"value":"Created","localizedValue":"Created
+ (HTTP Status Code: 201)"},"eventTimestamp":"2017-06-15T20:10:21.2153096Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Network/loadBalancers/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"59544866-db93-4a1c-a670-4188f831748f","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"f6b7e036-afe7-451f-8002-f7050a3f24c3","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/events/59544866-db93-4a1c-a670-4188f831748f/ticks/636331542209653184","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Network","localizedValue":"Microsoft.Network"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":{"value":"Microsoft.Network/loadBalancers","localizedValue":"Microsoft.Network/loadBalancers"},"operationId":"739eb912-937c-4fed-a9be-2bb7934d4d41","operationName":{"value":"Microsoft.Network/loadBalancers/write","localizedValue":"Microsoft.Network/loadBalancers/write"},"properties":{"requestbody":"{\"location\":\"westus\",\"tags\":{\"key\":\"super=value\"},\"properties\":{\"backendAddressPools\":[{\"name\":\"bepool1\"},{\"name\":\"bepool2\"}],\"frontendIPConfigurations\":[{\"name\":\"LoadBalancerFrontEnd\",\"properties\":{\"privateIPAllocationMethod\":\"Dynamic\",\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"}}}]}}"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:20.9653184Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"89d46fa2-00f4-4e20-acb3-92aeac6f8d3e","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"a79b3190-5206-11e7-b4af-a0b3ccf7272a","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/89d46fa2-00f4-4e20-acb3-92aeac6f8d3e/ticks/636331542194986937","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"b8232cfd-5846-4949-a2b5-60475b16d780","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:19.4986937Z","submissionTimestamp":"2017-06-15T20:10:30.6284676Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"}]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['16465']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:41 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A42Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"74a75f6d-5f5d-4a25-99f5-34381d6dedae","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/74a75f6d-5f5d-4a25-99f5-34381d6dedae/ticks/636331542214496826","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"5504e6a1-ff15-47b0-8cb8-cf4cf0e4321a","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Succeeded","localizedValue":"Succeeded"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:21.4496826Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Network/loadBalancers/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"8c76c4e6-ab23-4f0f-9e72-45dcf55fbb95","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"f6b7e036-afe7-451f-8002-f7050a3f24c3","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/events/8c76c4e6-ab23-4f0f-9e72-45dcf55fbb95/ticks/636331542212153096","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Network","localizedValue":"Microsoft.Network"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":{"value":"Microsoft.Network/loadBalancers","localizedValue":"Microsoft.Network/loadBalancers"},"operationId":"739eb912-937c-4fed-a9be-2bb7934d4d41","operationName":{"value":"Microsoft.Network/loadBalancers/write","localizedValue":"Microsoft.Network/loadBalancers/write"},"properties":{"statusCode":"Created","serviceRequestId":"f01a0be4-f105-42e3-af90-e63ad09c45fb","responseBody":"{\"name\":\"test-lb\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"type\":\"Microsoft.Network/loadBalancers\",\"location\":\"westus\",\"tags\":{\"key\":\"super=value\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"resourceGuid\":\"5dfd3e9a-ce5b-431e-be12-87e156d8ea66\",\"frontendIPConfigurations\":[{\"name\":\"LoadBalancerFrontEnd\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/frontendIPConfigurations/LoadBalancerFrontEnd\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\",\"privateIPAddress\":\"10.0.0.4\",\"privateIPAllocationMethod\":\"Dynamic\",\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"}}}],\"backendAddressPools\":[{\"name\":\"bepool1\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool1\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\"}},{\"name\":\"bepool2\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool2\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\"}}],\"loadBalancingRules\":[],\"probes\":[],\"inboundNatRules\":[],\"outboundNatRules\":[],\"inboundNatPools\":[]}}"},"status":{"value":"Succeeded","localizedValue":"Succeeded"},"subStatus":{"value":"Created","localizedValue":"Created
+ (HTTP Status Code: 201)"},"eventTimestamp":"2017-06-15T20:10:21.2153096Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Network/loadBalancers/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"59544866-db93-4a1c-a670-4188f831748f","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"f6b7e036-afe7-451f-8002-f7050a3f24c3","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/events/59544866-db93-4a1c-a670-4188f831748f/ticks/636331542209653184","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Network","localizedValue":"Microsoft.Network"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":{"value":"Microsoft.Network/loadBalancers","localizedValue":"Microsoft.Network/loadBalancers"},"operationId":"739eb912-937c-4fed-a9be-2bb7934d4d41","operationName":{"value":"Microsoft.Network/loadBalancers/write","localizedValue":"Microsoft.Network/loadBalancers/write"},"properties":{"requestbody":"{\"location\":\"westus\",\"tags\":{\"key\":\"super=value\"},\"properties\":{\"backendAddressPools\":[{\"name\":\"bepool1\"},{\"name\":\"bepool2\"}],\"frontendIPConfigurations\":[{\"name\":\"LoadBalancerFrontEnd\",\"properties\":{\"privateIPAllocationMethod\":\"Dynamic\",\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"}}}]}}"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:20.9653184Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"89d46fa2-00f4-4e20-acb3-92aeac6f8d3e","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"a79b3190-5206-11e7-b4af-a0b3ccf7272a","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/89d46fa2-00f4-4e20-acb3-92aeac6f8d3e/ticks/636331542194986937","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"b8232cfd-5846-4949-a2b5-60475b16d780","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:19.4986937Z","submissionTimestamp":"2017-06-15T20:10:30.6284676Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"}]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['16465']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:43 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A44Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"74a75f6d-5f5d-4a25-99f5-34381d6dedae","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/74a75f6d-5f5d-4a25-99f5-34381d6dedae/ticks/636331542214496826","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"5504e6a1-ff15-47b0-8cb8-cf4cf0e4321a","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Succeeded","localizedValue":"Succeeded"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:21.4496826Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Network/loadBalancers/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"8c76c4e6-ab23-4f0f-9e72-45dcf55fbb95","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"f6b7e036-afe7-451f-8002-f7050a3f24c3","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/events/8c76c4e6-ab23-4f0f-9e72-45dcf55fbb95/ticks/636331542212153096","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Network","localizedValue":"Microsoft.Network"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":{"value":"Microsoft.Network/loadBalancers","localizedValue":"Microsoft.Network/loadBalancers"},"operationId":"739eb912-937c-4fed-a9be-2bb7934d4d41","operationName":{"value":"Microsoft.Network/loadBalancers/write","localizedValue":"Microsoft.Network/loadBalancers/write"},"properties":{"statusCode":"Created","serviceRequestId":"f01a0be4-f105-42e3-af90-e63ad09c45fb","responseBody":"{\"name\":\"test-lb\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"type\":\"Microsoft.Network/loadBalancers\",\"location\":\"westus\",\"tags\":{\"key\":\"super=value\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"resourceGuid\":\"5dfd3e9a-ce5b-431e-be12-87e156d8ea66\",\"frontendIPConfigurations\":[{\"name\":\"LoadBalancerFrontEnd\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/frontendIPConfigurations/LoadBalancerFrontEnd\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\",\"privateIPAddress\":\"10.0.0.4\",\"privateIPAllocationMethod\":\"Dynamic\",\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"}}}],\"backendAddressPools\":[{\"name\":\"bepool1\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool1\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\"}},{\"name\":\"bepool2\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool2\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\"}}],\"loadBalancingRules\":[],\"probes\":[],\"inboundNatRules\":[],\"outboundNatRules\":[],\"inboundNatPools\":[]}}"},"status":{"value":"Succeeded","localizedValue":"Succeeded"},"subStatus":{"value":"Created","localizedValue":"Created
+ (HTTP Status Code: 201)"},"eventTimestamp":"2017-06-15T20:10:21.2153096Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Network/loadBalancers/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"59544866-db93-4a1c-a670-4188f831748f","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"f6b7e036-afe7-451f-8002-f7050a3f24c3","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/events/59544866-db93-4a1c-a670-4188f831748f/ticks/636331542209653184","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Network","localizedValue":"Microsoft.Network"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":{"value":"Microsoft.Network/loadBalancers","localizedValue":"Microsoft.Network/loadBalancers"},"operationId":"739eb912-937c-4fed-a9be-2bb7934d4d41","operationName":{"value":"Microsoft.Network/loadBalancers/write","localizedValue":"Microsoft.Network/loadBalancers/write"},"properties":{"requestbody":"{\"location\":\"westus\",\"tags\":{\"key\":\"super=value\"},\"properties\":{\"backendAddressPools\":[{\"name\":\"bepool1\"},{\"name\":\"bepool2\"}],\"frontendIPConfigurations\":[{\"name\":\"LoadBalancerFrontEnd\",\"properties\":{\"privateIPAllocationMethod\":\"Dynamic\",\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"}}}]}}"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:20.9653184Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"b73560a9-5d20-4dce-8bdf-538b84e5aea1","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"a79b3190-5206-11e7-b4af-a0b3ccf7272a","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/b73560a9-5d20-4dce-8bdf-538b84e5aea1/ticks/636331542203426587","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"b8232cfd-5846-4949-a2b5-60475b16d780","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"properties":{"statusCode":"Created","serviceRequestId":null},"status":{"value":"Accepted","localizedValue":"Accepted"},"subStatus":{"value":"Created","localizedValue":"Created
+ (HTTP Status Code: 201)"},"eventTimestamp":"2017-06-15T20:10:20.3426587Z","submissionTimestamp":"2017-06-15T20:10:41.3300109Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"89d46fa2-00f4-4e20-acb3-92aeac6f8d3e","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"a79b3190-5206-11e7-b4af-a0b3ccf7272a","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/89d46fa2-00f4-4e20-acb3-92aeac6f8d3e/ticks/636331542194986937","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"b8232cfd-5846-4949-a2b5-60475b16d780","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:19.4986937Z","submissionTimestamp":"2017-06-15T20:10:30.6284676Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"}]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['20029']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:43 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A45Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"74a75f6d-5f5d-4a25-99f5-34381d6dedae","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/74a75f6d-5f5d-4a25-99f5-34381d6dedae/ticks/636331542214496826","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"5504e6a1-ff15-47b0-8cb8-cf4cf0e4321a","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Succeeded","localizedValue":"Succeeded"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:21.4496826Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Network/loadBalancers/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"8c76c4e6-ab23-4f0f-9e72-45dcf55fbb95","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"f6b7e036-afe7-451f-8002-f7050a3f24c3","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/events/8c76c4e6-ab23-4f0f-9e72-45dcf55fbb95/ticks/636331542212153096","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Network","localizedValue":"Microsoft.Network"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":{"value":"Microsoft.Network/loadBalancers","localizedValue":"Microsoft.Network/loadBalancers"},"operationId":"739eb912-937c-4fed-a9be-2bb7934d4d41","operationName":{"value":"Microsoft.Network/loadBalancers/write","localizedValue":"Microsoft.Network/loadBalancers/write"},"properties":{"statusCode":"Created","serviceRequestId":"f01a0be4-f105-42e3-af90-e63ad09c45fb","responseBody":"{\"name\":\"test-lb\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"type\":\"Microsoft.Network/loadBalancers\",\"location\":\"westus\",\"tags\":{\"key\":\"super=value\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"resourceGuid\":\"5dfd3e9a-ce5b-431e-be12-87e156d8ea66\",\"frontendIPConfigurations\":[{\"name\":\"LoadBalancerFrontEnd\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/frontendIPConfigurations/LoadBalancerFrontEnd\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\",\"privateIPAddress\":\"10.0.0.4\",\"privateIPAllocationMethod\":\"Dynamic\",\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"}}}],\"backendAddressPools\":[{\"name\":\"bepool1\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool1\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\"}},{\"name\":\"bepool2\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool2\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\"}}],\"loadBalancingRules\":[],\"probes\":[],\"inboundNatRules\":[],\"outboundNatRules\":[],\"inboundNatPools\":[]}}"},"status":{"value":"Succeeded","localizedValue":"Succeeded"},"subStatus":{"value":"Created","localizedValue":"Created
+ (HTTP Status Code: 201)"},"eventTimestamp":"2017-06-15T20:10:21.2153096Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Network/loadBalancers/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"59544866-db93-4a1c-a670-4188f831748f","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"f6b7e036-afe7-451f-8002-f7050a3f24c3","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/events/59544866-db93-4a1c-a670-4188f831748f/ticks/636331542209653184","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Network","localizedValue":"Microsoft.Network"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":{"value":"Microsoft.Network/loadBalancers","localizedValue":"Microsoft.Network/loadBalancers"},"operationId":"739eb912-937c-4fed-a9be-2bb7934d4d41","operationName":{"value":"Microsoft.Network/loadBalancers/write","localizedValue":"Microsoft.Network/loadBalancers/write"},"properties":{"requestbody":"{\"location\":\"westus\",\"tags\":{\"key\":\"super=value\"},\"properties\":{\"backendAddressPools\":[{\"name\":\"bepool1\"},{\"name\":\"bepool2\"}],\"frontendIPConfigurations\":[{\"name\":\"LoadBalancerFrontEnd\",\"properties\":{\"privateIPAllocationMethod\":\"Dynamic\",\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"}}}]}}"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:20.9653184Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"b73560a9-5d20-4dce-8bdf-538b84e5aea1","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"a79b3190-5206-11e7-b4af-a0b3ccf7272a","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/b73560a9-5d20-4dce-8bdf-538b84e5aea1/ticks/636331542203426587","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"b8232cfd-5846-4949-a2b5-60475b16d780","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"properties":{"statusCode":"Created","serviceRequestId":null},"status":{"value":"Accepted","localizedValue":"Accepted"},"subStatus":{"value":"Created","localizedValue":"Created
+ (HTTP Status Code: 201)"},"eventTimestamp":"2017-06-15T20:10:20.3426587Z","submissionTimestamp":"2017-06-15T20:10:41.3300109Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"89d46fa2-00f4-4e20-acb3-92aeac6f8d3e","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"a79b3190-5206-11e7-b4af-a0b3ccf7272a","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/89d46fa2-00f4-4e20-acb3-92aeac6f8d3e/ticks/636331542194986937","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"b8232cfd-5846-4949-a2b5-60475b16d780","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:19.4986937Z","submissionTimestamp":"2017-06-15T20:10:30.6284676Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"}]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['20029']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:44 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A46Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"74a75f6d-5f5d-4a25-99f5-34381d6dedae","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/74a75f6d-5f5d-4a25-99f5-34381d6dedae/ticks/636331542214496826","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"5504e6a1-ff15-47b0-8cb8-cf4cf0e4321a","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Succeeded","localizedValue":"Succeeded"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:21.4496826Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Network/loadBalancers/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"8c76c4e6-ab23-4f0f-9e72-45dcf55fbb95","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"f6b7e036-afe7-451f-8002-f7050a3f24c3","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/events/8c76c4e6-ab23-4f0f-9e72-45dcf55fbb95/ticks/636331542212153096","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Network","localizedValue":"Microsoft.Network"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":{"value":"Microsoft.Network/loadBalancers","localizedValue":"Microsoft.Network/loadBalancers"},"operationId":"739eb912-937c-4fed-a9be-2bb7934d4d41","operationName":{"value":"Microsoft.Network/loadBalancers/write","localizedValue":"Microsoft.Network/loadBalancers/write"},"properties":{"statusCode":"Created","serviceRequestId":"f01a0be4-f105-42e3-af90-e63ad09c45fb","responseBody":"{\"name\":\"test-lb\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"type\":\"Microsoft.Network/loadBalancers\",\"location\":\"westus\",\"tags\":{\"key\":\"super=value\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"resourceGuid\":\"5dfd3e9a-ce5b-431e-be12-87e156d8ea66\",\"frontendIPConfigurations\":[{\"name\":\"LoadBalancerFrontEnd\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/frontendIPConfigurations/LoadBalancerFrontEnd\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\",\"privateIPAddress\":\"10.0.0.4\",\"privateIPAllocationMethod\":\"Dynamic\",\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"}}}],\"backendAddressPools\":[{\"name\":\"bepool1\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool1\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\"}},{\"name\":\"bepool2\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool2\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\"}}],\"loadBalancingRules\":[],\"probes\":[],\"inboundNatRules\":[],\"outboundNatRules\":[],\"inboundNatPools\":[]}}"},"status":{"value":"Succeeded","localizedValue":"Succeeded"},"subStatus":{"value":"Created","localizedValue":"Created
+ (HTTP Status Code: 201)"},"eventTimestamp":"2017-06-15T20:10:21.2153096Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Network/loadBalancers/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"59544866-db93-4a1c-a670-4188f831748f","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"f6b7e036-afe7-451f-8002-f7050a3f24c3","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/events/59544866-db93-4a1c-a670-4188f831748f/ticks/636331542209653184","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Network","localizedValue":"Microsoft.Network"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":{"value":"Microsoft.Network/loadBalancers","localizedValue":"Microsoft.Network/loadBalancers"},"operationId":"739eb912-937c-4fed-a9be-2bb7934d4d41","operationName":{"value":"Microsoft.Network/loadBalancers/write","localizedValue":"Microsoft.Network/loadBalancers/write"},"properties":{"requestbody":"{\"location\":\"westus\",\"tags\":{\"key\":\"super=value\"},\"properties\":{\"backendAddressPools\":[{\"name\":\"bepool1\"},{\"name\":\"bepool2\"}],\"frontendIPConfigurations\":[{\"name\":\"LoadBalancerFrontEnd\",\"properties\":{\"privateIPAllocationMethod\":\"Dynamic\",\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"}}}]}}"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:20.9653184Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"b73560a9-5d20-4dce-8bdf-538b84e5aea1","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"a79b3190-5206-11e7-b4af-a0b3ccf7272a","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/b73560a9-5d20-4dce-8bdf-538b84e5aea1/ticks/636331542203426587","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"b8232cfd-5846-4949-a2b5-60475b16d780","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"properties":{"statusCode":"Created","serviceRequestId":null},"status":{"value":"Accepted","localizedValue":"Accepted"},"subStatus":{"value":"Created","localizedValue":"Created
+ (HTTP Status Code: 201)"},"eventTimestamp":"2017-06-15T20:10:20.3426587Z","submissionTimestamp":"2017-06-15T20:10:41.3300109Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"89d46fa2-00f4-4e20-acb3-92aeac6f8d3e","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"a79b3190-5206-11e7-b4af-a0b3ccf7272a","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/89d46fa2-00f4-4e20-acb3-92aeac6f8d3e/ticks/636331542194986937","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"b8232cfd-5846-4949-a2b5-60475b16d780","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:19.4986937Z","submissionTimestamp":"2017-06-15T20:10:30.6284676Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"}]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['20029']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:47 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A48Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"74a75f6d-5f5d-4a25-99f5-34381d6dedae","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/74a75f6d-5f5d-4a25-99f5-34381d6dedae/ticks/636331542214496826","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"5504e6a1-ff15-47b0-8cb8-cf4cf0e4321a","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Succeeded","localizedValue":"Succeeded"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:21.4496826Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Network/loadBalancers/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"8c76c4e6-ab23-4f0f-9e72-45dcf55fbb95","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"f6b7e036-afe7-451f-8002-f7050a3f24c3","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/events/8c76c4e6-ab23-4f0f-9e72-45dcf55fbb95/ticks/636331542212153096","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Network","localizedValue":"Microsoft.Network"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":{"value":"Microsoft.Network/loadBalancers","localizedValue":"Microsoft.Network/loadBalancers"},"operationId":"739eb912-937c-4fed-a9be-2bb7934d4d41","operationName":{"value":"Microsoft.Network/loadBalancers/write","localizedValue":"Microsoft.Network/loadBalancers/write"},"properties":{"statusCode":"Created","serviceRequestId":"f01a0be4-f105-42e3-af90-e63ad09c45fb","responseBody":"{\"name\":\"test-lb\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"type\":\"Microsoft.Network/loadBalancers\",\"location\":\"westus\",\"tags\":{\"key\":\"super=value\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"resourceGuid\":\"5dfd3e9a-ce5b-431e-be12-87e156d8ea66\",\"frontendIPConfigurations\":[{\"name\":\"LoadBalancerFrontEnd\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/frontendIPConfigurations/LoadBalancerFrontEnd\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\",\"privateIPAddress\":\"10.0.0.4\",\"privateIPAllocationMethod\":\"Dynamic\",\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"}}}],\"backendAddressPools\":[{\"name\":\"bepool1\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool1\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\"}},{\"name\":\"bepool2\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool2\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\"}}],\"loadBalancingRules\":[],\"probes\":[],\"inboundNatRules\":[],\"outboundNatRules\":[],\"inboundNatPools\":[]}}"},"status":{"value":"Succeeded","localizedValue":"Succeeded"},"subStatus":{"value":"Created","localizedValue":"Created
+ (HTTP Status Code: 201)"},"eventTimestamp":"2017-06-15T20:10:21.2153096Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Network/loadBalancers/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"59544866-db93-4a1c-a670-4188f831748f","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"f6b7e036-afe7-451f-8002-f7050a3f24c3","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/events/59544866-db93-4a1c-a670-4188f831748f/ticks/636331542209653184","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Network","localizedValue":"Microsoft.Network"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":{"value":"Microsoft.Network/loadBalancers","localizedValue":"Microsoft.Network/loadBalancers"},"operationId":"739eb912-937c-4fed-a9be-2bb7934d4d41","operationName":{"value":"Microsoft.Network/loadBalancers/write","localizedValue":"Microsoft.Network/loadBalancers/write"},"properties":{"requestbody":"{\"location\":\"westus\",\"tags\":{\"key\":\"super=value\"},\"properties\":{\"backendAddressPools\":[{\"name\":\"bepool1\"},{\"name\":\"bepool2\"}],\"frontendIPConfigurations\":[{\"name\":\"LoadBalancerFrontEnd\",\"properties\":{\"privateIPAllocationMethod\":\"Dynamic\",\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"}}}]}}"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:20.9653184Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"b73560a9-5d20-4dce-8bdf-538b84e5aea1","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"a79b3190-5206-11e7-b4af-a0b3ccf7272a","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/b73560a9-5d20-4dce-8bdf-538b84e5aea1/ticks/636331542203426587","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"b8232cfd-5846-4949-a2b5-60475b16d780","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"properties":{"statusCode":"Created","serviceRequestId":null},"status":{"value":"Accepted","localizedValue":"Accepted"},"subStatus":{"value":"Created","localizedValue":"Created
+ (HTTP Status Code: 201)"},"eventTimestamp":"2017-06-15T20:10:20.3426587Z","submissionTimestamp":"2017-06-15T20:10:41.3300109Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"89d46fa2-00f4-4e20-acb3-92aeac6f8d3e","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"a79b3190-5206-11e7-b4af-a0b3ccf7272a","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/89d46fa2-00f4-4e20-acb3-92aeac6f8d3e/ticks/636331542194986937","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"b8232cfd-5846-4949-a2b5-60475b16d780","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:19.4986937Z","submissionTimestamp":"2017-06-15T20:10:30.6284676Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"}]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['20029']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:48 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
+ Connection: [keep-alive]
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 monitorclient/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.insights/eventtypes/management/values?$filter=eventTimestamp%20ge%202017-05-05T04%3A10%3A49Z%20and%20correlationId%20eq%20%27b8232cfd-5846-4949-a2b5-60475b16d780%27&api-version=2015-04-01
+ response:
+ body: {string: '{"value":[{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"74a75f6d-5f5d-4a25-99f5-34381d6dedae","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/74a75f6d-5f5d-4a25-99f5-34381d6dedae/ticks/636331542214496826","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"5504e6a1-ff15-47b0-8cb8-cf4cf0e4321a","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Succeeded","localizedValue":"Succeeded"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:21.4496826Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Network/loadBalancers/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"8c76c4e6-ab23-4f0f-9e72-45dcf55fbb95","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"f6b7e036-afe7-451f-8002-f7050a3f24c3","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/events/8c76c4e6-ab23-4f0f-9e72-45dcf55fbb95/ticks/636331542212153096","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Network","localizedValue":"Microsoft.Network"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":{"value":"Microsoft.Network/loadBalancers","localizedValue":"Microsoft.Network/loadBalancers"},"operationId":"739eb912-937c-4fed-a9be-2bb7934d4d41","operationName":{"value":"Microsoft.Network/loadBalancers/write","localizedValue":"Microsoft.Network/loadBalancers/write"},"properties":{"statusCode":"Created","serviceRequestId":"f01a0be4-f105-42e3-af90-e63ad09c45fb","responseBody":"{\"name\":\"test-lb\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"type\":\"Microsoft.Network/loadBalancers\",\"location\":\"westus\",\"tags\":{\"key\":\"super=value\"},\"properties\":{\"provisioningState\":\"Succeeded\",\"resourceGuid\":\"5dfd3e9a-ce5b-431e-be12-87e156d8ea66\",\"frontendIPConfigurations\":[{\"name\":\"LoadBalancerFrontEnd\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/frontendIPConfigurations/LoadBalancerFrontEnd\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\",\"privateIPAddress\":\"10.0.0.4\",\"privateIPAllocationMethod\":\"Dynamic\",\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"}}}],\"backendAddressPools\":[{\"name\":\"bepool1\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool1\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\"}},{\"name\":\"bepool2\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool2\",\"etag\":\"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\"properties\":{\"provisioningState\":\"Succeeded\"}}],\"loadBalancingRules\":[],\"probes\":[],\"inboundNatRules\":[],\"outboundNatRules\":[],\"inboundNatPools\":[]}}"},"status":{"value":"Succeeded","localizedValue":"Succeeded"},"subStatus":{"value":"Created","localizedValue":"Created
+ (HTTP Status Code: 201)"},"eventTimestamp":"2017-06-15T20:10:21.2153096Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Network/loadBalancers/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"59544866-db93-4a1c-a670-4188f831748f","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"f6b7e036-afe7-451f-8002-f7050a3f24c3","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/events/59544866-db93-4a1c-a670-4188f831748f/ticks/636331542209653184","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Network","localizedValue":"Microsoft.Network"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":{"value":"Microsoft.Network/loadBalancers","localizedValue":"Microsoft.Network/loadBalancers"},"operationId":"739eb912-937c-4fed-a9be-2bb7934d4d41","operationName":{"value":"Microsoft.Network/loadBalancers/write","localizedValue":"Microsoft.Network/loadBalancers/write"},"properties":{"requestbody":"{\"location\":\"westus\",\"tags\":{\"key\":\"super=value\"},\"properties\":{\"backendAddressPools\":[{\"name\":\"bepool1\"},{\"name\":\"bepool2\"}],\"frontendIPConfigurations\":[{\"name\":\"LoadBalancerFrontEnd\",\"properties\":{\"privateIPAllocationMethod\":\"Dynamic\",\"subnet\":{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"}}}]}}"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:20.9653184Z","submissionTimestamp":"2017-06-15T20:10:40.24568Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"b73560a9-5d20-4dce-8bdf-538b84e5aea1","eventName":{"value":"EndRequest","localizedValue":"End
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"a79b3190-5206-11e7-b4af-a0b3ccf7272a","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/b73560a9-5d20-4dce-8bdf-538b84e5aea1/ticks/636331542203426587","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"b8232cfd-5846-4949-a2b5-60475b16d780","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"properties":{"statusCode":"Created","serviceRequestId":null},"status":{"value":"Accepted","localizedValue":"Accepted"},"subStatus":{"value":"Created","localizedValue":"Created
+ (HTTP Status Code: 201)"},"eventTimestamp":"2017-06-15T20:10:20.3426587Z","submissionTimestamp":"2017-06-15T20:10:41.3300109Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"},{"authorization":{"action":"Microsoft.Resources/deployments/write","scope":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment"},"caller":"[email protected]","channels":"Operation","claims":{"aud":"https://management.core.windows.net/","iss":"https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7b93a3e9c5a/","iat":"1497556604","nbf":"1497556604","exp":"1497560504","http://schemas.microsoft.com/claims/authnclassreference":"1","aio":"Y2ZgYHCpMd2zJSHh9sHaqmOLfZk6DMyjWdwmHe1d2/0hNSkhmAkA","http://schemas.microsoft.com/claims/authnmethodsreferences":"pwd","appid":"04b07795-8ddb-461a-bbee-02f9e1bf7b46","appidacr":"0","e_exp":"262800","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname":"Admin2","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname":"Admin2","groups":"e4bb0b56-1014-40f8-88ab-3d8a8cb0e086,d758a069-52cc-47f6-bc00-961cea17be39","ipaddr":"167.220.0.229","name":"Admin2","http://schemas.microsoft.com/identity/claims/objectidentifier":"5963f50c-7c43-405c-af7e-53294de76abd","platf":"14","puid":"1003BFFD959F8423","http://schemas.microsoft.com/identity/claims/scope":"user_impersonation","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier":"sDgexRwCNIfY-hzQjjCDvZT7Izdfo4Syrr4x0dDNzR4","http://schemas.microsoft.com/identity/claims/tenantid":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name":"[email protected]","http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]","ver":"1.0","wids":"62e90394-69f5-4237-9190-012177145e10"},"correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","description":"","eventDataId":"89d46fa2-00f4-4e20-acb3-92aeac6f8d3e","eventName":{"value":"BeginRequest","localizedValue":"Begin
+ request"},"category":{"value":"Administrative","localizedValue":"Administrative"},"httpRequest":{"clientRequestId":"a79b3190-5206-11e7-b4af-a0b3ccf7272a","clientIpAddress":"167.220.1.229","method":"PUT"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/events/89d46fa2-00f4-4e20-acb3-92aeac6f8d3e/ticks/636331542194986937","level":"Informational","resourceGroupName":"cli_test_deployment000001","resourceProviderName":{"value":"Microsoft.Resources","localizedValue":"Microsoft
+ Resources"},"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","resourceType":{"value":"Microsoft.Resources/deployments","localizedValue":"Microsoft.Resources/deployments"},"operationId":"b8232cfd-5846-4949-a2b5-60475b16d780","operationName":{"value":"Microsoft.Resources/deployments/write","localizedValue":"Microsoft.Resources/deployments/write"},"status":{"value":"Started","localizedValue":"Started"},"subStatus":{"value":"","localizedValue":""},"eventTimestamp":"2017-06-15T20:10:19.4986937Z","submissionTimestamp":"2017-06-15T20:10:30.6284676Z","subscriptionId":"0b1f6471-1bf0-4dda-aec3-cb9272f09590","tenantId":"54826b22-38d6-4fb2-bad9-b7b93a3e9c5a"}]}'}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['20029']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:49 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-IIS/8.5]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: ['Accept-Encoding,Accept-Encoding']
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.7+dev]
+ AZURECLI/2.0.9+dev]
accept-language: [en-US]
- x-ms-client-request-id: [9b58cf52-4c90-11e7-9b16-a0b3ccf7272a]
method: GET
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/azure-cli-deployment-test/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587046499225358060?api-version=2017-05-10
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/mock-deployment/operationStatuses/08587040494654689172?api-version=2017-05-10
response:
body: {string: '{"status":"Succeeded"}'}
headers:
- Cache-Control: [no-cache]
- Content-Type: [application/json; charset=utf-8]
- Date: ['Thu, 08 Jun 2017 21:23:13 GMT']
- Expires: ['-1']
- Pragma: [no-cache]
- Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- Vary: [Accept-Encoding]
+ cache-control: [no-cache]
content-length: ['22']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:49 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ vary: [Accept-Encoding]
status: {code: 200, message: OK}
- request:
body: null
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment create]
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.7+dev]
+ AZURECLI/2.0.9+dev]
accept-language: [en-US]
- x-ms-client-request-id: [9b58cf52-4c90-11e7-9b16-a0b3ccf7272a]
method: GET
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/azure-cli-deployment-test/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2017-05-10
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2017-05-10
response:
- body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Resources/deployments/azure-cli-deployment","name":"azure-cli-deployment","properties":{"templateHash":"18048340065001902796","parameters":{"location":{"type":"String","value":"westus"},"privateIPAllocationMethod":{"type":"String","value":"Dynamic"},"backendAddressPools":{"type":"Array","value":[{"name":"bepool1"},{"name":"bepool2"}]},"name":{"type":"String","value":"test-lb"},"subnetId":{"type":"String","value":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"}},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-06-08T21:22:51.7379575Z","duration":"PT8.796149S","correlationId":"c18f33be-ece9-4c12-96b9-eabd6fd111ff","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"loadBalancers","locations":["westus"]}]}],"dependencies":[],"outputResources":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/loadBalancers/test-lb"}]}}'}
+ body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","name":"azure-cli-deployment","properties":{"templateHash":"6408713692666354622","parameters":{"location":{"type":"String","value":"westus"},"tags":{"type":"Object","value":{"key":"super=value"}},"privateIPAllocationMethod":{"type":"String","value":"Dynamic"},"name":{"type":"String","value":"test-lb"},"backendAddressPools":{"type":"Array","value":[{"name":"bepool1"},{"name":"bepool2"}]},"subnetId":{"type":"String","value":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"}},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-06-15T20:10:21.4099596Z","duration":"PT1.4012558S","correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"loadBalancers","locations":["westus"]}]}],"dependencies":[],"outputResources":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"}]}}'}
headers:
- Cache-Control: [no-cache]
+ cache-control: [no-cache]
+ content-length: ['1393']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:50 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ vary: [Accept-Encoding]
+ status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [network lb show]
+ Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
- Date: ['Thu, 08 Jun 2017 21:23:13 GMT']
- Expires: ['-1']
- Pragma: [no-cache]
- Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- Vary: [Accept-Encoding]
- content-length: ['1206']
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 networkmanagementclient/1.0.0rc3 Azure-SDK-For-Python
+ AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: GET
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb?api-version=2017-03-01
+ response:
+ body: {string: "{\r\n \"name\": \"test-lb\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb\"\
+ ,\r\n \"etag\": \"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\",\r\n \
+ \ \"type\": \"Microsoft.Network/loadBalancers\",\r\n \"location\": \"westus\"\
+ ,\r\n \"tags\": {\r\n \"key\": \"super=value\"\r\n },\r\n \"properties\"\
+ : {\r\n \"provisioningState\": \"Succeeded\",\r\n \"resourceGuid\":\
+ \ \"5dfd3e9a-ce5b-431e-be12-87e156d8ea66\",\r\n \"frontendIPConfigurations\"\
+ : [\r\n {\r\n \"name\": \"LoadBalancerFrontEnd\",\r\n \"\
+ id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/frontendIPConfigurations/LoadBalancerFrontEnd\"\
+ ,\r\n \"etag\": \"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ ,\r\n \"privateIPAddress\": \"10.0.0.4\",\r\n \"privateIPAllocationMethod\"\
+ : \"Dynamic\",\r\n \"subnet\": {\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1\"\
+ \r\n }\r\n }\r\n }\r\n ],\r\n \"backendAddressPools\"\
+ : [\r\n {\r\n \"name\": \"bepool1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool1\"\
+ ,\r\n \"etag\": \"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ \r\n }\r\n },\r\n {\r\n \"name\": \"bepool2\",\r\n\
+ \ \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb/backendAddressPools/bepool2\"\
+ ,\r\n \"etag\": \"W/\\\"deb1081f-8468-4ee2-89a3-00e28114da5d\\\"\"\
+ ,\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\
+ \r\n }\r\n }\r\n ],\r\n \"loadBalancingRules\": [],\r\n\
+ \ \"probes\": [],\r\n \"inboundNatRules\": [],\r\n \"outboundNatRules\"\
+ : [],\r\n \"inboundNatPools\": []\r\n }\r\n}"}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['2420']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:50 GMT']
+ etag: [W/"deb1081f-8468-4ee2-89a3-00e28114da5d"]
+ expires: ['-1']
+ pragma: [no-cache]
+ server: [Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ transfer-encoding: [chunked]
+ vary: [Accept-Encoding]
status: {code: 200, message: OK}
- request:
body: null
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment list]
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.7+dev]
+ AZURECLI/2.0.9+dev]
accept-language: [en-US]
- x-ms-client-request-id: [ae78895c-4c90-11e7-adda-a0b3ccf7272a]
method: GET
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/azure-cli-deployment-test/providers/Microsoft.Resources/deployments/?api-version=2017-05-10
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/?api-version=2017-05-10
response:
- body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Resources/deployments/azure-cli-deployment","name":"azure-cli-deployment","properties":{"templateHash":"18048340065001902796","parameters":{"location":{"type":"String","value":"westus"},"privateIPAllocationMethod":{"type":"String","value":"Dynamic"},"backendAddressPools":{"type":"Array","value":[{"name":"bepool1"},{"name":"bepool2"}]},"name":{"type":"String","value":"test-lb"},"subnetId":{"type":"String","value":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"}},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-06-08T21:22:51.7379575Z","duration":"PT8.796149S","correlationId":"c18f33be-ece9-4c12-96b9-eabd6fd111ff","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"loadBalancers","locations":["westus"]}]}],"dependencies":[],"outputResources":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/loadBalancers/test-lb"}]}}]}'}
+ body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","name":"azure-cli-deployment","properties":{"templateHash":"6408713692666354622","parameters":{"location":{"type":"String","value":"westus"},"tags":{"type":"Object","value":{"key":"super=value"}},"privateIPAllocationMethod":{"type":"String","value":"Dynamic"},"name":{"type":"String","value":"test-lb"},"backendAddressPools":{"type":"Array","value":[{"name":"bepool1"},{"name":"bepool2"}]},"subnetId":{"type":"String","value":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"}},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-06-15T20:10:21.4099596Z","duration":"PT1.4012558S","correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"loadBalancers","locations":["westus"]}]}],"dependencies":[],"outputResources":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"}]}}]}'}
headers:
- Cache-Control: [no-cache]
- Content-Type: [application/json; charset=utf-8]
- Date: ['Thu, 08 Jun 2017 21:23:14 GMT']
- Expires: ['-1']
- Pragma: [no-cache]
- Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- Vary: [Accept-Encoding]
- content-length: ['1218']
+ cache-control: [no-cache]
+ content-length: ['1405']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:50 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ vary: [Accept-Encoding]
status: {code: 200, message: OK}
- request:
body: null
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment show]
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.7+dev]
+ AZURECLI/2.0.9+dev]
accept-language: [en-US]
- x-ms-client-request-id: [aeb3b476-4c90-11e7-ba4f-a0b3ccf7272a]
method: GET
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/azure-cli-deployment-test/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2017-05-10
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/mock-deployment?api-version=2017-05-10
response:
- body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Resources/deployments/azure-cli-deployment","name":"azure-cli-deployment","properties":{"templateHash":"18048340065001902796","parameters":{"location":{"type":"String","value":"westus"},"privateIPAllocationMethod":{"type":"String","value":"Dynamic"},"backendAddressPools":{"type":"Array","value":[{"name":"bepool1"},{"name":"bepool2"}]},"name":{"type":"String","value":"test-lb"},"subnetId":{"type":"String","value":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"}},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-06-08T21:22:51.7379575Z","duration":"PT8.796149S","correlationId":"c18f33be-ece9-4c12-96b9-eabd6fd111ff","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"loadBalancers","locations":["westus"]}]}],"dependencies":[],"outputResources":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/loadBalancers/test-lb"}]}}'}
+ body: {string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment","name":"azure-cli-deployment","properties":{"templateHash":"6408713692666354622","parameters":{"location":{"type":"String","value":"westus"},"tags":{"type":"Object","value":{"key":"super=value"}},"privateIPAllocationMethod":{"type":"String","value":"Dynamic"},"name":{"type":"String","value":"test-lb"},"backendAddressPools":{"type":"Array","value":[{"name":"bepool1"},{"name":"bepool2"}]},"subnetId":{"type":"String","value":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"}},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"2017-06-15T20:10:21.4099596Z","duration":"PT1.4012558S","correlationId":"b8232cfd-5846-4949-a2b5-60475b16d780","providers":[{"namespace":"Microsoft.Network","resourceTypes":[{"resourceType":"loadBalancers","locations":["westus"]}]}],"dependencies":[],"outputResources":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb"}]}}'}
headers:
- Cache-Control: [no-cache]
- Content-Type: [application/json; charset=utf-8]
- Date: ['Thu, 08 Jun 2017 21:23:14 GMT']
- Expires: ['-1']
- Pragma: [no-cache]
- Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- Vary: [Accept-Encoding]
- content-length: ['1206']
+ cache-control: [no-cache]
+ content-length: ['1393']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:51 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ vary: [Accept-Encoding]
status: {code: 200, message: OK}
- request:
body: null
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
+ CommandName: [group deployment operation list]
Connection: [keep-alive]
Content-Type: [application/json; charset=utf-8]
User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python
- AZURECLI/TEST/2.0.7+dev]
+ AZURECLI/2.0.9+dev]
accept-language: [en-US]
- x-ms-client-request-id: [aeea1dd2-4c90-11e7-a097-a0b3ccf7272a]
method: GET
- uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/azure-cli-deployment-test/deployments/mock-deployment/operations?api-version=2017-05-10
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001/deployments/mock-deployment/operations?api-version=2017-05-10
response:
- body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Resources/deployments/azure-cli-deployment/operations/62E23BA3072F9A59","operationId":"62E23BA3072F9A59","properties":{"provisioningOperation":"Create","provisioningState":"Succeeded","timestamp":"2017-06-08T21:22:49.7320302Z","duration":"PT3.1487534S","trackingId":"25239975-d954-465b-897a-708ab8de526f","serviceRequestId":"1d49c05c-2558-47e1-84ac-d104ba980e53","statusCode":"Created","targetResource":{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":"Microsoft.Network/loadBalancers","resourceName":"test-lb"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-cli-deployment-test/providers/Microsoft.Resources/deployments/azure-cli-deployment/operations/08587046499225358060","operationId":"08587046499225358060","properties":{"provisioningOperation":"EvaluateDeploymentOutput","provisioningState":"Succeeded","timestamp":"2017-06-08T21:22:51.4958641Z","duration":"PT1.3552308S","trackingId":"52533323-6355-43b1-b5ca-d54f37c55fea","statusCode":"OK","statusMessage":null}}]}'}
+ body: {string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/operations/BDF6DEB6CF066808","operationId":"BDF6DEB6CF066808","properties":{"provisioningOperation":"Create","provisioningState":"Succeeded","timestamp":"2017-06-15T20:10:21.2323261Z","duration":"PT0.4173229S","trackingId":"54c6f4d1-3680-4636-a172-e3a85ddb5f91","serviceRequestId":"f01a0be4-f105-42e3-af90-e63ad09c45fb","statusCode":"Created","targetResource":{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Network/loadBalancers/test-lb","resourceType":"Microsoft.Network/loadBalancers","resourceName":"test-lb"}}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_deployment000001/providers/Microsoft.Resources/deployments/azure-cli-deployment/operations/08587040494654689172","operationId":"08587040494654689172","properties":{"provisioningOperation":"EvaluateDeploymentOutput","provisioningState":"Succeeded","timestamp":"2017-06-15T20:10:21.3811157Z","duration":"PT0.1108897S","trackingId":"5504e6a1-ff15-47b0-8cb8-cf4cf0e4321a","statusCode":"OK","statusMessage":null}}]}'}
headers:
- Cache-Control: [no-cache]
- Content-Type: [application/json; charset=utf-8]
- Date: ['Thu, 08 Jun 2017 21:23:14 GMT']
- Expires: ['-1']
- Pragma: [no-cache]
- Strict-Transport-Security: [max-age=31536000; includeSubDomains]
- Vary: [Accept-Encoding]
- content-length: ['1272']
+ cache-control: [no-cache]
+ content-length: ['1404']
+ content-type: [application/json; charset=utf-8]
+ date: ['Thu, 15 Jun 2017 20:10:51 GMT']
+ expires: ['-1']
+ pragma: [no-cache]
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ vary: [Accept-Encoding]
status: {code: 200, message: OK}
+- request:
+ body: null
+ headers:
+ Accept: [application/json]
+ Accept-Encoding: ['gzip, deflate']
+ CommandName: [group delete]
+ Connection: [keep-alive]
+ Content-Length: ['0']
+ Content-Type: [application/json; charset=utf-8]
+ User-Agent: [python/3.5.1 (Windows-10-10.0.15063-SP0) requests/2.9.1 msrest/0.4.7
+ msrest_azure/0.4.7 resourcemanagementclient/1.1.0rc1 Azure-SDK-For-Python
+ AZURECLI/2.0.9+dev]
+ accept-language: [en-US]
+ method: DELETE
+ uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_test_deployment000001?api-version=2017-05-10
+ response:
+ body: {string: ''}
+ headers:
+ cache-control: [no-cache]
+ content-length: ['0']
+ date: ['Thu, 15 Jun 2017 20:10:52 GMT']
+ expires: ['-1']
+ location: ['https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZURVNUOjVGREVQTE9ZTUVOVFAzQzdCQlVVNUVPU0tPV0ZNMlE0QzRLTXxGQTIwQkM5MDBBMzBFRDFCLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2017-05-10']
+ pragma: [no-cache]
+ retry-after: ['15']
+ strict-transport-security: [max-age=31536000; includeSubDomains]
+ x-ms-ratelimit-remaining-subscription-writes: ['1198']
+ status: {code: 202, message: Accepted}
version: 1
diff --git a/src/command_modules/azure-cli-resource/tests/test-params.json b/src/command_modules/azure-cli-resource/tests/test-params.json
index d393e2593..ef8b30fdc 100644
--- a/src/command_modules/azure-cli-resource/tests/test-params.json
+++ b/src/command_modules/azure-cli-resource/tests/test-params.json
@@ -10,6 +10,11 @@
},
"privateIPAllocationMethod": {
"value": "Dynamic"
+ },
+ "tags": {
+ "value": {
+ "key": "super=value"
+ }
}
}
}
\ No newline at end of file
diff --git a/src/command_modules/azure-cli-resource/tests/test-template.json b/src/command_modules/azure-cli-resource/tests/test-template.json
index 8e5a5d5da..cdd7f5a8b 100644
--- a/src/command_modules/azure-cli-resource/tests/test-template.json
+++ b/src/command_modules/azure-cli-resource/tests/test-template.json
@@ -16,6 +16,9 @@
},
"backendAddressPools": {
"type": "array"
+ },
+ "tags": {
+ "type": "object"
}
},
"resources": [
@@ -38,6 +41,7 @@
],
"backendAddressPools": "[parameters('backendAddressPools')]"
},
+ "tags": "[parameters('tags')]",
"type": "Microsoft.Network/loadBalancers"
}
]
diff --git a/src/command_modules/azure-cli-resource/tests/test_custom.py b/src/command_modules/azure-cli-resource/tests/test_custom.py
index 6ef0754a4..877a0fa8a 100644
--- a/src/command_modules/azure-cli-resource/tests/test_custom.py
+++ b/src/command_modules/azure-cli-resource/tests/test_custom.py
@@ -176,7 +176,7 @@ class TestCustom(unittest.TestCase):
{
"parameter_list": [['{"foo": "bar"}', '{"foo": "baz"}']],
"expected": {"foo": "baz"},
- },
+ }
]
for test in tests:
diff --git a/src/command_modules/azure-cli-resource/tests/test_resource.py b/src/command_modules/azure-cli-resource/tests/test_resource.py
index 7c310420d..debe7e4a6 100644
--- a/src/command_modules/azure-cli-resource/tests/test_resource.py
+++ b/src/command_modules/azure-cli-resource/tests/test_resource.py
@@ -310,47 +310,43 @@ class ProviderOperationTest(VCRTestBase):
])
-class DeploymentTest(ResourceGroupVCRTestBase):
- def __init__(self, test_method):
- super(DeploymentTest, self).__init__(__file__, test_method,
- resource_group='azure-cli-deployment-test')
-
- def test_group_deployment(self):
- self.execute()
+class DeploymentTest(ScenarioTest):
- def body(self):
+ @ResourceGroupPreparer(name_prefix='cli_test_deployment')
+ def test_group_deployment(self, resource_group):
curr_dir = os.path.dirname(os.path.realpath(__file__))
template_file = os.path.join(curr_dir, 'test-template.json').replace('\\', '\\\\')
parameters_file = os.path.join(curr_dir, 'test-params.json').replace('\\', '\\\\')
object_file = os.path.join(curr_dir, 'test-object.json').replace('\\', '\\\\')
deployment_name = 'azure-cli-deployment'
- subnet_id = self.cmd('network vnet create -g {} -n vnet1 --subnet-name subnet1'.format(self.resource_group))['newVNet']['subnets'][0]['id']
+ subnet_id = self.cmd('network vnet create -g {} -n vnet1 --subnet-name subnet1'.format(resource_group)).get_output_in_json()['newVNet']['subnets'][0]['id']
self.cmd('group deployment validate -g {} --template-file {} --parameters @"{}" --parameters subnetId="{}" --parameters backendAddressPools=@"{}"'.format(
- self.resource_group, template_file, parameters_file, subnet_id, object_file), checks=[
- JMESPathCheck('properties.provisioningState', 'Succeeded')
+ resource_group, template_file, parameters_file, subnet_id, object_file), checks=[
+ JCheck('properties.provisioningState', 'Succeeded')
])
self.cmd('group deployment create -g {} -n {} --template-file {} --parameters @"{}" --parameters subnetId="{}" --parameters backendAddressPools=@"{}"'.format(
- self.resource_group, deployment_name, template_file, parameters_file, subnet_id, object_file), checks=[
- JMESPathCheck('properties.provisioningState', 'Succeeded'),
- JMESPathCheck('resourceGroup', self.resource_group),
+ resource_group, deployment_name, template_file, parameters_file, subnet_id, object_file), checks=[
+ JCheck('properties.provisioningState', 'Succeeded'),
+ JCheck('resourceGroup', resource_group),
+ ])
+ self.cmd('network lb show -g {} -n test-lb'.format(resource_group), checks=[
+ JCheck('tags', {'key': 'super=value'})
])
- self.cmd('group deployment list -g {}'.format(self.resource_group), checks=[
- JMESPathCheck('[0].name', deployment_name),
- JMESPathCheck('[0].resourceGroup', self.resource_group)
+ self.cmd('group deployment list -g {}'.format(resource_group), checks=[
+ JCheck('[0].name', deployment_name),
+ JCheck('[0].resourceGroup', resource_group)
])
- self.cmd('group deployment show -g {} -n {}'.format(self.resource_group, deployment_name),
- checks=[
- JMESPathCheck('name', deployment_name),
- JMESPathCheck('resourceGroup', self.resource_group)
- ])
- self.cmd('group deployment operation list -g {} -n {}'.format(self.resource_group,
- deployment_name), checks=[
- JMESPathCheck('length([])', 2),
- JMESPathCheck('[0].resourceGroup', self.resource_group)
+ self.cmd('group deployment show -g {} -n {}'.format(resource_group, deployment_name), checks=[
+ JCheck('name', deployment_name),
+ JCheck('resourceGroup', resource_group)
+ ])
+ self.cmd('group deployment operation list -g {} -n {}'.format(resource_group, deployment_name), checks=[
+ JCheck('length([])', 2),
+ JCheck('[0].resourceGroup', resource_group)
])
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": -1,
"issue_text_score": 0,
"test_score": -1
},
"num_modified_files": 3
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "python scripts/dev_setup.py",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc libssl-dev libffi-dev"
],
"python": "3.5",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
adal==0.4.3
applicationinsights==0.10.0
argcomplete==1.8.0
astroid==2.11.7
attrs==22.2.0
autopep8==2.0.4
azure-batch==3.0.0
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli&subdirectory=src/azure-cli
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_acr&subdirectory=src/command_modules/azure-cli-acr
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_acs&subdirectory=src/command_modules/azure-cli-acs
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_appservice&subdirectory=src/command_modules/azure-cli-appservice
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_batch&subdirectory=src/command_modules/azure-cli-batch
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_billing&subdirectory=src/command_modules/azure-cli-billing
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_cdn&subdirectory=src/command_modules/azure-cli-cdn
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_cloud&subdirectory=src/command_modules/azure-cli-cloud
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_cognitiveservices&subdirectory=src/command_modules/azure-cli-cognitiveservices
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_component&subdirectory=src/command_modules/azure-cli-component
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_configure&subdirectory=src/command_modules/azure-cli-configure
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_consumption&subdirectory=src/command_modules/azure-cli-consumption
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_core&subdirectory=src/azure-cli-core
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_cosmosdb&subdirectory=src/command_modules/azure-cli-cosmosdb
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_dla&subdirectory=src/command_modules/azure-cli-dla
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_dls&subdirectory=src/command_modules/azure-cli-dls
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_feedback&subdirectory=src/command_modules/azure-cli-feedback
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_find&subdirectory=src/command_modules/azure-cli-find
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_interactive&subdirectory=src/command_modules/azure-cli-interactive
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_iot&subdirectory=src/command_modules/azure-cli-iot
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_keyvault&subdirectory=src/command_modules/azure-cli-keyvault
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_lab&subdirectory=src/command_modules/azure-cli-lab
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_monitor&subdirectory=src/command_modules/azure-cli-monitor
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_network&subdirectory=src/command_modules/azure-cli-network
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_nspkg&subdirectory=src/azure-cli-nspkg
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_profile&subdirectory=src/command_modules/azure-cli-profile
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_rdbms&subdirectory=src/command_modules/azure-cli-rdbms
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_redis&subdirectory=src/command_modules/azure-cli-redis
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_resource&subdirectory=src/command_modules/azure-cli-resource
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_role&subdirectory=src/command_modules/azure-cli-role
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_sf&subdirectory=src/command_modules/azure-cli-sf
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_sql&subdirectory=src/command_modules/azure-cli-sql
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_storage&subdirectory=src/command_modules/azure-cli-storage
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_taskhelp&subdirectory=src/command_modules/azure-cli-taskhelp
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_testsdk&subdirectory=src/azure-cli-testsdk
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_utility_automation&subdirectory=scripts
-e git+https://github.com/Azure/azure-cli.git@e80e204a01bf4f32c17d8f89a955c3dd49eaa7ec#egg=azure_cli_vm&subdirectory=src/command_modules/azure-cli-vm
azure-common==1.1.28
azure-core==1.24.2
azure-datalake-store==0.0.9
azure-devtools==1.2.0
azure-graphrbac==0.30.0rc6
azure-keyvault==0.3.0
azure-mgmt-authorization==0.30.0rc6
azure-mgmt-batch==4.0.0
azure-mgmt-billing==0.1.0
azure-mgmt-cdn==0.30.2
azure-mgmt-cognitiveservices==1.0.0
azure-mgmt-compute==1.0.0rc1
azure-mgmt-consumption==0.1.0
azure-mgmt-containerregistry==0.2.1
azure-mgmt-datalake-analytics==0.1.4
azure-mgmt-datalake-nspkg==3.0.1
azure-mgmt-datalake-store==0.1.4
azure-mgmt-devtestlabs==2.0.0
azure-mgmt-dns==1.0.1
azure-mgmt-documentdb==0.1.3
azure-mgmt-iothub==0.2.2
azure-mgmt-keyvault==0.31.0
azure-mgmt-monitor==0.2.1
azure-mgmt-network==1.0.0rc3
azure-mgmt-nspkg==1.0.0
azure-mgmt-rdbms==0.1.0
azure-mgmt-redis==1.0.0
azure-mgmt-resource==1.1.0rc1
azure-mgmt-sql==0.5.1
azure-mgmt-storage==1.0.0rc1
azure-mgmt-trafficmanager==0.30.0
azure-mgmt-web==0.32.0
azure-monitor==0.3.0
azure-multiapi-storage==0.1.0
azure-nspkg==1.0.0
azure-servicefabric==5.6.130
certifi==2021.5.30
cffi==1.15.1
colorama==0.3.7
ConfigArgParse==1.7
coverage==6.2
cryptography==40.0.2
flake8==5.0.4
futures==3.1.1
humanfriendly==2.4
idna==3.10
importlib-metadata==4.2.0
iniconfig==1.1.1
isodate==0.7.0
isort==5.10.1
jeepney==0.7.1
jmespath==0.10.0
keyring==23.4.1
lazy-object-proxy==1.7.1
mccabe==0.7.0
mock==5.2.0
msrest==0.4.29
msrestazure==0.4.34
multidict==5.2.0
nose==1.3.7
oauthlib==3.2.2
packaging==21.3
paramiko==2.0.2
pbr==6.1.1
pluggy==1.0.0
prompt-toolkit==3.0.36
py==1.11.0
pyasn1==0.5.1
pycodestyle==2.10.0
pycparser==2.21
pydocumentdb==2.3.5
pyflakes==2.5.0
Pygments==2.1.3
PyJWT==2.4.0
pylint==1.7.1
pyOpenSSL==16.2.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==3.11
requests==2.9.1
requests-oauthlib==2.0.0
scp==0.15.0
SecretStorage==3.3.3
six==1.10.0
sshtunnel==0.4.0
tabulate==0.7.7
tomli==1.2.3
typed-ast==1.5.5
typing-extensions==4.1.1
urllib3==1.26.20
urllib3-secure-extra==0.1.0
vcrpy==1.10.3
vsts-cd-manager==1.0.2
wcwidth==0.2.13
Whoosh==2.7.4
wrapt==1.16.0
xmltodict==0.14.2
yarl==1.7.2
zipp==3.6.0
|
name: azure-cli
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- adal==0.4.3
- applicationinsights==0.10.0
- argcomplete==1.8.0
- astroid==2.11.7
- attrs==22.2.0
- autopep8==2.0.4
- azure-batch==3.0.0
- azure-common==1.1.28
- azure-core==1.24.2
- azure-datalake-store==0.0.9
- azure-devtools==1.2.0
- azure-graphrbac==0.30.0rc6
- azure-keyvault==0.3.0
- azure-mgmt-authorization==0.30.0rc6
- azure-mgmt-batch==4.0.0
- azure-mgmt-billing==0.1.0
- azure-mgmt-cdn==0.30.2
- azure-mgmt-cognitiveservices==1.0.0
- azure-mgmt-compute==1.0.0rc1
- azure-mgmt-consumption==0.1.0
- azure-mgmt-containerregistry==0.2.1
- azure-mgmt-datalake-analytics==0.1.4
- azure-mgmt-datalake-nspkg==3.0.1
- azure-mgmt-datalake-store==0.1.4
- azure-mgmt-devtestlabs==2.0.0
- azure-mgmt-dns==1.0.1
- azure-mgmt-documentdb==0.1.3
- azure-mgmt-iothub==0.2.2
- azure-mgmt-keyvault==0.31.0
- azure-mgmt-monitor==0.2.1
- azure-mgmt-network==1.0.0rc3
- azure-mgmt-nspkg==1.0.0
- azure-mgmt-rdbms==0.1.0
- azure-mgmt-redis==1.0.0
- azure-mgmt-resource==1.1.0rc1
- azure-mgmt-sql==0.5.1
- azure-mgmt-storage==1.0.0rc1
- azure-mgmt-trafficmanager==0.30.0
- azure-mgmt-web==0.32.0
- azure-monitor==0.3.0
- azure-multiapi-storage==0.1.0
- azure-nspkg==1.0.0
- azure-servicefabric==5.6.130
- cffi==1.15.1
- colorama==0.3.7
- configargparse==1.7
- coverage==6.2
- cryptography==40.0.2
- flake8==5.0.4
- futures==3.1.1
- humanfriendly==2.4
- idna==3.10
- importlib-metadata==4.2.0
- iniconfig==1.1.1
- isodate==0.7.0
- isort==5.10.1
- jeepney==0.7.1
- jmespath==0.10.0
- keyring==23.4.1
- lazy-object-proxy==1.7.1
- mccabe==0.7.0
- mock==5.2.0
- msrest==0.4.29
- msrestazure==0.4.34
- multidict==5.2.0
- nose==1.3.7
- oauthlib==3.2.2
- packaging==21.3
- paramiko==2.0.2
- pbr==6.1.1
- pip==9.0.1
- pluggy==1.0.0
- prompt-toolkit==3.0.36
- py==1.11.0
- pyasn1==0.5.1
- pycodestyle==2.10.0
- pycparser==2.21
- pydocumentdb==2.3.5
- pyflakes==2.5.0
- pygments==2.1.3
- pyjwt==2.4.0
- pylint==1.7.1
- pyopenssl==16.2.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==3.11
- requests==2.9.1
- requests-oauthlib==2.0.0
- scp==0.15.0
- secretstorage==3.3.3
- setuptools==30.4.0
- six==1.10.0
- sshtunnel==0.4.0
- tabulate==0.7.7
- tomli==1.2.3
- typed-ast==1.5.5
- typing-extensions==4.1.1
- urllib3==1.26.20
- urllib3-secure-extra==0.1.0
- vcrpy==1.10.3
- vsts-cd-manager==1.0.2
- wcwidth==0.2.13
- whoosh==2.7.4
- wrapt==1.16.0
- xmltodict==0.14.2
- yarl==1.7.2
- zipp==3.6.0
prefix: /opt/conda/envs/azure-cli
|
[
"src/command_modules/azure-cli-resource/tests/test_resource.py::DeploymentTest::test_group_deployment"
] |
[] |
[
"src/command_modules/azure-cli-resource/tests/test_custom.py::TestCustom::test_deployment_parameters",
"src/command_modules/azure-cli-resource/tests/test_custom.py::TestCustom::test_extract_parameters",
"src/command_modules/azure-cli-resource/tests/test_custom.py::TestCustom::test_resource_missing_parameters",
"src/command_modules/azure-cli-resource/tests/test_resource.py::ResourceGroupScenarioTest::test_resource_group",
"src/command_modules/azure-cli-resource/tests/test_resource.py::ResourceGroupNoWaitScenarioTest::test_resource_group_no_wait",
"src/command_modules/azure-cli-resource/tests/test_resource.py::ResourceScenarioTest::test_resource_scenario",
"src/command_modules/azure-cli-resource/tests/test_resource.py::ResourceIDScenarioTest::test_resource_id_scenario",
"src/command_modules/azure-cli-resource/tests/test_resource.py::ResourceCreateScenarioTest::test_resource_create",
"src/command_modules/azure-cli-resource/tests/test_resource.py::TagScenarioTest::test_tag_scenario",
"src/command_modules/azure-cli-resource/tests/test_resource.py::ProviderRegistrationTest::test_provider_registration",
"src/command_modules/azure-cli-resource/tests/test_resource.py::ProviderOperationTest::test_provider_operation",
"src/command_modules/azure-cli-resource/tests/test_resource.py::DeploymentnoWaitTest::test_group_deployment_no_wait",
"src/command_modules/azure-cli-resource/tests/test_resource.py::DeploymentThruUriTest::test_group_deployment_thru_uri",
"src/command_modules/azure-cli-resource/tests/test_resource.py::ResourceMoveScenarioTest::test_resource_move",
"src/command_modules/azure-cli-resource/tests/test_resource.py::FeatureScenarioTest::test_feature_list",
"src/command_modules/azure-cli-resource/tests/test_resource.py::PolicyScenarioTest::test_resource_policy",
"src/command_modules/azure-cli-resource/tests/test_resource.py::ManagedAppDefinitionScenarioTest::test_managedappdef",
"src/command_modules/azure-cli-resource/tests/test_resource.py::ManagedAppScenarioTest::test_managedapp",
"src/command_modules/azure-cli-resource/tests/test_resource.py::CrossRGDeploymentScenarioTest::test_crossrg_deployment"
] |
[] |
MIT License
| 1,377 |
dask__dask-2466
|
37c3ae2e091412f5e2fdf3c957c383e89e4c8bb2
|
2017-06-16 14:00:21
|
a18308c6384f2a8cd7c0c50749a20bd067842ef9
|
jcrist: > Unsure how to test this
Any way to test using moto, and skip if moto not installed?
If this is hard to test, I'd also be fine merging without.
martindurant: Yeah, moto doesn't disallow writing, even when anonymous, so I don't know what parameters I could pass to s3fs that would have any effect, where as local writes take no parameters at all.
|
diff --git a/dask/array/fft.py b/dask/array/fft.py
index cfccda548..2f64c94ee 100644
--- a/dask/array/fft.py
+++ b/dask/array/fft.py
@@ -228,9 +228,9 @@ def _fftfreq_helper(n, d=1.0, chunks=None, real=False):
s = n // 2 + 1 if real else n
t = l - s
- chunks = _normalize_chunks(chunks, (s,))[0] + (t,)
+ chunks = _normalize_chunks(chunks, (s,))
- r = _linspace(0, 1, l, chunks=chunks)
+ r = _linspace(0, 1, l, chunks=(chunks[0] + (t,),))
if real:
n_2 = n // 2 + 1
@@ -239,6 +239,9 @@ def _fftfreq_helper(n, d=1.0, chunks=None, real=False):
n_2 = (n + 1) // 2
r = _concatenate([r[:n_2], r[n_2:-1] - 1])
+ if r.chunks != chunks:
+ r = r.rechunk(chunks)
+
r /= d
return r
diff --git a/dask/bag/core.py b/dask/bag/core.py
index 1cb43c01b..6cc7a8ab6 100644
--- a/dask/bag/core.py
+++ b/dask/bag/core.py
@@ -118,7 +118,8 @@ def optimize(dsk, keys, fuse_keys=None, rename_fused_keys=True, **kwargs):
def to_textfiles(b, path, name_function=None, compression='infer',
- encoding=system_encoding, compute=True, get=None):
+ encoding=system_encoding, compute=True, get=None,
+ storage_options=None):
""" Write bag to disk, one filename per partition, one line per element
**Paths**: This will create one file for each partition in your bag. You
@@ -174,7 +175,7 @@ def to_textfiles(b, path, name_function=None, compression='infer',
"""
from dask import delayed
writes = write_bytes(b.to_delayed(), path, name_function, compression,
- encoding=encoding)
+ encoding=encoding, **(storage_options or {}))
# Use Bag optimizations on these delayed objects
dsk = ensure_dict(delayed(writes).dask)
@@ -642,9 +643,10 @@ class Bag(Base):
@wraps(to_textfiles)
def to_textfiles(self, path, name_function=None, compression='infer',
- encoding=system_encoding, compute=True, get=None):
+ encoding=system_encoding, compute=True, get=None,
+ storage_options=None):
return to_textfiles(self, path, name_function, compression, encoding,
- compute, get=get)
+ compute, get=get, storage_options=storage_options)
def fold(self, binop, combine=None, initial=no_default, split_every=None):
""" Parallelizable reduction
diff --git a/dask/dataframe/io/csv.py b/dask/dataframe/io/csv.py
index 9ceaad2e2..c999aa414 100644
--- a/dask/dataframe/io/csv.py
+++ b/dask/dataframe/io/csv.py
@@ -364,7 +364,7 @@ def _to_csv_chunk(df, **kwargs):
def to_csv(df, filename, name_function=None, compression=None, compute=True,
- get=None, **kwargs):
+ get=None, storage_options=None, **kwargs):
"""
Store Dask DataFrame to CSV files
@@ -472,10 +472,12 @@ def to_csv(df, filename, name_function=None, compression=None, compute=True,
decimal: string, default '.'
Character recognized as decimal separator. E.g. use ',' for
European data
+ storage_options: dict
+ Parameters passed on to the backend filesystem class.
"""
values = [_to_csv_chunk(d, **kwargs) for d in df.to_delayed()]
values = write_bytes(values, filename, name_function, compression,
- encoding=None)
+ encoding=None, **(storage_options or {}))
if compute:
delayed(values).compute(get=get)
|
Can't specify storage_options for bag.to_textfiles, dataframe.to_csv
The read functions allow specifying `storage_options` for things like AWS key/secret. The `to_parquet` function allows this as well.
However in other cases such as `bag.to_textfiles()` and `dataframe.to_csv()`, it is not possible to specify these options. It would be nice for there to be consistency, since there is no other way to specify some of the options at this time.
|
dask/dask
|
diff --git a/dask/array/tests/test_fft.py b/dask/array/tests/test_fft.py
index c02b7fefd..ab6de9560 100644
--- a/dask/array/tests/test_fft.py
+++ b/dask/array/tests/test_fft.py
@@ -9,6 +9,10 @@ import dask.array.fft
from dask.array.fft import fft_wrap
from dask.array.utils import assert_eq
+from dask.array.core import (
+ normalize_chunks as _normalize_chunks,
+)
+
def same_keys(a, b):
def key(k):
@@ -202,7 +206,13 @@ def test_wrap_fftns(modname, funcname, dtype):
@pytest.mark.parametrize("c", [lambda m: m, lambda m: (1, m - 1)])
def test_fftfreq(n, d, c):
c = c(n)
- assert_eq(da.fft.fftfreq(n, d, chunks=c), np.fft.fftfreq(n, d))
+
+ r1 = np.fft.fftfreq(n, d)
+ r2 = da.fft.fftfreq(n, d, chunks=c)
+
+ assert _normalize_chunks(c, r2.shape) == r2.chunks
+
+ assert_eq(r1, r2)
@pytest.mark.parametrize("n", [1, 2, 3, 6, 7])
@@ -210,9 +220,13 @@ def test_fftfreq(n, d, c):
@pytest.mark.parametrize("c", [lambda m: m // 2 + 1, lambda m: (1, m // 2)])
def test_rfftfreq(n, d, c):
c = c(n)
- assert_eq(
- da.fft.rfftfreq(n, d, chunks=c), np.fft.rfftfreq(n, d)
- )
+
+ r1 = np.fft.rfftfreq(n, d)
+ r2 = da.fft.rfftfreq(n, d, chunks=c)
+
+ assert _normalize_chunks(c, r2.shape) == r2.chunks
+
+ assert_eq(r1, r2)
@pytest.mark.parametrize("funcname", ["fftshift", "ifftshift"])
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 3
}
|
1.17
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[complete]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-xdist"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
aiobotocore==2.1.2
aiohttp==3.8.6
aioitertools==0.11.0
aiosignal==1.2.0
async-timeout==4.0.2
asynctest==0.13.0
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
botocore==1.23.24
certifi==2021.5.30
charset-normalizer==3.0.1
click==8.0.4
cloudpickle==2.2.1
-e git+https://github.com/dask/dask.git@37c3ae2e091412f5e2fdf3c957c383e89e4c8bb2#egg=dask
distributed==1.19.3
execnet==1.9.0
frozenlist==1.2.0
fsspec==2022.1.0
HeapDict==1.0.1
idna==3.10
idna-ssl==1.1.0
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
jmespath==0.10.0
locket==1.0.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
msgpack-python==0.5.6
multidict==5.2.0
numpy==1.19.5
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pandas==1.1.5
partd==1.2.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
psutil==7.0.0
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytest-xdist==3.0.2
python-dateutil==2.9.0.post0
pytz==2025.2
s3fs==2022.1.0
six==1.17.0
sortedcontainers==2.4.0
tblib==1.7.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
toolz==0.12.0
tornado==6.1
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
wrapt==1.16.0
yarl==1.7.2
zict==2.1.0
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: dask
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- aiobotocore==2.1.2
- aiohttp==3.8.6
- aioitertools==0.11.0
- aiosignal==1.2.0
- async-timeout==4.0.2
- asynctest==0.13.0
- botocore==1.23.24
- charset-normalizer==3.0.1
- click==8.0.4
- cloudpickle==2.2.1
- distributed==1.19.3
- execnet==1.9.0
- frozenlist==1.2.0
- fsspec==2022.1.0
- heapdict==1.0.1
- idna==3.10
- idna-ssl==1.1.0
- jmespath==0.10.0
- locket==1.0.0
- msgpack-python==0.5.6
- multidict==5.2.0
- numpy==1.19.5
- pandas==1.1.5
- partd==1.2.0
- psutil==7.0.0
- pytest-xdist==3.0.2
- python-dateutil==2.9.0.post0
- pytz==2025.2
- s3fs==2022.1.0
- six==1.17.0
- sortedcontainers==2.4.0
- tblib==1.7.0
- toolz==0.12.0
- tornado==6.1
- urllib3==1.26.20
- wrapt==1.16.0
- yarl==1.7.2
- zict==2.1.0
prefix: /opt/conda/envs/dask
|
[
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>0-1.0-1]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>0-1.0-2]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>0-1.0-3]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>0-1.0-6]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>0-1.0-7]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>0-0.5-1]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>0-0.5-2]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>0-0.5-3]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>0-0.5-6]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>0-0.5-7]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>0-6.283185307179586-1]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>0-6.283185307179586-2]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>0-6.283185307179586-3]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>0-6.283185307179586-6]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>0-6.283185307179586-7]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>1-1.0-1]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>1-0.5-1]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>1-6.283185307179586-1]"
] |
[] |
[
"dask/array/tests/test_fft.py::test_cant_fft_chunked_axis[fft]",
"dask/array/tests/test_fft.py::test_cant_fft_chunked_axis[ifft]",
"dask/array/tests/test_fft.py::test_cant_fft_chunked_axis[rfft]",
"dask/array/tests/test_fft.py::test_cant_fft_chunked_axis[irfft]",
"dask/array/tests/test_fft.py::test_cant_fft_chunked_axis[hfft]",
"dask/array/tests/test_fft.py::test_cant_fft_chunked_axis[ihfft]",
"dask/array/tests/test_fft.py::test_fft[fft]",
"dask/array/tests/test_fft.py::test_fft[ifft]",
"dask/array/tests/test_fft.py::test_fft[rfft]",
"dask/array/tests/test_fft.py::test_fft[irfft]",
"dask/array/tests/test_fft.py::test_fft[hfft]",
"dask/array/tests/test_fft.py::test_fft[ihfft]",
"dask/array/tests/test_fft.py::test_fft2n_shapes[fft2]",
"dask/array/tests/test_fft.py::test_fft2n_shapes[ifft2]",
"dask/array/tests/test_fft.py::test_fft2n_shapes[fftn]",
"dask/array/tests/test_fft.py::test_fft2n_shapes[ifftn]",
"dask/array/tests/test_fft.py::test_fft2n_shapes[rfft2]",
"dask/array/tests/test_fft.py::test_fft2n_shapes[irfft2]",
"dask/array/tests/test_fft.py::test_fft2n_shapes[rfftn]",
"dask/array/tests/test_fft.py::test_fft2n_shapes[irfftn]",
"dask/array/tests/test_fft.py::test_fft_n_kwarg[fft]",
"dask/array/tests/test_fft.py::test_fft_n_kwarg[ifft]",
"dask/array/tests/test_fft.py::test_fft_n_kwarg[rfft]",
"dask/array/tests/test_fft.py::test_fft_n_kwarg[irfft]",
"dask/array/tests/test_fft.py::test_fft_n_kwarg[hfft]",
"dask/array/tests/test_fft.py::test_fft_n_kwarg[ihfft]",
"dask/array/tests/test_fft.py::test_fft_consistent_names[fft]",
"dask/array/tests/test_fft.py::test_fft_consistent_names[ifft]",
"dask/array/tests/test_fft.py::test_fft_consistent_names[rfft]",
"dask/array/tests/test_fft.py::test_fft_consistent_names[irfft]",
"dask/array/tests/test_fft.py::test_fft_consistent_names[hfft]",
"dask/array/tests/test_fft.py::test_fft_consistent_names[ihfft]",
"dask/array/tests/test_fft.py::test_wrap_bad_kind",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float32-fft2]",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float32-ifft2]",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float32-fftn]",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float32-ifftn]",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float32-rfft2]",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float32-irfft2]",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float32-rfftn]",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float32-irfftn]",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float64-fft2]",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float64-ifft2]",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float64-fftn]",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float64-ifftn]",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float64-rfft2]",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float64-irfft2]",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float64-rfftn]",
"dask/array/tests/test_fft.py::test_nd_ffts_axes[float64-irfftn]",
"dask/array/tests/test_fft.py::test_wrap_ffts[float32-fft-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_ffts[float32-ifft-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_ffts[float32-rfft-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_ffts[float32-irfft-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_ffts[float32-hfft-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_ffts[float32-ihfft-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_ffts[float64-fft-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_ffts[float64-ifft-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_ffts[float64-rfft-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_ffts[float64-irfft-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_ffts[float64-hfft-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_ffts[float64-ihfft-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float32-fft2-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float32-ifft2-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float32-fftn-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float32-ifftn-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float32-rfft2-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float32-irfft2-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float32-rfftn-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float32-irfftn-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float64-fft2-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float64-ifft2-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float64-fftn-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float64-ifftn-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float64-rfft2-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float64-irfft2-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float64-rfftn-numpy.fft]",
"dask/array/tests/test_fft.py::test_wrap_fftns[float64-irfftn-numpy.fft]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>1-1.0-2]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>1-1.0-3]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>1-1.0-6]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>1-1.0-7]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>1-0.5-2]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>1-0.5-3]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>1-0.5-6]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>1-0.5-7]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>1-6.283185307179586-2]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>1-6.283185307179586-3]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>1-6.283185307179586-6]",
"dask/array/tests/test_fft.py::test_fftfreq[<lambda>1-6.283185307179586-7]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>0-1.0-1]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>0-1.0-2]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>0-1.0-3]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>0-1.0-6]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>0-1.0-7]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>0-0.5-1]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>0-0.5-2]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>0-0.5-3]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>0-0.5-6]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>0-0.5-7]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>0-6.283185307179586-1]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>0-6.283185307179586-2]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>0-6.283185307179586-3]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>0-6.283185307179586-6]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>0-6.283185307179586-7]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>1-1.0-1]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>1-1.0-2]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>1-1.0-3]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>1-1.0-6]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>1-1.0-7]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>1-0.5-1]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>1-0.5-2]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>1-0.5-3]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>1-0.5-6]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>1-0.5-7]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>1-6.283185307179586-1]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>1-6.283185307179586-2]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>1-6.283185307179586-3]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>1-6.283185307179586-6]",
"dask/array/tests/test_fft.py::test_rfftfreq[<lambda>1-6.283185307179586-7]",
"dask/array/tests/test_fft.py::test_fftshift[None-fftshift]",
"dask/array/tests/test_fft.py::test_fftshift[None-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift[0-fftshift]",
"dask/array/tests/test_fft.py::test_fftshift[0-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift[1-fftshift]",
"dask/array/tests/test_fft.py::test_fftshift[1-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift[2-fftshift]",
"dask/array/tests/test_fft.py::test_fftshift[2-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift[axes4-fftshift]",
"dask/array/tests/test_fft.py::test_fftshift[axes4-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift[axes5-fftshift]",
"dask/array/tests/test_fft.py::test_fftshift[axes5-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift[axes6-fftshift]",
"dask/array/tests/test_fft.py::test_fftshift[axes6-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift[axes7-fftshift]",
"dask/array/tests/test_fft.py::test_fftshift[axes7-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[None-fftshift-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[None-ifftshift-fftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[0-fftshift-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[0-ifftshift-fftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[1-fftshift-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[1-ifftshift-fftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[2-fftshift-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[2-ifftshift-fftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[axes4-fftshift-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[axes4-ifftshift-fftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[axes5-fftshift-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[axes5-ifftshift-fftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[axes6-fftshift-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[axes6-ifftshift-fftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[axes7-fftshift-ifftshift]",
"dask/array/tests/test_fft.py::test_fftshift_identity[axes7-ifftshift-fftshift]"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 1,380 |
dask__dask-2467
|
ecdae84aa3b8ee5408876b0b7d7eade3d127e177
|
2017-06-16 16:29:49
|
c560965c8fc0da7cbc0920d43b7011d2721307d3
|
mrocklin: This looks good to me. I was surprised to see that serializing `(slice, [...])` was as fast (or faster) as serializing `slice(...)`
|
diff --git a/dask/dataframe/io/io.py b/dask/dataframe/io/io.py
index 93b47bb3c..5c82683aa 100644
--- a/dask/dataframe/io/io.py
+++ b/dask/dataframe/io/io.py
@@ -343,7 +343,7 @@ def dataframe_from_ctable(x, slc, columns=None, categories=None, lock=lock):
def from_dask_array(x, columns=None):
- """ Create Dask Array from a Dask DataFrame
+ """ Create a Dask DataFrame from a Dask Array.
Converts a 2d array into a DataFrame and a 1d array into a Series.
diff --git a/dask/delayed.py b/dask/delayed.py
index a9cd531e0..8f0943d0d 100644
--- a/dask/delayed.py
+++ b/dask/delayed.py
@@ -64,26 +64,33 @@ def to_task_dask(expr):
"""
if isinstance(expr, Delayed):
return expr.key, expr.dask
+
if isinstance(expr, base.Base):
name = 'finalize-' + tokenize(expr, pure=True)
keys = expr._keys()
dsk = expr._optimize(ensure_dict(expr.dask), keys)
dsk[name] = (expr._finalize, (concrete, keys))
return name, dsk
- if isinstance(expr, tuple) and type(expr) != tuple:
- return expr, {}
- if isinstance(expr, (Iterator, list, tuple, set)):
+
+ if isinstance(expr, Iterator):
+ expr = list(expr)
+ typ = type(expr)
+
+ if typ in (list, tuple, set):
args, dasks = unzip((to_task_dask(e) for e in expr), 2)
args = list(args)
dsk = sharedict.merge(*dasks)
# Ensure output type matches input type
- if isinstance(expr, (tuple, set)):
- return (type(expr), args), dsk
- else:
- return args, dsk
- if type(expr) is dict:
+ return (args, dsk) if typ is list else ((typ, args), dsk)
+
+ if typ is dict:
args, dsk = to_task_dask([[k, v] for k, v in expr.items()])
return (dict, args), dsk
+
+ if typ is slice:
+ args, dsk = to_task_dask([expr.start, expr.stop, expr.step])
+ return (slice,) + tuple(args), dsk
+
return expr, {}
|
Slicing delayed objects with delayed objects does not work
I'm trying to wrap my code with delayed, using `dask 0.15.0`, `python 3.6.0` and `numpy 1.12.1`, but I stumbled on an exception.
```
from dask import delayed
import numpy as np
a = delayed(np.arange(10))
b = delayed(2)
a[:b].compute()
```
results in: `TypeError: slice indices must be integers or None or have an __index__ method`
```
a[delayed(slice)(None,b)].compute()
```
Works, even only calling `slice(None,b)` gives no error, but then again `a[slice(None,b)]` gives an identical error. Isn't it to be expected that a delayed object would wrap its own slice objects when sliced?
|
dask/dask
|
diff --git a/dask/tests/test_delayed.py b/dask/tests/test_delayed.py
index 837e739a4..8c89cca23 100644
--- a/dask/tests/test_delayed.py
+++ b/dask/tests/test_delayed.py
@@ -1,4 +1,4 @@
-from collections import Iterator, namedtuple
+from collections import namedtuple
from operator import add, setitem
import pickle
from random import random
@@ -32,6 +32,10 @@ def test_to_task_dask():
assert task == x
assert dict(dask) == {}
+ task, dask = to_task_dask(slice(a, b, 3))
+ assert task == (slice, 'a', 'b', 3)
+ assert dict(dask) == merge(a.dask, b.dask)
+
# Issue https://github.com/dask/dask/issues/2107
class MyClass(dict):
pass
@@ -58,6 +62,8 @@ def test_operators():
a = delayed([1, 2, 3])
assert a[0].compute() == 1
assert (a + a).compute() == [1, 2, 3, 1, 2, 3]
+ b = delayed(2)
+ assert a[:b].compute() == [1, 2]
a = delayed(10)
assert (a + 1).compute() == 11
@@ -154,7 +160,6 @@ def test_lists_are_concrete():
assert c.compute() == 20
[email protected]
def test_iterators():
a = delayed(1)
b = delayed(2)
@@ -163,7 +168,6 @@ def test_iterators():
assert c.compute() == 3
def f(seq):
- assert isinstance(seq, Iterator)
return sum(seq)
c = delayed(f)(iter([a, b]))
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 2
}
|
0.15
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[complete]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
aiobotocore==2.1.2
aiohttp==3.8.6
aioitertools==0.11.0
aiosignal==1.2.0
async-timeout==4.0.2
asynctest==0.13.0
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
botocore==1.23.24
certifi==2021.5.30
charset-normalizer==3.0.1
click==8.0.4
cloudpickle==2.2.1
coverage==6.2
-e git+https://github.com/dask/dask.git@ecdae84aa3b8ee5408876b0b7d7eade3d127e177#egg=dask
distributed==1.19.3
execnet==1.9.0
frozenlist==1.2.0
fsspec==2022.1.0
HeapDict==1.0.1
idna==3.10
idna-ssl==1.1.0
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
jmespath==0.10.0
locket==1.0.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
msgpack-python==0.5.6
multidict==5.2.0
numpy==1.19.5
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pandas==1.1.5
partd==1.2.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
psutil==7.0.0
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
python-dateutil==2.9.0.post0
pytz==2025.2
s3fs==2022.1.0
six==1.17.0
sortedcontainers==2.4.0
tblib==1.7.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tomli==1.2.3
toolz==0.12.0
tornado==6.1
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
wrapt==1.16.0
yarl==1.7.2
zict==2.1.0
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: dask
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- aiobotocore==2.1.2
- aiohttp==3.8.6
- aioitertools==0.11.0
- aiosignal==1.2.0
- async-timeout==4.0.2
- asynctest==0.13.0
- botocore==1.23.24
- charset-normalizer==3.0.1
- click==8.0.4
- cloudpickle==2.2.1
- coverage==6.2
- distributed==1.19.3
- execnet==1.9.0
- frozenlist==1.2.0
- fsspec==2022.1.0
- heapdict==1.0.1
- idna==3.10
- idna-ssl==1.1.0
- jmespath==0.10.0
- locket==1.0.0
- msgpack-python==0.5.6
- multidict==5.2.0
- numpy==1.19.5
- pandas==1.1.5
- partd==1.2.0
- psutil==7.0.0
- pytest-asyncio==0.16.0
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-xdist==3.0.2
- python-dateutil==2.9.0.post0
- pytz==2025.2
- s3fs==2022.1.0
- six==1.17.0
- sortedcontainers==2.4.0
- tblib==1.7.0
- tomli==1.2.3
- toolz==0.12.0
- tornado==6.1
- urllib3==1.26.20
- wrapt==1.16.0
- yarl==1.7.2
- zict==2.1.0
prefix: /opt/conda/envs/dask
|
[
"dask/tests/test_delayed.py::test_to_task_dask",
"dask/tests/test_delayed.py::test_operators"
] |
[] |
[
"dask/tests/test_delayed.py::test_delayed",
"dask/tests/test_delayed.py::test_methods",
"dask/tests/test_delayed.py::test_attributes",
"dask/tests/test_delayed.py::test_method_getattr_optimize",
"dask/tests/test_delayed.py::test_delayed_errors",
"dask/tests/test_delayed.py::test_common_subexpressions",
"dask/tests/test_delayed.py::test_lists",
"dask/tests/test_delayed.py::test_literates",
"dask/tests/test_delayed.py::test_literates_keys",
"dask/tests/test_delayed.py::test_lists_are_concrete",
"dask/tests/test_delayed.py::test_iterators",
"dask/tests/test_delayed.py::test_traverse_false",
"dask/tests/test_delayed.py::test_pure",
"dask/tests/test_delayed.py::test_pure_global_setting",
"dask/tests/test_delayed.py::test_nout",
"dask/tests/test_delayed.py::test_kwargs",
"dask/tests/test_delayed.py::test_array_delayed",
"dask/tests/test_delayed.py::test_array_bag_delayed",
"dask/tests/test_delayed.py::test_delayed_picklable",
"dask/tests/test_delayed.py::test_delayed_compute_forward_kwargs",
"dask/tests/test_delayed.py::test_delayed_method_descriptor",
"dask/tests/test_delayed.py::test_delayed_callable",
"dask/tests/test_delayed.py::test_delayed_name_on_call",
"dask/tests/test_delayed.py::test_callable_obj",
"dask/tests/test_delayed.py::test_name_consistent_across_instances",
"dask/tests/test_delayed.py::test_sensitive_to_partials",
"dask/tests/test_delayed.py::test_delayed_name",
"dask/tests/test_delayed.py::test_finalize_name"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 1,381 |
rorodata__firefly-15
|
6fb71b3970af79aad79f4793e0d9e3304420dd14
|
2017-06-16 17:46:48
|
6fb71b3970af79aad79f4793e0d9e3304420dd14
|
anandology: The argument values are not constants, so they should be in lowercase.
On 3:33PM, Sat, Jun 17, 2017 Nabarun Pal <[email protected]> wrote:
> *@palnabarun* commented on this pull request.
> ------------------------------
>
> In firefly/main.py
> <https://github.com/rorodata/firefly/pull/15#discussion_r122564373>:
>
> >
> def main():
> # ensure current directory is added to sys.path
> if "" not in sys.path:
> sys.path.insert(0, "")
>
> args = parse_args()
> - functions = load_functions(args.functions)
> + print(len(args.functions), args.CONFIG_FILE)
> + if (len(args.functions) > 0 and args.CONFIG_FILE) or (len(args.functions) == 0 and not args.CONFIG_FILE):
> + raise FireflyError("Invalid arguments provided. Please specify either a config file or a list of functions.")
>
> I thought about that. But the current one seemed more verbose to me. Both
> are okay with me.
>
> —
> You are receiving this because you commented.
>
>
> Reply to this email directly, view it on GitHub
> <https://github.com/rorodata/firefly/pull/15#discussion_r122564373>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AAAdkUVfpndTH0tzinN7_Zo2Z9XKCmLfks5sE5H0gaJpZM4N8vrJ>
> .
>
|
diff --git a/firefly/main.py b/firefly/main.py
index dd4a4fb..8db6caf 100644
--- a/firefly/main.py
+++ b/firefly/main.py
@@ -1,30 +1,47 @@
+import os
import sys
import argparse
import importlib
+import yaml
from .app import Firefly
from .server import FireflyServer
+from .validator import ValidationError, FireflyError
def parse_args():
p = argparse.ArgumentParser()
p.add_argument("-b", "--bind", dest="ADDRESS", default="127.0.0.1:8000")
- p.add_argument("functions", nargs='+', help="functions to serve")
+ p.add_argument("-c", "--config", dest="config_file", default=None)
+ p.add_argument("functions", nargs='*', help="functions to serve")
return p.parse_args()
-def load_function(function_spec):
+def load_function(function_spec, path=None, name=None):
if "." not in function_spec:
raise Exception("Invalid function, please specify it as module.function")
mod_name, func_name = function_spec.rsplit(".", 1)
mod = importlib.import_module(mod_name)
func = getattr(mod, func_name)
- return (func_name, func)
+ path = path or "/"+func_name
+ name = name or func_name
+ return (path, name, func)
def load_functions(function_specs):
return [load_function(function_spec) for function_spec in function_specs]
+def parse_config_file(config_file):
+ if not os.path.exists(config_file):
+ raise FireflyError("Specified config file does not exist.")
+ with open(config_file) as f:
+ config_dict = yaml.safe_load(f)
+ return config_dict
+
+def parse_config_data(config_dict):
+ return [(load_function(f["function"], path=f["path"], name=name, ))
+ for name, f in config_dict["functions"].items()]
+
def add_routes(app, functions):
- for name, function in functions:
- app.add_route('/'+name, function, name)
+ for path, name, function in functions:
+ app.add_route(path, function, name)
def main():
# ensure current directory is added to sys.path
@@ -32,7 +49,14 @@ def main():
sys.path.insert(0, "")
args = parse_args()
- functions = load_functions(args.functions)
+
+ if (args.functions and args.CONFIG_FILE) or (not args.functions and not args.CONFIG_FILE):
+ raise FireflyError("Invalid arguments provided. Please specify either a config file or a list of functions.")
+
+ if len(args.functions):
+ functions = load_functions(args.functions)
+ elif args.CONFIG_FILE:
+ functions = parse_config_data(parse_config_file(args.CONFIG_FILE))
app = Firefly()
add_routes(app, functions)
diff --git a/firefly/validator.py b/firefly/validator.py
index b1a2eaf..bb3a477 100644
--- a/firefly/validator.py
+++ b/firefly/validator.py
@@ -8,6 +8,9 @@ else:
class ValidationError(Exception):
pass
+class FireflyError(Exception):
+ pass
+
def validate_args(function, kwargs):
function_signature = signature(function)
try:
diff --git a/requirements.txt b/requirements.txt
index 8ec0719..28de9ef 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,5 @@
gunicorn==19.7.1
WebOb==1.7.2
requests==2.18.1
+PyYAML==3.12
funcsigs==1.0.2 ; python_version < '3'
|
Make firefly support a config file
It should be possible to specify the specs in an yaml config file instead of passing all command-line arguments. Plan for more options for each function, like output-content-type, input-content-type, endpoint etc.
It would be better to have a version field to the config file so that we can handle old versions if we change the format in future.
|
rorodata/firefly
|
diff --git a/tests/test_main.py b/tests/test_main.py
index 7ecfbf2..723def1 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -3,6 +3,7 @@ from firefly.main import load_function
def test_load_functions():
os.path.exists2 = os.path.exists
- name, func = load_function("os.path.exists2")
+ path, name, func = load_function("os.path.exists2")
+ assert path == "/exists2"
assert name == "exists2"
assert func == os.path.exists
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 3
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pyyaml",
"pytest>=3.1.1"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi==2025.1.31
chardet==3.0.4
exceptiongroup==1.2.2
-e git+https://github.com/rorodata/firefly.git@6fb71b3970af79aad79f4793e0d9e3304420dd14#egg=Firefly
gunicorn==19.7.1
idna==2.5
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
PyYAML==6.0.2
requests==2.18.1
tomli==2.2.1
urllib3==1.21.1
WebOb==1.7.2
|
name: firefly
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- certifi==2025.1.31
- chardet==3.0.4
- exceptiongroup==1.2.2
- gunicorn==19.7.1
- idna==2.5
- iniconfig==2.1.0
- packaging==24.2
- pluggy==1.5.0
- pytest==8.3.5
- pyyaml==6.0.2
- requests==2.18.1
- tomli==2.2.1
- urllib3==1.21.1
- webob==1.7.2
prefix: /opt/conda/envs/firefly
|
[
"tests/test_main.py::test_load_functions"
] |
[] |
[] |
[] |
Apache License 2.0
| 1,383 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.