File tree Expand file tree Collapse file tree 5 files changed +765
-0
lines changed Expand file tree Collapse file tree 5 files changed +765
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ repos :
3
+ - repo : https://github.com/astral-sh/ruff-pre-commit
4
+ rev : ' v0.9.2'
5
+ hooks :
6
+ - id : ruff
7
+ args : [--fix, --exit-non-zero-on-fix]
8
+ - id : ruff-format
9
+ - repo : https://github.com/pre-commit/pre-commit-hooks
10
+ rev : v5.0.0
11
+ hooks :
12
+ - id : fix-byte-order-marker
13
+ - id : trailing-whitespace
14
+ exclude : " \\ .svg$|\\ .map$|\\ .min\\ .css$|\\ .min\\ .js$|\\ .po$|\\ .pot$"
15
+ - id : end-of-file-fixer
16
+ exclude : " \\ .svg$|\\ .map$|\\ .min\\ .css$|\\ .min\\ .js$|\\ .po$|\\ .pot$"
17
+ - id : check-toml
18
+ - repo : https://github.com/codespell-project/codespell
19
+ rev : v2.3.0
20
+ hooks :
21
+ - id : codespell
22
+ additional_dependencies :
23
+ - tomli
24
+ args : [--write-changes]
Original file line number Diff line number Diff line change
1
+ 3.13
Original file line number Diff line number Diff line change
1
+ [build-system ]
2
+ requires = [" hatchling" ]
3
+ build-backend = " hatchling.build"
4
+
5
+ [project ]
6
+ name = " pytest-scim2-server"
7
+ version = " 0.1.0"
8
+ description = " SCIM2 server fixture for Pytest "
9
+ readme = " README.md"
10
+ requires-python = " >=3.10"
11
+ dependencies = [
12
+ " portpicker>=1.6.0" ,
13
+ " pytest>=8.3.4" ,
14
+ " scim2-server>=0.1.3" ,
15
+ ]
16
+
17
+ [dependency-groups ]
18
+ dev = [
19
+ " pre-commit-uv>=4.1.4" ,
20
+ " tox-uv>=1.16.0" ,
21
+ ]
22
+
23
+ [project .entry-points ."pytest11" ]
24
+ scim2_server = " pytest_scim2_server"
25
+
26
+ [tool .ruff .lint ]
27
+ select = [
28
+ " B" , # flake8-bugbear
29
+ " D" , # pydocstyle
30
+ " E" , # pycodestyle
31
+ " F" , # pyflakes
32
+ " I" , # isort
33
+ " UP" , # pyupgrade
34
+ ]
35
+ ignore = [
36
+ " E501" , # line-too-long
37
+ " E722" , # bare-except
38
+ " D100" , # public module
39
+ " D101" , # public class
40
+ " D102" , # public method
41
+ " D103" , # public function
42
+ " D104" , # public package
43
+ " D105" , # magic method
44
+ " D106" , # nested class
45
+ " D107" , # public init
46
+ " D203" , # no-blank-line-before-class
47
+ " D213" , # multi-line-summary-second-line
48
+ ]
49
+
50
+ [tool .ruff .lint .isort ]
51
+ force-single-line = true
52
+
53
+ [tool .ruff .format ]
54
+ docstring-code-format = true
Original file line number Diff line number Diff line change
1
+ import threading
2
+ import wsgiref .simple_server
3
+
4
+ import portpicker
5
+ import pytest
6
+ from scim2_server .backend import InMemoryBackend
7
+ from scim2_server .provider import SCIMProvider
8
+ from scim2_server .utils import load_default_resource_types
9
+ from scim2_server .utils import load_default_schemas
10
+
11
+
12
+ @pytest .fixture (scope = "session" )
13
+ def scim2_server ():
14
+ """SCIM2 server running in a thread."""
15
+
16
+ backend = InMemoryBackend ()
17
+ provider = SCIMProvider (backend )
18
+
19
+ for schema in load_default_schemas ().values ():
20
+ provider .register_schema (schema )
21
+
22
+ for resource_type in load_default_resource_types ().values ():
23
+ provider .register_resource_type (resource_type )
24
+
25
+ host = "localhost"
26
+ port = portpicker .pick_unused_port ()
27
+ httpd = wsgiref .simple_server .make_server (host , port , provider )
28
+
29
+ server_thread = threading .Thread (target = httpd .serve_forever )
30
+ server_thread .start ()
31
+ try :
32
+ yield host , port
33
+ finally :
34
+ httpd .shutdown ()
35
+ server_thread .join ()
You can’t perform that action at this time.
0 commit comments