Skip to content

Commit 9243cf5

Browse files
authored
[core] add scaffolding for hybrid model testing (Azure#41466)
1 parent 1c0a58e commit 9243cf5

File tree

21 files changed

+3780
-0
lines changed

21 files changed

+3780
-0
lines changed

sdk/core/azure-core/dev_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ aiohttp<3.8.6 ; platform_python_implementation == "PyPy"
55
aiohttp ; platform_python_implementation != "PyPy"
66
-e ../../../tools/azure-sdk-tools
77
-e tests/testserver_tests/coretestserver
8+
-e tests/specs_sdk/scratch
89
pytest-trio
910
azure-storage-blob
1011
azure-data-tables
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import "@azure-tools/typespec-client-generator-core";
2+
3+
using Azure.ClientGenerator.Core;
4+
5+
@usage(Usage.input)
6+
namespace ModelTest;
7+
/** A scratch model for testing purposes */
8+
9+
model Scratch {
10+
/** A string property */
11+
prop: string;
12+
}
13+
14+
/**
15+
* Model with one level of flattening
16+
*/
17+
model FlattenModel {
18+
name: string;
19+
20+
#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
21+
@flattenProperty
22+
properties: PropertiesModel;
23+
}
24+
25+
/**
26+
* Properties model
27+
*/
28+
model PropertiesModel {
29+
description: string;
30+
age: int32;
31+
}
32+
33+
/**
34+
* Model with a property that has a client name
35+
*/
36+
model ClientNamedPropertyModel {
37+
@clientName("propClientName")
38+
propServiceName: string;
39+
}
40+
41+
/**
42+
* Model with a readonly property
43+
*/
44+
model ReadonlyModel {
45+
@visibility(Lifecycle.Read)
46+
id: int32;
47+
}

sdk/core/azure-core/tests/specs/scratch/tspconfig.yaml

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Release History
2+
3+
## 1.0.0b1 (1970-01-01)
4+
5+
- Initial version
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) Microsoft Corporation.
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include *.md
2+
include LICENSE
3+
include modeltest/py.typed
4+
recursive-include tests *.py
5+
recursive-include samples *.py *.md
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Azure Smoke Test for Python
2+
3+
<!-- write necessary description of service -->
4+
5+
## Getting started
6+
7+
### Install the package
8+
9+
```bash
10+
python -m pip install test
11+
```
12+
13+
#### Prequisites
14+
15+
- Python 3.9 or later is required to use this package.
16+
- You need an [Azure subscription][azure_sub] to use this package.
17+
- An existing Test instance.
18+
19+
## Key concepts
20+
21+
Used for testing our module-level methods with hybrid and msrest models
22+
23+
## Examples
24+
25+
N/A
26+
27+
## Troubleshooting
28+
29+
N/A
30+
31+
## Next steps
32+
33+
Add more tests
34+
35+
## Contributing
36+
37+
This project welcomes contributions and suggestions. Most contributions require
38+
you to agree to a Contributor License Agreement (CLA) declaring that you have
39+
the right to, and actually do, grant us the rights to use your contribution.
40+
For details, visit https://cla.microsoft.com.
41+
42+
When you submit a pull request, a CLA-bot will automatically determine whether
43+
you need to provide a CLA and decorate the PR appropriately (e.g., label,
44+
comment). Simply follow the instructions provided by the bot. You will only
45+
need to do this once across all repos using our CLA.
46+
47+
This project has adopted the
48+
[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
49+
see the Code of Conduct FAQ or contact [email protected] with any
50+
additional questions or comments.
51+
52+
<!-- LINKS -->
53+
54+
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
55+
[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
56+
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
57+
[azure_identity_pip]: https://pypi.org/project/azure-identity/
58+
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
59+
[pip]: https://pypi.org/project/pip/
60+
[azure_sub]: https://azure.microsoft.com/free/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"CrossLanguagePackageId": "",
3+
"CrossLanguageDefinitionId": {
4+
"modeltest.models.ClientNamedPropertyModel": "ModelTest.ClientNamedPropertyModel",
5+
"modeltest.models.FlattenModel": "ModelTest.FlattenModel",
6+
"modeltest.models.PropertiesModel": "ModelTest.PropertiesModel",
7+
"modeltest.models.ReadonlyModel": "ModelTest.ReadonlyModel",
8+
"modeltest.models.Scratch": "ModelTest.Scratch"
9+
}
10+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-e ../../../tools/azure-sdk-tools
2+
../../core/azure-core
3+
aiohttp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore

0 commit comments

Comments
 (0)