Skip to content

Commit 6df716a

Browse files
vitautfacebook-github-bot
authored andcommitted
Stop dirsyncing fixtures again
Summary: dirsync was temporarily enabled for fixtures in D68628003 so that ShipIt could be switched to xplat without causing massive code churn on GitHub. Now that xplat is the source of truth for both ShipIt and fbcode_builder, disable dirsync again, removing the fbcode copy of fixtures. Among other things, this fixes a regression in developer experience, particularly with source control operations. Enable and fix `build_fixtures` and `fixture_test` in xplat. Reviewed By: yoney Differential Revision: D68730277 fbshipit-source-id: dc77903caff7558cd95fb27bcbc1160284c8efcf
1 parent d9555aa commit 6df716a

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

thrift/compiler/test/build_fixtures.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@
2626
from pathlib import Path
2727
from typing import Optional
2828

29-
from thrift.compiler.test import fixture_utils
29+
from xplat.thrift.compiler.test import fixture_utils
3030

3131
"""
32-
* Invoke from the `/fbsource/fbcode/` directory using `buck run`:
32+
* Invoke from the `fbsource` directory using `buck run`:
3333
34-
buck run thrift/compiler/test:build_fixtures
34+
buck run xplat/thrift/compiler/test:build_fixtures
3535
36-
will build all fixtures under `thrift/compiler/test/fixtures`. Or
36+
will build all fixtures under `xplat/thrift/compiler/test/fixtures`. Or
3737
38-
buck run thrift/compiler/test:build_fixtures -- --fixture-names [$FIXTURENAMES]
38+
buck run xplat/thrift/compiler/test:build_fixtures -- --fixture-names [$FIXTURENAMES]
3939
40-
will only build selected fixtures under `thrift/compiler/test/fixtures`.
40+
will only build selected fixtures under `xplat/thrift/compiler/test/fixtures`.
4141
4242
$FIXTURENAMES is a space-separated list of fixture names to build specifically
4343
(default is to build all fixtures).
@@ -191,6 +191,7 @@ async def main() -> int:
191191

192192
repo_root_dir_abspath = Path(args.repo_root_dir).resolve(strict=True)
193193
assert repo_root_dir_abspath.is_dir()
194+
repo_root_dir_abspath = repo_root_dir_abspath / "xplat"
194195

195196
# Directory that contains all fixture directories (one fixture per sub-dir).
196197
fixtures_root_dir_abspath = repo_root_dir_abspath / "thrift/compiler/test/fixtures"

thrift/compiler/test/fixture_test.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import unittest
2828
from pathlib import Path
2929

30-
from thrift.compiler.test import fixture_utils
30+
from xplat.thrift.compiler.test import fixture_utils
3131

3232

3333
_THRIFT_BIN_PATH = fixture_utils.get_thrift_binary_path(thrift_bin_arg=None)
@@ -108,7 +108,7 @@ def setUp(self) -> None:
108108
self.maxDiff = None
109109

110110
def runTest(self, fixture_name: str) -> None:
111-
repo_root_dir_abspath = Path.cwd()
111+
repo_root_dir_abspath = Path.cwd() / "xplat"
112112
fixture_dir_abspath = (
113113
repo_root_dir_abspath / _FIXTURES_ROOT_DIR_RELPATH / fixture_name
114114
)
@@ -132,6 +132,7 @@ def runTest(self, fixture_name: str) -> None:
132132
subprocess.check_call(
133133
fixture_cmd.build_command_args,
134134
close_fds=True,
135+
cwd=repo_root_dir_abspath,
135136
)
136137

137138
# Compare generated code to fixture code
@@ -150,7 +151,9 @@ def test_method(self):
150151
setattr(klazz, test_method.__name__, test_method)
151152

152153

153-
for fixture_name in fixture_utils.get_all_fixture_names(_FIXTURES_ROOT_DIR_RELPATH):
154+
for fixture_name in fixture_utils.get_all_fixture_names(
155+
"xplat" / _FIXTURES_ROOT_DIR_RELPATH
156+
):
154157
_add_fixture(FixtureTest, fixture_name)
155158

156159
if __name__ == "__main__":

0 commit comments

Comments
 (0)