Skip to content

Commit c7501d9

Browse files
authored
Run "WordPressData unit tests" as part of "WordPress Unit Tests" (#25669)
* Run "WordPressData unit tests" as part of "WordPress Unit Tests" * Resource bundle lookup workaround
1 parent 25db850 commit c7501d9

6 files changed

Lines changed: 17 additions & 107 deletions

File tree

.buildkite/pipeline.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,6 @@ steps:
9090
# notify:
9191
# - github_commit_status:
9292
# context: "Unit Tests Keystone"
93-
- label: "🔬 WordPressData Unit Tests"
94-
command: .buildkite/commands/run-unit-tests-for-scheme.sh WordPressData
95-
plugins: [$CI_TOOLKIT_PLUGIN]
96-
artifact_paths:
97-
- "build/results/*"
98-
notify:
99-
- github_commit_status:
100-
context: "Unit Tests WordPressData"
10193

10294
#################
10395
# Linters

AGENTS.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ WordPress-iOS uses a modular architecture with the main app and separate Swift p
4949
- **Localization**: follow best practices from @docs/localization.md
5050

5151
## Xcode Schemes
52-
- `WordPress` builds the WordPress iOS app and runs `WordPressUnitTests.xctestplan` — default for builds and the full unit test suite.
52+
- `WordPress` builds the WordPress iOS app and runs `WordPressUnitTests.xctestplan` — default for builds and the full unit test suite. Use this scheme to run unit tests.
5353
- `Jetpack` builds the Jetpack iOS app — switch to it for Jetpack-only work.
54-
- Some test targets (e.g. `WordPressDataTests`) have their own scheme and aren't in `WordPressUnitTests.xctestplan`. If the `WordPress` scheme fails to build because of an unrelated target, fall back to the target's dedicated scheme.
5554

5655
## Simulator Sign-In
5756

Modules/Sources/WordPressData/Swift/Bundle+WordPressData.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ import Foundation
22

33
extension Bundle {
44
@objc public class var wordPressData: Bundle {
5-
.module
5+
#if DEBUG
6+
// Workaround for https://forums.swift.org/t/swift-5-3-swiftpm-resources-in-tests-uses-wrong-bundle-path/37051
7+
if let testBundlePath = ProcessInfo.processInfo.environment["XCTestBundlePath"],
8+
let bundle = Bundle(path: "\(testBundlePath)/Modules_WordPressData.bundle")
9+
{
10+
return bundle
11+
}
12+
#endif
13+
return .module
614
}
715
}

Modules/Tests/WordPressDataTests/WordPressData.xctestplan

Lines changed: 0 additions & 24 deletions
This file was deleted.

Tests/KeystoneTests/WordPressUnitTests.xctestplan

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@
115115
"name" : "WordPressMediaLibraryTests"
116116
}
117117
},
118+
{
119+
"target" : {
120+
"containerPath" : "container:..\/Modules",
121+
"identifier" : "WordPressDataTests",
122+
"name" : "WordPressDataTests"
123+
}
124+
},
118125
{
119126
"target" : {
120127
"containerPath" : "container:WordPress.xcodeproj",

WordPress/WordPress.xcodeproj/xcshareddata/xcschemes/WordPressData.xcscheme

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)